--- stages: - build - package - acceptance - performance build: stage: build image: golang:1.19.2-bullseye script: - go install github.com/swaggo/swag/cmd/swag@v1.16.1 - swag init - go build -a -o target/bin/gilded-rose ./main.go artifacts: paths: - target/bin/gilded-rose test: stage: build image: golang:1.19.2-bullseye script: - go install github.com/swaggo/swag/cmd/swag@v1.16.1 - swag init - go test ./... -v -coverprofile=coverage.out -covermode count - go install github.com/boumenot/gocover-cobertura@v1.2.0 - $GOPATH/bin/gocover-cobertura < coverage.out > coverage.xml coverage: /^coverage:\s(\d+(?:\.\d+)?%)/ artifacts: name: $CI_JOB_NAME/coverage.txt paths: - coverage.xml expire_in: 2 days reports: coverage_report: coverage_format: cobertura path: coverage.xml dockerize: stage: package dependencies: [] image: name: gcr.io/kaniko-project/executor:v1.9.0-debug entrypoint: [""] script: - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_JOB_TOKEN\"}}}" > /kaniko/.docker/config.json - | /kaniko/executor \ --cache=true \ --cache-ttl=720h \ --cache-repo "$CI_REGISTRY_IMAGE/cache" \ --snapshotMode full \ --context "$CI_PROJECT_DIR" \ --dockerfile "$CI_PROJECT_DIR/Dockerfile" \ --destination "$CI_REGISTRY_IMAGE:${CI_COMMIT_SHORT_SHA}" \ --destination "$CI_REGISTRY_IMAGE:${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHORT_SHA}" \ --destination "$CI_REGISTRY_IMAGE:${CI_COMMIT_REF_SLUG}" helm-package: stage: package image: name: alpine/helm:3.9.2 entrypoint: [""] variables: CHART: "gilded-rose" ENVIRONMENT_DEPLOY_HOST: "$CI_COMMIT_REF_SLUG.$CI_PROJECT_NAME.k8sdev.example.int" before_script: - apk add git gettext - helm plugin install --version=v0.10.3 https://github.com/chartmuseum/helm-push.git - > helm repo add ${CHART} --username ${CI_REGISTRY_USER} --password ${CI_JOB_TOKEN} ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/stable script: - cd k8s/charts - cat ${CHART}/Chart.yaml | sed 's/\\\$/{_DOLLAR_}/g' | envsubst | sed 's/{_DOLLAR_}/$/g' > ${CHART}/Chart.prod.yaml && mv ${CHART}/Chart.prod.yaml ${CHART}/Chart.yaml - cat ${CHART}/values.yaml | sed 's/\\\$/{_DOLLAR_}/g' | envsubst | sed 's/{_DOLLAR_}/$/g' > ${CHART}/values.prod.yaml && mv ${CHART}/values.prod.yaml ${CHART}/values.yaml - helm cm-push ${CHART}/ ${CHART}