Skip to content

Commit

Permalink
build: fix mising commit sha and add proper ref
Browse files Browse the repository at this point in the history
  • Loading branch information
clementnuss committed Nov 24, 2021
1 parent 0346f22 commit bb76361
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ jobs:
uses: docker/login-action@v1
with:
username: postfinance
password: ${{ secrets.DOCKER_TOKEN }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: imjasonh/[email protected]
name: Setup ko
env:
KO_DOCKER_REPO: docker.io/postfinance
- name: Run ko publish
run: |
export TAG=$(echo ${{ github.ref }} | cut -d "/" -f 3 - )
export COMMIT=$(git describe --abbrev=7 --always --long --match "v*" main)
export REF=${{ github.ref}}
export COMMIT=${{ github.sha}}
ko publish ./cmd/kubelet-csr-approver/ --base-import-paths --platform=linux/amd64,linux/arm64,linux/arm --tags $TAG
publish-untagged:
Expand All @@ -92,14 +92,15 @@ jobs:
uses: docker/login-action@v1
with:
username: postfinance
password: ${{ secrets.DOCKER_TOKEN }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: imjasonh/[email protected]
name: Setup ko
env:
KO_DOCKER_REPO: docker.io/postfinance
- name: Run ko publish
run: |
export COMMIT=$(git describe --abbrev=7 --always --long --match "v*" main)
export REF=${{ github.ref}}
export COMMIT=${{ github.sha}}
ko publish ./cmd/kubelet-csr-approver/ --base-import-paths --platform=linux/amd64,linux/arm64,linux/arm
3 changes: 2 additions & 1 deletion .ko.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ builds:
env:
- CGO_ENABLED=0
ldflags:
- -X main.commit={{.Env.COMMIT}}
- -X main.commit={{.Env.COMMIT}}
- -X main.ref={{.Env.REF}}
3 changes: 2 additions & 1 deletion cmd/kubelet-csr-approver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const ProviderRegexEnvvarName string = "PROVIDER_REGEX"
//nolint:gochecknoglobals //this vars are set on build by goreleaser
var (
commit = "12345678"
ref = "refs/refname"
)

func main() {
Expand All @@ -48,7 +49,7 @@ func main() {
flashLogger.SetLevel(zapcore.Level(logLevel))
z := zapr.NewLogger(flashLogger.Desugar())

z.V(0).Info("Kubelet-CSR-Approver controller starting.", "tag+commit", commit)
z.V(0).Info("Kubelet-CSR-Approver controller starting.", "commit", commit, "ref", ref)

var regexEnvVar string
if regexEnvVar = os.Getenv(ProviderRegexEnvvarName); regexEnvVar == "" {
Expand Down

0 comments on commit bb76361

Please sign in to comment.