[ci/cd] add rules to execute build stage

This commit is contained in:
Maxime Alves LIRMM 2022-02-10 14:31:30 +00:00
parent a1c1bf04df
commit 209c6ef40a
1 changed files with 13 additions and 1 deletions

View File

@ -54,13 +54,25 @@ build_pypi:
artifacts: artifacts:
paths: paths:
- dist/*.whl - dist/*.whl
rules:
- if: '$CI_COMMIT_REF_NAME == "master" && $CI_COMMIT_TAG != ""'
variables:
TAG: $CI_COMMIT_TAG
build_container: build_container:
stage: build stage: build
image: $CI_REGISTRY/devtools/kaniko image: $CI_REGISTRY/devtools/kaniko
script: script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY/malves/halfapi:latest - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY/malves/halfapi:$TAG
artifacts: artifacts:
paths: paths:
- /kaniko/.docker/config.json - /kaniko/.docker/config.json
rules:
- if: '$CI_COMMIT_REF_NAME == "master" && $CI_COMMIT_TAG != ""'
variables:
TAG: $CI_COMMIT_TAG
- if: '$CI_COMMIT_REF_NAME == "devel"'
variables:
TAG: "latest"