Add runtime LinkedIn feed sync #484
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: terraform-quality-gate | |
| on: | |
| pull_request: | |
| branches: ["env/prod", "env/test"] | |
| push: | |
| branches: ["env/prod", "env/test"] | |
| concurrency: | |
| group: terraform-quality-gate-${{ github.event.pull_request.base.ref || github.ref_name }} | |
| cancel-in-progress: false | |
| permissions: | |
| contents: read | |
| jobs: | |
| qa: | |
| runs-on: ubuntu-latest | |
| env: | |
| TF_IN_AUTOMATION: "true" | |
| defaults: | |
| run: | |
| shell: bash | |
| working-directory: terraform | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: false | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.x" | |
| - name: Install Python YAML dependency | |
| run: python -m pip install --disable-pip-version-check pyyaml | |
| - name: Secret hygiene | |
| env: | |
| SECRET_SCAN_BASE: ${{ github.event.pull_request.base.sha || github.event.before || 'HEAD' }} | |
| SECRET_SCAN_HEAD: ${{ github.sha }} | |
| run: python ../.github/scripts/secret-guard.py --base "${SECRET_SCAN_BASE}" --head "${SECRET_SCAN_HEAD}" | |
| - name: Shell script syntax | |
| run: | | |
| bash -n \ | |
| ../scripts/proxmox-runners/install-proxmox-runner-tunnel.sh \ | |
| ../.github/scripts/resolve-snapshot-matrix.sh \ | |
| ../.github/scripts/resolve-restore-matrix.sh \ | |
| ../.github/scripts/validate-snapshot-target-selection.sh \ | |
| ../.github/scripts/restore-drill-janitor.sh \ | |
| snapshot-restore-drill/scripts/restore-drill.sh | |
| - name: Validate snapshot target selection | |
| run: bash ../.github/scripts/validate-snapshot-target-selection.sh | |
| - name: Validate runner inventory example | |
| run: python ../.github/scripts/validate-proxmox-runner-platform.py ../docs/proxmox-runner-inventory.example.yaml | |
| - name: Runnerctl unit tests | |
| run: python -m unittest discover -s jenkins-k8s/runtime/runnerctl -p "test_*.py" | |
| - uses: hashicorp/setup-packer@v3 | |
| - name: Packer fmt | |
| run: packer fmt -check ../packer/proxmox | |
| - name: Packer init | |
| run: packer init ../packer/proxmox | |
| - name: Packer validate | |
| run: packer validate ../packer/proxmox | |
| - uses: hashicorp/setup-terraform@v4 | |
| with: | |
| terraform_version: 1.6.6 | |
| - name: Terraform fmt | |
| run: terraform fmt -check -recursive | |
| - name: Terraform init (no backend) | |
| run: terraform init -backend=false -input=false | |
| - name: Terraform validate | |
| run: terraform validate -no-color | |
| - name: Terraform init snapshots (no backend) | |
| run: terraform -chdir=snapshots init -backend=false -input=false | |
| - name: Terraform validate snapshots | |
| run: terraform -chdir=snapshots validate -no-color | |
| - name: Terraform init snapshot restore drill (no backend) | |
| run: terraform -chdir=snapshot-restore-drill init -backend=false -input=false | |
| - name: Terraform validate snapshot restore drill | |
| run: terraform -chdir=snapshot-restore-drill validate -no-color | |
| - name: Terraform init IAM (no backend) | |
| run: terraform -chdir=iam init -backend=false -input=false | |
| - name: Terraform validate IAM | |
| run: terraform -chdir=iam validate -no-color | |
| generate: | |
| needs: qa | |
| if: github.event_name == 'push' && github.ref_name == 'env/prod' && github.actor != 'github-actions[bot]' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: false | |
| fetch-depth: 0 | |
| - uses: terraform-docs/gh-actions@v1.4.1 | |
| with: | |
| working-dir: terraform | |
| output-file: TERRAFORM.md | |
| output-method: replace | |
| - uses: terraform-docs/gh-actions@v1.4.1 | |
| with: | |
| working-dir: terraform/snapshots | |
| output-file: TERRAFORM.md | |
| output-method: replace | |
| - uses: terraform-docs/gh-actions@v1.4.1 | |
| with: | |
| working-dir: terraform/snapshot-restore-drill | |
| output-file: TERRAFORM.md | |
| output-method: replace | |
| - name: Generate Kube diagram | |
| run: | | |
| set -euo pipefail | |
| files="$(git ls-files \ | |
| 'terraform/k8s/*.yaml' \ | |
| 'terraform/k8s/*.tpl.yaml' \ | |
| 'terraform/k8s/**/*.yaml' \ | |
| 'terraform/k8s/**/*.tpl.yaml' \ | |
| | grep -v '/kustomization.yaml$' \ | |
| | grep -v '/.sops.yaml$' \ | |
| | grep -v '^terraform/k8s/vars/.*/secrets/' \ | |
| | tr '\n' ' ')" | |
| if [ -z "$files" ]; then | |
| echo "No Kubernetes manifest files found." | |
| exit 1 | |
| fi | |
| cat $files | docker run --rm -i \ | |
| -v "$GITHUB_WORKSPACE":/work \ | |
| -w /work \ | |
| philippemerle/kubediagrams \ | |
| kube-diagrams - -o KUBEDIAGRAM.svg -f svg --embed-all-icons | |
| cat $files | docker run --rm -i \ | |
| -v "$GITHUB_WORKSPACE":/work \ | |
| -w /work \ | |
| philippemerle/kubediagrams \ | |
| kube-diagrams - -o KUBEDIAGRAM.png -f png | |
| perl -0pi -e 's/<!-- [0-9a-f]{32}(->[0-9a-f]{32})? -->\n//g; s~<title>[0-9a-f]{32}(->[0-9a-f]{32})?</title>\n~~g' KUBEDIAGRAM.svg | |
| - uses: terraform-docs/gh-actions@v1.4.1 | |
| with: | |
| working-dir: terraform/iam | |
| output-file: TERRAFORM.md | |
| output-method: replace | |
| - name: Commit and push if changed | |
| run: | | |
| set -euo pipefail | |
| sudo chown -R "$(id -u):$(id -g)" "$GITHUB_WORKSPACE" | |
| if [ -z "$(git status --porcelain -- terraform/TERRAFORM.md terraform/snapshots/TERRAFORM.md terraform/snapshot-restore-drill/TERRAFORM.md terraform/iam/TERRAFORM.md KUBEDIAGRAM.svg KUBEDIAGRAM.png)" ]; then | |
| echo "No changes to generated files." | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add terraform/TERRAFORM.md terraform/snapshots/TERRAFORM.md terraform/snapshot-restore-drill/TERRAFORM.md terraform/iam/TERRAFORM.md KUBEDIAGRAM.svg KUBEDIAGRAM.png | |
| git commit -m "chore(ci): update generated files [skip ci]" | |
| git push |