Add needs definitions and nova build trigger to CI
This commit is contained in:
parent
b1fd0be345
commit
f3728024b0
@ -2,6 +2,7 @@ stages:
|
|||||||
- build
|
- build
|
||||||
- build docker
|
- build docker
|
||||||
- manifest
|
- manifest
|
||||||
|
- deploy
|
||||||
|
|
||||||
.build: &build
|
.build: &build
|
||||||
image: golang:1-alpine
|
image: golang:1-alpine
|
||||||
@ -76,6 +77,8 @@ build docker amd64:
|
|||||||
- amd64
|
- amd64
|
||||||
dependencies:
|
dependencies:
|
||||||
- build amd64
|
- build amd64
|
||||||
|
needs:
|
||||||
|
- build amd64
|
||||||
variables:
|
variables:
|
||||||
DOCKER_ARCH: amd64
|
DOCKER_ARCH: amd64
|
||||||
|
|
||||||
@ -85,17 +88,34 @@ build docker arm64:
|
|||||||
- arm64
|
- arm64
|
||||||
dependencies:
|
dependencies:
|
||||||
- build arm64
|
- build arm64
|
||||||
|
needs:
|
||||||
|
- build arm64
|
||||||
variables:
|
variables:
|
||||||
DOCKER_ARCH: arm64
|
DOCKER_ARCH: arm64
|
||||||
|
|
||||||
manifest:
|
manifest:
|
||||||
stage: manifest
|
stage: manifest
|
||||||
|
variables:
|
||||||
|
GIT_STRATEGY: none
|
||||||
before_script:
|
before_script:
|
||||||
- "mkdir -p $HOME/.docker && echo '{\"experimental\": \"enabled\"}' > $HOME/.docker/config.json"
|
- "mkdir -p $HOME/.docker && echo '{\"experimental\": \"enabled\"}' > $HOME/.docker/config.json"
|
||||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||||
|
needs:
|
||||||
|
- build docker amd64
|
||||||
|
- build docker arm64
|
||||||
script:
|
script:
|
||||||
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64
|
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64
|
||||||
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64
|
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64
|
||||||
- if [ "$CI_COMMIT_BRANCH" = "master" ]; then docker manifest create $CI_REGISTRY_IMAGE:latest $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64 $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64 && docker manifest push $CI_REGISTRY_IMAGE:latest; fi
|
- if [ "$CI_COMMIT_BRANCH" = "master" ]; then docker manifest create $CI_REGISTRY_IMAGE:latest $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64 $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64 && docker manifest push $CI_REGISTRY_IMAGE:latest; fi
|
||||||
- if [ "$CI_COMMIT_BRANCH" != "master" ]; then docker manifest create $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64 $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64 && docker manifest push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME; fi
|
- if [ "$CI_COMMIT_BRANCH" != "master" ]; then docker manifest create $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64 $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64 && docker manifest push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME; fi
|
||||||
- docker rmi $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64 $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64
|
- docker rmi $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64 $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64
|
||||||
|
|
||||||
|
trigger nova build:
|
||||||
|
image: curlimages/curl
|
||||||
|
stage: deploy
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
needs:
|
||||||
|
- build docker amd64
|
||||||
|
script:
|
||||||
|
- curl -X POST -F "token=$NOVA_CI_TRIGGER_TOKEN" -F "ref=tulir/ci" -F "variables[MAU_COMMIT_SHA]=$CI_COMMIT_SHA" -F "variables[MAU_BRIDGE]=whatsapp" https://gitlab.com/api/v4/projects/19691163/trigger/pipeline
|
||||||
|
Loading…
Reference in New Issue
Block a user