Skip to content

Commit

Permalink
chore: update ci images and misc
Browse files Browse the repository at this point in the history
- update go image
- update cosign version
- try fix APP_BUILD_DATE value
- use alpine pkgs for ko and cosign
  • Loading branch information
BobyMCbobs committed Dec 18, 2023
1 parent 22225f8 commit 6e79d7a
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,17 @@ include:
template: Dependency-Scanning.gitlab-ci.yml

variables:
REGISTRIES: "$CI_REGISTRY"
ARCH_DEFAULT: "amd64"
ARCHES: amd64 arm64
APP_BUILD_VERSION: 0.0.0
APP_BUILD_MODE: development
IMAGE_KO: ghcr.io/ko-build/ko:v0.14.1
IMAGE_GOLANG_ALPINE: docker.io/golang:1.20.5-alpine3.18
IMAGE_GOLANG_ALPINE: docker.io/golang:1.21.5-alpine3.18@sha256:9390a996e9f957842f07dff1e9661776702575dd888084e72d86eaa382ad56e3
IMAGE_PYTHON: python:3.8-buster
IMAGE_GOLANGCI_LINT: docker.io/golangci/golangci-lint:v1.53.3
VERSION_COSIGN: v2.0.2
IMAGE_GOLANGCI_LINT: docker.io/golangci/golangci-lint:v1.53.3@sha256:1e0e2867b387bf68762427db499a963e43582b06819992db205fc31daa75ceea
COSIGN_YES: "true"

.image-set-build-env: &image-set-build-env |
echo "Commit made on '${CI_COMMIT_TIMESTAMP}'"
export APP_BUILD_HASH="$CI_COMMIT_SHORT_SHA"
export APP_BUILD_DATE=$(date --date="${CI_COMMIT_TIMESTAMP//[T+]/ }" '+%Y.%m.%d.%H%M')
export APP_BUILD_DATE=$(git show -s --format=%cd --date=format:'%Y.%m.%d.%H%M')
export APP_BUILD_VERSION=0.0.0
export APP_BUILD_MODE=development
export IMAGE_DESTINATIONS="latest"
Expand All @@ -34,9 +29,8 @@ variables:
export IMAGE_DESTINATIONS="$APP_BUILD_VERSION"
fi

.setup-cosign: &setup-cosign |
curl -L https://github.com/sigstore/cosign/releases/download/$VERSION_COSIGN/cosign-linux-amd64 -o /usr/local/bin/cosign
chmod +x /usr/local/bin/cosign
.setup-testing-repo: &setup-testing-repo |
echo 'https://dl-cdn.alpinelinux.org/alpine/edge/testing' | tee -a /etc/apk/repositories

build-backend-smoketest:
stage: build
Expand All @@ -47,7 +41,7 @@ build-backend-smoketest:
build-container:
stage: build
image:
name: $IMAGE_KO
name: $IMAGE_GOLANG_ALPINE
entrypoint: [""]
retry: 2
id_tokens:
Expand All @@ -57,9 +51,10 @@ build-container:
KO_DOCKER_REPO: "$CI_REGISTRY_IMAGE"
before_script:
- set -x
- *setup-testing-repo
- apk add --no-cache curl cosign ko
- export KO_DOCKER_REPO="$(echo ${KO_DOCKER_REPO} | tr '[:upper:]' '[:lower:]')"
- ko login "${CI_REGISTRY}" -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}"
- *setup-cosign
- *image-set-build-env
script:
- |
Expand All @@ -74,7 +69,7 @@ build-container:
spell_check:
stage: lint
image:
name: $IMAGE_KO
name: $IMAGE_GOLANG_ALPINE
entrypoint: [""]
allow_failure: true
before_script:
Expand All @@ -85,7 +80,7 @@ spell_check:
lint_backend:
stage: lint
image:
name: $IMAGE_KO
name: $IMAGE_GOLANG_ALPINE
entrypoint: [""]
allow_failure: true
before_script:
Expand Down

0 comments on commit 6e79d7a

Please sign in to comment.