cic-internal-integration/ci_templates/.cic-template.yml

62 lines
2.9 KiB
YAML
Raw Normal View History

2021-03-10 04:48:17 +01:00
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
variables:
2021-05-02 19:31:34 +02:00
KANIKO_CACHE_ARGS: "--cache=false --cache-copy-layers=true --cache-ttl=24h"
2021-03-10 04:48:17 +01:00
CONTEXT: $CI_PROJECT_DIR/apps/
.py_build_merge_request:
stage: build
variables:
2021-05-25 18:22:26 +02:00
CI_DEBUG_TRACE: "true"
script:
2021-03-10 04:48:17 +01:00
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > "/kaniko/.docker/config.json"
- /kaniko/executor --context $CONTEXT --dockerfile $DOCKERFILE_PATH $KANIKO_CACHE_ARGS --cache-repo $CI_REGISTRY_IMAGE --no-push
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
2021-05-25 18:22:26 +02:00
.py_build_target_test:
stage: build
variables:
CI_DEBUG_TRACE: "true"
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > "/kaniko/.docker/config.json"
- /kaniko/executor --context $CONTEXT --dockerfile $DOCKERFILE_PATH $KANIKO_CACHE_ARGS --cache-repo $CI_REGISTRY_IMAGE --target test --tarPath $APP_NAME-test-image.tar --destination $CI_REGISTRY_IMAGE/$APP_NAME-test:latest
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
.py_build_push:
2021-03-10 04:48:17 +01:00
stage: build
variables:
IMAGE_TAG_BASE: $CI_REGISTRY_IMAGE/$APP_NAME:$CI_COMMIT_BRANCH-$CI_COMMIT_SHORT_SHA
LATEST_TAG: $CI_REGISTRY_IMAGE/$APP_NAME:latest
script:
2021-04-19 19:56:19 +02:00
- export IMAGE_TAG="$IMAGE_TAG_BASE-$(date +%s)"
2021-03-10 04:48:17 +01:00
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > "/kaniko/.docker/config.json"
2021-03-15 15:21:39 +01:00
# - /kaniko/executor --context $CONTEXT --dockerfile $DOCKERFILE_PATH $KANIKO_CACHE_ARGS --destination $IMAGE_TAG
2021-03-15 15:31:48 +01:00
- /kaniko/executor --context $CONTEXT --dockerfile $DOCKERFILE_PATH $KANIKO_CACHE_ARGS --destination $IMAGE_TAG --destination $CI_REGISTRY_IMAGE/$APP_NAME:latest
2021-03-10 04:48:17 +01:00
rules:
- if: $CI_COMMIT_BRANCH == "master"
when: always
2021-01-24 21:16:22 +01:00
.publish_python:
image: registry.gitlab.com/grassrootseconomics/cic-base-images:python-3.8.6-dev
stage: publish
variables:
#CI_DEBUG_TRACE: "true"
CIC_PACKAGE_REGISTRY_PROJECT_ID: 27624814
script:
- python -m pip wheel --extra-index-url https://pip.grassrootseconomics.net:8433 --wheel-dir=/tmp/wheelhouse -r requirements.txt
- python -m pip install --no-index --find-links=/tmp/wheelhouse -r requirements.txt
- python setup.py sdist bdist_wheel
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CIC_PACKAGE_REGISTRY_PROJECT_ID}/packages/pypi dist/*
# Below are the built dependencies
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CIC_PACKAGE_REGISTRY_PROJECT_ID}/packages/pypi /tmp/wheelhouse/*