Skip to content

Commit 8a3409d

Browse files
authored
chore: Introduce SOC-2 compliant release process (#68)
## Motivation Use GH environments and a no-op step along with `needs` chaining to achieve a flow where both QA and management have to approve the release. I also parametrized e2e tests, we might want to trigger these tests from other places too. I also fixed the issue with Goreleaser, ref: nobl9/terraform-provider-nobl9#182
1 parent c6c4ace commit 8a3409d

File tree

3 files changed

+56
-10
lines changed

3 files changed

+56
-10
lines changed

.github/workflows/e2e-tests.yml

+31-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,46 @@
11
name: End-to-end tests
22
on:
3-
push:
4-
tags:
5-
- "v*"
3+
workflow_call:
4+
inputs:
5+
clientId:
6+
description: Client ID to use for authentication
7+
required: true
8+
type: string
9+
oktaOrgUrl:
10+
description: Okta organization URL
11+
required: false
12+
type: string
13+
oktaAuthServer:
14+
description: Okta authentication server identifier
15+
required: false
16+
type: string
17+
ref:
18+
description: Reference branch, tag or commit SHA to checkout
19+
required: false
20+
type: string
21+
default: main
22+
secrets:
23+
clientSecret:
24+
description: Client secret to use for authentication
25+
required: true
626
jobs:
727
test:
828
name: Run e2e tests
929
runs-on: ubuntu-latest
1030
steps:
1131
- name: Check out code
1232
uses: actions/checkout@v4
33+
with:
34+
repository: nobl9/sloctl
35+
ref: ${{ inputs.ref }}
1336
- uses: actions/setup-go@v5
1437
with:
1538
go-version-file: go.mod
1639
cache: false
1740
- name: Run tests
18-
run: make test/e2e
1941
env:
20-
SLOCTL_CLIENT_ID: ${{ vars.SLOCTL_CLIENT_ID }}
21-
SLOCTL_CLIENT_SECRET: ${{ secrets.SLOCTL_CLIENT_SECRET }}
42+
SLOCTL_CLIENT_ID: ${{ inputs.clientId }}
43+
SLOCTL_CLIENT_SECRET: ${{ secrets.clientSecret }}
44+
SLOCTL_OKTA_ORG_URL: "${{ inputs.oktaOrgUrl }}"
45+
SLOCTL_OKTA_AUTH_SERVER: "${{ inputs.oktaAuthServer }}"
46+
run: make test/e2e

.github/workflows/release-candidate.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@ name: Release candidate
22
on:
33
push:
44
tags:
5-
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"
5+
- "v[0-9]+.[0-9]+.[0-9]+-*"
66
jobs:
7+
test:
8+
uses: ./.github/workflows/e2e-tests.yml
9+
with:
10+
clientId: "${{ vars.SLOCTL_CLIENT_ID }}"
11+
ref: "${{ github.ref_name }}"
12+
secrets:
13+
clientSecret: "${{ secrets.SLOCTL_CLIENT_SECRET }}"
714
release:
815
runs-on: ubuntu-latest
916
steps:
1017
- name: Checkout Source
1118
uses: actions/checkout@v4
12-
with:
13-
fetch-depth: 0
1419
- name: Set up Go
1520
uses: actions/setup-go@v5
1621
with:
@@ -23,3 +28,4 @@ jobs:
2328
args: release --clean --skip=homebrew
2429
env:
2530
GITHUB_TOKEN: ${{ secrets.GORELEASER_TOKEN }}
31+
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}

.github/workflows/release.yml

+16-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,23 @@ on:
44
tags:
55
- "v[0-9]+.[0-9]+.[0-9]+"
66
jobs:
7+
test:
8+
uses: ./.github/workflows/e2e-tests.yml
9+
with:
10+
clientId: "${{ vars.SLOCTL_CLIENT_ID }}"
11+
ref: "${{ github.ref_name }}"
12+
secrets:
13+
clientSecret: "${{ secrets.SLOCTL_CLIENT_SECRET }}"
14+
qa:
15+
runs-on: ubuntu-latest
16+
environment: qa-approval
17+
steps:
18+
- name: No-op approval
19+
run: echo "This is a no-op step, QA needs to approve it and may perform testing beforehand"
720
release:
821
runs-on: ubuntu-latest
9-
environment: release
22+
needs: [test, qa]
23+
environment: management-approval
1024
steps:
1125
- name: Checkout Source
1226
uses: actions/checkout@v4
@@ -43,6 +57,7 @@ jobs:
4357
args: release --clean
4458
env:
4559
GITHUB_TOKEN: ${{ secrets.GORELEASER_TOKEN }}
60+
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
4661
- name: Build and push
4762
id: docker_build
4863
uses: docker/build-push-action@v5

0 commit comments

Comments
 (0)