commit bc7f7cc47723e4d2de2f93414a63a19cf9d577c6 Author: Mauritz Uphoff Date: Thu Sep 4 15:28:08 2025 +0200 Initial commit diff --git a/.forgejo/workflows/action.yaml b/.forgejo/workflows/action.yaml new file mode 100644 index 0000000..1cc12c8 --- /dev/null +++ b/.forgejo/workflows/action.yaml @@ -0,0 +1,73 @@ +name: Setup Stackit CLI + +on: + push: + branches: + - main + - dev + +jobs: + setup-stackit-cli: + name: Install and Use Stackit CLI + runs-on: docker-dind + + env: + STACKIT_SERVICE_ACOUNT_KEY: ${{ secrets.STACKIT_SERVICE_ACOUNT_KEY }} + STACKIT_PROJECT_ID: ${{ secrets.STACKIT_PROJECT_ID }} + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Download and Install Stackit CLI + run: | + # Define variables + VERSION="0.40.7" + BIN_DIR="/usr/local/bin" + DOWNLOAD_URL="https://github.com/stackitcloud/stackit-cli/releases/download/v${VERSION}/stackit-cli_${VERSION}_linux_amd64.tar.gz" + + # Download and extract + curl -sSL "$DOWNLOAD_URL" | tar -xz + + # Move CLI binary to PATH + mv stackit "$BIN_DIR/" + chmod +x "$BIN_DIR/stackit" + + # Verify installation + stackit --version + shell: bash + + - name: Install kubectl + run: | + # Get latest version + curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + chmod +x kubectl + mv kubectl /usr/local/bin/kubectl + + # Verify kubectl installation + kubectl version --client --output=yaml + shell: bash + + - name: Authenticate with STACKIT + run: | + echo "$STACKIT_SERVICE_ACOUNT_KEY" > "$HOME/.stackit.json" + stackit auth activate-service-account --service-account-key-path "$HOME/.stackit.json" + shell: bash + + - name: Set project config + run: | + stackit config set --project-id "$STACKIT_PROJECT_ID" + shell: bash + + - name: Get Kubeconfig SKE Cluster + run: stackit ske kubeconfig create pocnc-k8s --assume-yes + shell: bash + + - name: Kubectl apply all namespaces in root folder + run: kubectl apply -f . + shell: bash + + - name: Cleanup + run: rm -f "$HOME/.stackit.json" + if: always() + shell: bash \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/ci-runner/runner.yaml b/ci-runner/runner.yaml new file mode 100644 index 0000000..d4f1f83 --- /dev/null +++ b/ci-runner/runner.yaml @@ -0,0 +1,98 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: forgejo-runner +--- +apiVersion: v1 +stringData: + token: "" +kind: Secret +metadata: + name: runner-secret + namespace: forgejo-runner +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: forgejo-runner + name: forgejo-runner + namespace: forgejo-runner +spec: + replicas: 2 + selector: + matchLabels: + app: forgejo-runner + template: + metadata: + labels: + app: forgejo-runner + spec: + restartPolicy: Always + volumes: + - name: runner-data + emptyDir: {} + initContainers: + - name: runner-register + image: code.forgejo.org/forgejo/runner:6.3.1 + command: + - forgejo-runner + - register + - --no-interactive + - --instance + - $(FORGEJO_INSTANCE_URL) + - --token + - $(RUNNER_SECRET) + - --labels + - docker-dind # replace with your runner name + env: + - name: RUNNER_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: RUNNER_SECRET + valueFrom: + secretKeyRef: + name: runner-secret + key: token + - name: FORGEJO_INSTANCE_URL + value: https://xxx.git.onstackit.cloud/ # replace with your git instance + volumeMounts: + - name: runner-data + mountPath: /data + + containers: + - name: runner + image: code.forgejo.org/forgejo/runner:6.3.1 + command: + - sh + - -c + - | + echo "Waiting for Docker daemon..." + while ! nc -z localhost 2375 /data/config.yml + sed -i -e "s|privileged: .*|privileged: true|" /data/config.yml + exec forgejo-runner -c /data/config.yml daemon + env: + - name: DOCKER_HOST + value: tcp://localhost:2375 + securityContext: + privileged: true + runAsUser: 0 + volumeMounts: + - name: runner-data + mountPath: /data + + - name: daemon + image: docker:27.0.1-dind + command: + - dockerd + - -H + - tcp://0.0.0.0:2375 + - --tls=false + securityContext: + privileged: true \ No newline at end of file diff --git a/test1.yaml b/test1.yaml new file mode 100644 index 0000000..2dc9bbe --- /dev/null +++ b/test1.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: test1