Sharkey/.gitlab-ci.yml

77 lines
1.7 KiB
YAML
Raw Permalink Normal View History

2024-02-01 02:09:57 -08:00
stages:
- deploy
getImageTag:
stage: deploy
image: ubuntu:latest
script:
- apt-get update && apt-get install -y jq
- |
if test -n "$CI_COMMIT_TAG"; then
tag="$CI_COMMIT_TAG"
elif test "$CI_COMMIT_BRANCH" == "stable"; then
tag="latest"
elif test "$CI_COMMIT_BRANCH" == "docker-debug"; then
tag="docker-debug"
2024-02-01 02:09:57 -08:00
else
tag="$CI_COMMIT_BRANCH"
fi
version=$(cat package.json | jq -r '.version')
- echo "REGISTRY_PUSH_TAG=$tag" >> build.env
- echo "REGISTRY_PUSH_VERSION=$version" >> build.env
artifacts:
reports:
dotenv: build.env
only:
- stable
- develop
- docker-debug
2024-02-01 02:09:57 -08:00
buildDocker:
stage: deploy
2024-02-01 07:45:42 -08:00
needs:
- job: getImageTag
artifacts: true
2024-02-01 02:09:57 -08:00
parallel:
matrix:
- ARCH: amd64
- ARCH: arm64
tags:
- ${ARCH}
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- >-
/kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
2024-02-01 07:59:14 -08:00
--destination "${CI_REGISTRY_IMAGE}:${REGISTRY_PUSH_VERSION}-${ARCH}"
2024-02-01 02:09:57 -08:00
only:
- stable
- docker-debug
2024-02-01 02:09:57 -08:00
mergeManifests:
stage: deploy
needs:
- job: buildDocker
artifacts: false
- job: getImageTag
artifacts: true
tags:
- docker
image:
name: mplatform/manifest-tool:alpine
entrypoint: [""]
script:
- >-
manifest-tool
--username=${CI_REGISTRY_USER}
--password=${CI_REGISTRY_PASSWORD}
push from-args
--platforms linux/amd64,linux/arm64
--tags ${REGISTRY_PUSH_VERSION}
2024-02-01 07:59:14 -08:00
--template ${CI_REGISTRY_IMAGE}:${REGISTRY_PUSH_VERSION}-ARCH
2024-02-01 02:09:57 -08:00
--target ${CI_REGISTRY_IMAGE}:${REGISTRY_PUSH_TAG}
only:
- stable
- docker-debug