Newer
Older

Stefan Hynek
committed
---
workflow:
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_TAG
stages:
- test

Stefan Hynek
committed
- build
variables:
harbor_registry: "harbor.gwdg.de"
harbor_repo: "sub-fe"

Stefan Hynek
committed
lint dockerfile:
stage: test
image: hadolint/hadolint:latest-debian
before_script:
- mkdir -p reports
script:
- hadolint --format gitlab_codeclimate Dockerfile > reports/hadolint-$(md5sum Dockerfile | cut -d" " -f1).json
artifacts:
name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG"
when: always
reports:
codequality:
- "reports/*"
paths:
- "reports/*"
rules:
- if: $CI_MERGE_REQUEST_IID
changes:
- Dockerfile
release:
stage: release
image: docker.io/python:3.8-alpine
before_script:
- pip install --user --requirement requirements.ci.txt
script:
- semantic-release --verbosity=DEBUG publish

Stefan Hynek
committed
build container image:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- "[[ -n $CI_COMMIT_TAG ]] && export version=$CI_COMMIT_TAG || export version=$CI_COMMIT_SHORT_SHA"

Stefan Hynek
committed
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n ${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD} | base64 | tr -d '\n')\"},\"$harbor_registry\":{\"auth\":\"$HARBOR_ROBOT_TOKEN64\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor
--context $CI_PROJECT_DIR
--dockerfile $CI_PROJECT_DIR/Dockerfile
--build-arg build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
--build-arg vcs_ref=${version}
--build-arg version=${version}
--destination $CI_REGISTRY_IMAGE/repdav:$version
--destination $harbor_registry/$harbor_repo/repdav:$version

Stefan Hynek
committed
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH