stages: - test - publish - chart - integration_test variables: DOCKER_TLS_CERTDIR: "" SERVICE_NAME: "vs-harvester" test: image: python:3.8-slim stage: test script: - python3 setup.py install - pip3 install -r requirements.txt - pip3 install -r requirements-test.txt - pip3 install -r requirements-dev.txt - flake8 - mypy . - pytest --cov harvester --cov-report term-missing coverage: "/TOTAL.+ ([0-9]{1,3}%)/" publish_latest: image: docker:20.10.8 services: - docker:20.10.8-dind stage: publish script: - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" - docker build -t $CI_REGISTRY_IMAGE . - docker push $CI_REGISTRY_IMAGE:latest only: - main publish: image: docker:20.10.8 services: - docker:20.10.8-dind stage: publish script: - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" - docker build --cache-from $CI_REGISTRY_IMAGE:latest -t $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG . - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG only: - tags helm: image: devth/helm:v3.6.3 stage: chart script: # push Helm chart - "upload_filename=$(helm package ./chart | sed 's/^Successfully packaged chart and saved it to: \\(.*\\)/\\1/')" - curl -u $HELM_CHART_REPOSITORY_CREDENTIALS -v -X POST https://charts-public.hub.eox.at/api/charts --data-binary "@${upload_filename}" only: - tags integration_test: image: devth/helm:v3.6.3 stage: integration_test script: - wget -q https://github.com/mikefarah/yq/releases/download/v4.14.2/yq_linux_amd64.tar.gz -O - | tar xvfz - && chmod +x yq_linux_amd64 - export CHART_VERSION=$(./yq_linux_amd64 eval .version chart/Chart.yaml) - export BRANCH_NAME="auto-update-${SERVICE_NAME}-${CHART_VERSION}" - git config --global user.email "gitlab@eox.at" - git config --global user.name "gitlab" - git clone https://${VS_DEPLOYMENT_GIT_REPOSITORY_CREDENTIALS}@gitlab.eox.at/vs/vs-deployment.git - cd vs-deployment - git switch -c "${BRANCH_NAME}" # bump version in Chart.yaml - ../yq_linux_amd64 eval "( .dependencies[] | select(.name == \"${SERVICE_NAME}\") | .version ) = \"${CHART_VERSION}\"" --inplace Chart.yaml - helm dependency update - git add charts/* - git commit --all -m "Bump ${SERVICE_NAME} to ${CHART_VERSION}" - git push --set-upstream origin "${BRANCH_NAME}" only: - tags