Skip to content

Commit

Permalink
fix: update deps, go1.22, align ci pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
raffis committed Sep 2, 2024
1 parent e5ca221 commit e4baf09
Show file tree
Hide file tree
Showing 24 changed files with 746 additions and 605 deletions.
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/VULN-TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Vulnerabilities detected
labels: security
---
High or critical vulnerabilities detected. Scan results are below:

{{ env.RESULTS }}
17 changes: 6 additions & 11 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,22 @@ on:
branches:
- master

permissions: {}

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Setup Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: 1.20.x
- name: Restore Go cache
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version: 1.22.x
- name: Tests
run: make test
- name: Send go coverage report
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/pr-actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: pr-actions

permissions: {}

on:
pull_request:
branches:
- 'master'

jobs:
ensure-sha-pinned:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Ensure SHA pinned actions
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@3c16e895bb662b4d7e284f032cbe8835a57773cc # v3.0.11
with:
# slsa-github-generator requires using a semver tag for reusable workflows.
# See: https://github.com/slsa-framework/slsa-github-generator#referencing-slsa-builders-and-generators
allowlist: |
slsa-framework/slsa-github-generator
95 changes: 41 additions & 54 deletions .github/workflows/pr-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ on:
- synchronize
- reopened

permissions: {}

jobs:
lint-chart:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0

Expand All @@ -25,7 +27,7 @@ jobs:
with:
version: v3.4.0

- uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa # v4.8.0
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: 3.7

Expand All @@ -46,22 +48,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Setup Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: 1.20.x
- name: Restore Go cache
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version: 1.22.x
- name: fmt
run: make fmt
- name: vet
Expand All @@ -81,28 +76,21 @@ jobs:
strategy:
matrix:
kubernetes-version:
- "1.25"
- "1.26"
- "1.27"
- "1.28"
- "1.29"
- "1.30"
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Setup Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: 1.20.x
- name: Restore Go cache
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version: 1.22.x
- name: run test
run: make test ENVTEST_K8S_VERSION=${{ matrix.kubernetes-version }}

Expand All @@ -112,22 +100,15 @@ jobs:
profiles: ${{ steps.profiles.outputs.matrix }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Setup Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: 1.20.x
- name: Restore Go cache
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version: 1.22.x
- name: build
run: make build
- name: Check if working tree is dirty
Expand All @@ -144,7 +125,7 @@ jobs:
run: |
docker save --output cloud-autoscale-controller-container.tar cloud-autoscale-controller:latest
- name: Upload image
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: cloud-autoscale-controller-container
path: cloud-autoscale-controller-container.tar
Expand All @@ -164,21 +145,21 @@ jobs:
profile: ${{ fromJson(needs.build.outputs.profiles) }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Setup Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: 1.20.x
go-version: 1.22.x
- name: Setup Kubernetes
uses: engineerd/setup-kind@aa272fe2a7309878ffc2a81c56cfe3ef108ae7d0 #v0.5.0
with:
version: v0.17.0
- name: Download cloud-autoscale-controller container
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a #v3.0.2
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: cloud-autoscale-controller-container
path: /tmp
Expand All @@ -187,18 +168,18 @@ jobs:
docker load --input /tmp/cloud-autoscale-controller-container.tar
docker image ls -a
- name: Setup Kustomize
uses: imranismail/setup-kustomize@6691bdeb1b0a3286fb7f70fd1423c10e81e5375f # v2.0.0
uses: imranismail/setup-kustomize@2ba527d4d055ab63514ba50a99456fc35684947f # v2.1.0
- name: Run test
run: |
make kind-test TEST_PROFILE=${{ matrix.profile }}
- name: Debug failure
if: failure()
run: |
kubectl -n kube-system describe pods
kubectl -n growthbook-system describe pods
kubectl -n growthbook-system get all
kubectl -n growthbook-system logs deploy/cloud-autoscale-controller
kubectl -n growthbook-system get growthbookinstance -o yaml
kubectl -n cloud-autoscale-system describe pods
kubectl -n cloud-autoscale-system get all
kubectl -n cloud-autoscale-system logs deploy/cloud-autoscale-controller
kubectl -n cloud-autoscale-system get cloud-autoscaleinstance -o yaml
test-chart:
runs-on: ubuntu-latest
Expand All @@ -207,29 +188,29 @@ jobs:
- lint-chart
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 #v3.5

- uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa # v4.8.0
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: 3.7

- name: Set up chart-testing
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1

- name: Create kind cluster
uses: helm/kind-action@99576bfa6ddf9a8e612d83b513da5a75875caced # v1.9.0
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0

- name: Download cloud-autoscale-controller container
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: cloud-autoscale-controller-container
path: /tmp
Expand All @@ -243,3 +224,9 @@ jobs:
- name: Run chart-testing (install)
run: ct install --target-branch=master --chart-dirs chart

test-success:
runs-on: ubuntu-latest
needs: [test, e2e-tests]
steps:
- run: echo "all tests succeeded"
27 changes: 27 additions & 0 deletions .github/workflows/pr-goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: pr-gorelaser

permissions: {}

on:
pull_request:
branches:
- 'master'

jobs:
validate-config:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Validate .goreleaser.yaml
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
version: latest
args: check
env:
RUNNER_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.DOODLE_OSS_BOT}}
8 changes: 6 additions & 2 deletions .github/workflows/pr-label.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@ name: pr-label
on:
pull_request:

permissions: {}

jobs:
size-label:
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' }}
permissions:
pull-requests: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit
- name: size-label
uses: "pascalgn/size-label-action@b1f4946f381d38d3b5960f76b514afdfef39b609"
uses: "pascalgn/size-label-action@49850f3557d4b77f0b2e759829defd77ccc07c54"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
18 changes: 18 additions & 0 deletions .github/workflows/pr-stale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: pr-stale
on:
schedule:
- cron: '30 1 * * *'

permissions: {}

jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0
with:
days-before-close: '120'
stale-pr-label: stale
repo-token: ${{ github.token }}
28 changes: 28 additions & 0 deletions .github/workflows/pr-trivy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: pr-trivy
on: pull_request

permissions: {}

jobs:
trivy:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

- name: Trivy fs scan
uses: aquasecurity/trivy-action@6e7b7d1fd3e4fef0c5fa8cce1229c54b2c9bd0d8 # 0.24.0
with:
scan-type: 'fs'
ignore-unfixed: true
scanners: license,vuln,secret
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6
with:
sarif_file: 'trivy-results.sarif'
Loading

0 comments on commit e4baf09

Please sign in to comment.