Skip to content

Commit f1de570

Browse files
authored
ci: update workflows (#22)
* ci: update workflows * ci: docker-build depends on build * ci: build target * ci: remove old dockerfile from goreleaser * ci: update kind version * ci: disable cgo
1 parent 9d9e96b commit f1de570

File tree

11 files changed

+88
-50
lines changed

11 files changed

+88
-50
lines changed

.github/workflows/main.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: main
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3
14+
- name: Setup Go
15+
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
16+
with:
17+
go-version: 1.20.x
18+
- name: Restore Go cache
19+
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
20+
with:
21+
path: ~/go/pkg/mod
22+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
23+
restore-keys: |
24+
${{ runner.os }}-go-
25+
- name: Tests
26+
run: make test
27+
- name: Send go coverage report
28+
uses: shogo82148/actions-goveralls@31ee804b8576ae49f6dc3caa22591bc5080e7920 #v1.6.0
29+
with:
30+
path-to-profile: coverage.out

.github/workflows/pr-build.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,15 @@ jobs:
4747
fi
4848
- name: Build container image
4949
run: |
50-
make docker-build IMG=test/k8soauth2-proxy-controller:latest BUILD_PLATFORMS=linux/amd64 \
51-
BUILD_ARGS="--cache-from=type=local,src=/tmp/.buildx-cache \
52-
--cache-to=type=local,dest=/tmp/.buildx-cache-new,mode=max"
50+
make docker-build
5351
- name: Setup Kubernetes
5452
uses: engineerd/setup-kind@aa272fe2a7309878ffc2a81c56cfe3ef108ae7d0 #v0.5.0
5553
with:
5654
version: v0.17.0
5755
- name: Load test image
58-
run: kind load docker-image test/k8soauth2-proxy-controller:latest
56+
run: kind load docker-image k8soauth2-proxy-controller:latest
5957
- name: Deploy controller
60-
run: make deploy IMG=test/k8soauth2-proxy-controller:latest
58+
run: make deploy
6159
- name: Debug failure
6260
if: failure()
6361
run: |

.github/workflows/pr-chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Lint and Test Charts
1+
name: pr-chart
22

33
on: pull_request
44

.github/workflows/release-chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release Chart
1+
name: release-chart
22

33
on:
44
push:

.github/workflows/scan.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: scan
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
schedule:
9+
- cron: '18 10 * * 3'
10+
11+
permissions:
12+
contents: read # for actions/checkout to fetch code
13+
security-events: write # for codeQL to write security events
14+
15+
jobs:
16+
fossa:
17+
name: FOSSA
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
21+
- name: Run FOSSA scan and upload build data
22+
uses: fossa-contrib/fossa-action@6728dc6fe9a068c648d080c33829ffbe56565023 # v2.0.0
23+
with:
24+
# FOSSA Push-Only API Token
25+
fossa-api-key: 956b9b92c5b16eeca1467cebe104f2c3
26+
github-token: ${{ github.token }}
27+
28+
codeql:
29+
name: CodeQL
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
34+
- name: Initialize CodeQL
35+
uses: github/codeql-action/init@dc046388f30eacf938aadd32064285f437bd9c04 #codeql-bundle-20221020
36+
with:
37+
languages: go
38+
- name: Autobuild
39+
uses: github/codeql-action/autobuild@dc046388f30eacf938aadd32064285f437bd9c04 #codeql-bundle-20221020
40+
- name: Perform CodeQL Analysis
41+
uses: github/codeql-action/analyze@dc046388f30eacf938aadd32064285f437bd9c04 #codeql-bundle-20221020

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*.so
77
*.dylib
88
bin
9+
manager
910

1011
# Test binary, build with `go test -c`
1112
*.test

.goreleaser.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ sboms:
3333
dockers:
3434
- image_templates:
3535
- ghcr.io/doodlescheduling/{{ .ProjectName }}:v{{ .Version }}-amd64
36-
dockerfile: Dockerfile.release
36+
dockerfile: Dockerfile
3737
use: buildx
3838
ids:
3939
- manager
@@ -50,7 +50,7 @@ dockers:
5050
- image_templates:
5151
- ghcr.io/doodlescheduling/{{ .ProjectName }}:v{{ .Version }}-arm64v8
5252
goarch: arm64
53-
dockerfile: Dockerfile.release
53+
dockerfile: Dockerfile
5454
use: buildx
5555
ids:
5656
- manager

CONTRIBUTING.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22

33
### Controller release
44
1. Merge all pr's to master which need to be part of the new release
5-
2. Create pr to master with these changes:
6-
1. Bump kustomization
7-
2. Create CHANGELOG.md entry with release and date
8-
3. Merge pr
9-
4. Push a tag following semantic versioning prefixed by 'v'. Do not create a github release, this is done automatically.
10-
5. Create new branch and add the following changes:
5+
2. Create pr to master and bump the kustomization base
6+
3. Push a tag following semantic versioning prefixed by 'v'. Do not create a github release, this is done automatically.
7+
4. Create a new pr and add the following changes:
118
1. Bump chart version
129
2. Bump charts app version
13-
6. Create pr to master and merge
1410

1511
### Helm chart change only
16-
1. Create branch with changes
17-
2. Bump chart version
18-
3. Create pr to master and merge
12+
1. Bump the helm chart version in the pr

Dockerfile

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,7 @@
1-
# Build the manager binary
2-
FROM golang:1.20 as builder
3-
4-
WORKDIR /workspace
5-
COPY . .
6-
7-
# cache deps before building and copying source so that we don't need to re-download as much
8-
# and so that source changes don't invalidate our downloaded layer
9-
RUN go mod download
10-
11-
# Build
12-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
13-
14-
# Use distroless as minimal base image to package the manager binary
15-
# Refer to https://github.com/GoogleContainerTools/distroless for more details
161
FROM gcr.io/distroless/static:nonroot
172
WORKDIR /
18-
COPY --from=builder /workspace/manager .
19-
USER nonroot:nonroot
3+
COPY manager manager
4+
USER 65532:65532
205

216
# User env is required by opentelemetry-go
227
ENV USER=k8soauth2-proxy-controller

Dockerfile.release

Lines changed: 0 additions & 11 deletions
This file was deleted.

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
# Image URL to use all building/pushing image targets
3-
IMG ?= controller:latest
3+
IMG ?= k8soauth2-proxy-controller:latest
44
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
55
ENVTEST_K8S_VERSION = 1.23
66

@@ -71,7 +71,7 @@ test: manifests generate fmt vet tidy envtest ## Run tests.
7171

7272
.PHONY: build
7373
build: generate fmt vet tidy ## Build manager binary.
74-
go build -o bin/manager main.go
74+
CGO_ENABLED=0 go build -o manager main.go
7575

7676
.PHONY: run
7777
run: manifests generate fmt vet tidy ## Run a controller from your host.
@@ -88,7 +88,7 @@ api-docs: gen-crd-api-reference-docs
8888
$(GEN_CRD_API_REFERENCE_DOCS) -api-dir=./api/v1beta1 -config=./hack/api-docs/config.json -template-dir=./hack/api-docs/template -out-file=./docs/api/v1beta1.md
8989

9090
.PHONY: docker-build
91-
docker-build:
91+
docker-build: build
9292
docker build -t ${IMG} .
9393

9494
.PHONY: docker-push

0 commit comments

Comments
 (0)