Configure Dependency Scanning in .gitlab-ci.yml, creating this file if it does not already exist

This commit is contained in:
Oscar Krause 2023-02-14 15:30:15 +01:00
parent e1bbd42b50
commit cb5dc6a70d

View File

@ -1,299 +1,264 @@
# You can override the included template(s) by including variable overrides
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings
# Container Scanning customization: https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings
# Note that environment variables can be set in several places
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
cache: cache:
key: one-key-to-rule-them-all key: one-key-to-rule-them-all
build:docker: build:docker:
image: docker:dind image: docker:dind
interruptible: true interruptible: true
stage: build stage: build
rules: rules:
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH - if: "$CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH"
changes: changes:
- app/**/* - app/**/*
- Dockerfile - Dockerfile
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: "$CI_PIPELINE_SOURCE == 'merge_request_event'"
tags: [ docker ] tags:
- docker
before_script: before_script:
- echo "COMMIT=${CI_COMMIT_SHA}" >> version.env # COMMIT=`git rev-parse HEAD` - echo "COMMIT=${CI_COMMIT_SHA}" >> version.env
script: script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build . --tag ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_BUILD_REF_NAME}:${CI_BUILD_REF} - docker build . --tag ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_BUILD_REF_NAME}:${CI_BUILD_REF}
- docker push ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_BUILD_REF_NAME}:${CI_BUILD_REF} - docker push ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_BUILD_REF_NAME}:${CI_BUILD_REF}
build:apt: build:apt:
image: debian:bookworm-slim image: debian:bookworm-slim
interruptible: true interruptible: true
stage: build stage: build
rules: rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH - if: "$CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH"
changes: changes:
- app/**/* - app/**/*
- .DEBIAN/**/* - ".DEBIAN/**/*"
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: "$CI_PIPELINE_SOURCE == 'merge_request_event'"
before_script: before_script:
- echo "COMMIT=${CI_COMMIT_SHA}" >> version.env - echo "COMMIT=${CI_COMMIT_SHA}" >> version.env
- source version.env - source version.env
# install build dependencies - apt-get update -qq && apt-get install -qq -y build-essential
- apt-get update -qq && apt-get install -qq -y build-essential - mkdir build
# create build directory for .deb sources - cp -r .DEBIAN build/DEBIAN
- mkdir build - chmod -R 0775 build/DEBIAN
# copy install instructions - mkdir -p build/usr/share/fastapi-dls
- cp -r .DEBIAN build/DEBIAN - cp -r app build/usr/share/fastapi-dls
- chmod -R 0775 build/DEBIAN - cp README.md version.env build/usr/share/fastapi-dls
# copy app into "/usr/share/fastapi-dls" as "/usr/share/fastapi-dls/app" & copy README.md and version.env - mkdir -p build/etc/fastapi-dls
- mkdir -p build/usr/share/fastapi-dls - cp .DEBIAN/env.default build/etc/fastapi-dls/env
- cp -r app build/usr/share/fastapi-dls - mkdir -p build/etc/systemd/system
- cp README.md version.env build/usr/share/fastapi-dls - cp .DEBIAN/fastapi-dls.service build/etc/systemd/system/fastapi-dls.service
# create conf file - cd build/
- mkdir -p build/etc/fastapi-dls
- cp .DEBIAN/env.default build/etc/fastapi-dls/env
# create service file
- mkdir -p build/etc/systemd/system
- cp .DEBIAN/fastapi-dls.service build/etc/systemd/system/fastapi-dls.service
# cd into "build/"
- cd build/
script: script:
# set version based on value in "$VERSION" (which is set above from version.env) - sed -i -E 's/(Version\:\s)0.0/\1'"$VERSION"'/g' DEBIAN/control
- sed -i -E 's/(Version\:\s)0.0/\1'"$VERSION"'/g' DEBIAN/control - dpkg -b . build.deb
# build - dpkg -I build.deb
- dpkg -b . build.deb
- dpkg -I build.deb
artifacts: artifacts:
expire_in: 1 week expire_in: 1 week
paths: paths:
- build/build.deb - build/build.deb
build:pacman: build:pacman:
image: archlinux:base-devel image: archlinux:base-devel
interruptible: true interruptible: true
stage: build stage: build
rules: rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH - if: "$CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH"
changes: changes:
- app/**/* - app/**/*
- .PKGBUILD/**/* - ".PKGBUILD/**/*"
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: "$CI_PIPELINE_SOURCE == 'merge_request_event'"
before_script: before_script:
- echo "COMMIT=${CI_COMMIT_SHA}" >> version.env - echo "COMMIT=${CI_COMMIT_SHA}" >> version.env
# install build dependencies - pacman -Syu --noconfirm git
- pacman -Syu --noconfirm git - useradd --no-create-home --shell=/bin/false build && usermod -L build
# create a build-user because "makepkg" don't like root user - 'echo "build ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers'
- useradd --no-create-home --shell=/bin/false build && usermod -L build - 'echo "root ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers'
- 'echo "build ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers' - chown -R build:build .
- 'echo "root ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers' - mv .PKGBUILD/* .
- chown -R build:build .
# move .PKGBUILD contents to root directory
- mv .PKGBUILD/* .
script: script:
- pwd - pwd
# download dependencies - source PKGBUILD && pacman -Syu --noconfirm --needed --asdeps "${makedepends[@]}"
- source PKGBUILD && pacman -Syu --noconfirm --needed --asdeps "${makedepends[@]}" "${depends[@]}" "${depends[@]}"
# build - sudo -u build makepkg -s
- sudo -u build makepkg -s
artifacts: artifacts:
expire_in: 1 week expire_in: 1 week
paths: paths:
- "*.pkg.tar.zst" - "*.pkg.tar.zst"
test: test:
image: python:3.11-slim-bullseye image: python:3.11-slim-bullseye
stage: test stage: test
rules: rules:
- if: $CI_COMMIT_BRANCH - if: "$CI_COMMIT_BRANCH"
- if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_PIPELINE_SOURCE == "merge_request_event"
variables: variables:
DATABASE: sqlite:///../app/db.sqlite DATABASE: sqlite:///../app/db.sqlite
before_script: before_script:
- pip install -r requirements.txt - pip install -r requirements.txt
- pip install pytest httpx - pip install pytest httpx
- mkdir -p app/cert - mkdir -p app/cert
- openssl genrsa -out app/cert/instance.private.pem 2048 - openssl genrsa -out app/cert/instance.private.pem 2048
- openssl rsa -in app/cert/instance.private.pem -outform PEM -pubout -out app/cert/instance.public.pem - openssl rsa -in app/cert/instance.private.pem -outform PEM -pubout -out app/cert/instance.public.pem
- cd test - cd test
script: script:
- pytest main.py - pytest main.py
artifacts: artifacts:
reports: reports:
dotenv: version.env dotenv: version.env
".test:linux":
.test:linux:
stage: test stage: test
rules: rules:
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH - if: "$CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH"
changes: changes:
- app/**/* - app/**/*
- .DEBIAN/**/* - ".DEBIAN/**/*"
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: "$CI_PIPELINE_SOURCE == 'merge_request_event'"
needs: needs:
- job: build:apt - job: build:apt
artifacts: true artifacts: true
variables: variables:
DEBIAN_FRONTEND: noninteractive DEBIAN_FRONTEND: noninteractive
before_script: before_script:
- apt-get update -qq && apt-get install -qq -y jq curl - apt-get update -qq && apt-get install -qq -y jq curl
script: script:
# test installation - apt-get install -q -y ./build/build.deb --fix-missing
- apt-get install -q -y ./build/build.deb --fix-missing - openssl req -x509 -newkey rsa:2048 -nodes -out /etc/fastapi-dls/webserver.crt
- openssl req -x509 -newkey rsa:2048 -nodes -out /etc/fastapi-dls/webserver.crt -keyout /etc/fastapi-dls/webserver.key -days 7 -subj "/C=DE/O=GitLab-CI/OU=Test/CN=localhost" -keyout /etc/fastapi-dls/webserver.key -days 7 -subj "/C=DE/O=GitLab-CI/OU=Test/CN=localhost"
# copy example config from GitLab-CI-Variables - cd /usr/share/fastapi-dls/app
#- cat ${EXAMPLE_CONFIG} > /etc/fastapi-dls/env - uvicorn main:app --host 127.0.0.1 --port 443 --app-dir /usr/share/fastapi-dls/app
# start service in background --ssl-keyfile /etc/fastapi-dls/webserver.key --ssl-certfile /etc/fastapi-dls/webserver.crt
- cd /usr/share/fastapi-dls/app --proxy-headers &
- uvicorn main:app - FASTAPI_DLS_PID=$!
--host 127.0.0.1 --port 443 - echo "Started service with pid $FASTAPI_DLS_PID"
--app-dir /usr/share/fastapi-dls/app - cat /etc/fastapi-dls/env
--ssl-keyfile /etc/fastapi-dls/webserver.key - if [ "`curl --insecure -s https://127.0.0.1/-/health | jq .status`" != "up" ];
--ssl-certfile /etc/fastapi-dls/webserver.crt then echo "Success"; else "Error"; fi
--proxy-headers & - kill $FASTAPI_DLS_PID
- FASTAPI_DLS_PID=$! - apt-get purge -qq -y fastapi-dls
- echo "Started service with pid $FASTAPI_DLS_PID" - apt-get autoremove -qq -y && apt-get clean -qq
- cat /etc/fastapi-dls/env
# testing service
- if [ "`curl --insecure -s https://127.0.0.1/-/health | jq .status`" != "up" ]; then echo "Success"; else "Error"; fi
# cleanup
- kill $FASTAPI_DLS_PID
- apt-get purge -qq -y fastapi-dls
- apt-get autoremove -qq -y && apt-get clean -qq
test:debian: test:debian:
extends: .test:linux extends: ".test:linux"
image: debian:bookworm-slim image: debian:bookworm-slim
test:ubuntu: test:ubuntu:
extends: .test:linux extends: ".test:linux"
image: ubuntu:22.10 image: ubuntu:22.10
test:archlinux: test:archlinux:
image: archlinux:base image: archlinux:base
rules: rules:
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH - if: "$CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH"
changes: changes:
- app/**/* - app/**/*
- .PKGBUILD/**/* - ".PKGBUILD/**/*"
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: "$CI_PIPELINE_SOURCE == 'merge_request_event'"
needs: needs:
- job: build:pacman - job: build:pacman
artifacts: true artifacts: true
script: script:
- pacman -Sy - pacman -Sy
- pacman -U --noconfirm *.pkg.tar.zst - pacman -U --noconfirm *.pkg.tar.zst
".deploy":
.deploy:
rules: rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
- if: $CI_COMMIT_TAG - if: "$CI_COMMIT_TAG"
when: never when: never
deploy:docker: deploy:docker:
extends: .deploy extends: ".deploy"
stage: deploy stage: deploy
rules: rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
before_script: before_script:
- echo "COMMIT=${CI_COMMIT_SHA}" >> version.env - echo "COMMIT=${CI_COMMIT_SHA}" >> version.env
- source version.env - source version.env
- echo "Building docker image for commit ${COMMIT} with version ${VERSION}" - echo "Building docker image for commit ${COMMIT} with version ${VERSION}"
script: script:
- echo "GitLab-Registry" - echo "GitLab-Registry"
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build . --tag ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_BUILD_REF_NAME}:${VERSION} - docker build . --tag ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_BUILD_REF_NAME}:${VERSION}
- docker build . --tag ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_BUILD_REF_NAME}:latest - docker build . --tag ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_BUILD_REF_NAME}:latest
- docker push ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_BUILD_REF_NAME}:${VERSION} - docker push ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_BUILD_REF_NAME}:${VERSION}
- docker push ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_BUILD_REF_NAME}:latest - docker push ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_BUILD_REF_NAME}:latest
- echo "Docker-Hub" - echo "Docker-Hub"
- docker login -u $PUBLIC_REGISTRY_USER -p $PUBLIC_REGISTRY_TOKEN - docker login -u $PUBLIC_REGISTRY_USER -p $PUBLIC_REGISTRY_TOKEN
- docker build . --tag $PUBLIC_REGISTRY_USER/${CI_PROJECT_NAME}:${VERSION} - docker build . --tag $PUBLIC_REGISTRY_USER/${CI_PROJECT_NAME}:${VERSION}
- docker build . --tag $PUBLIC_REGISTRY_USER/${CI_PROJECT_NAME}:latest - docker build . --tag $PUBLIC_REGISTRY_USER/${CI_PROJECT_NAME}:latest
- docker push $PUBLIC_REGISTRY_USER/${CI_PROJECT_NAME}:${VERSION} - docker push $PUBLIC_REGISTRY_USER/${CI_PROJECT_NAME}:${VERSION}
- docker push $PUBLIC_REGISTRY_USER/${CI_PROJECT_NAME}:latest - docker push $PUBLIC_REGISTRY_USER/${CI_PROJECT_NAME}:latest
deploy:apt: deploy:apt:
# doc: https://git.collinwebdesigns.de/help/user/packages/debian_repository/index.md#install-a-package extends: ".deploy"
extends: .deploy
image: debian:bookworm-slim image: debian:bookworm-slim
stage: deploy stage: deploy
rules: rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
needs: needs:
- job: build:apt - job: build:apt
artifacts: true artifacts: true
before_script: before_script:
- apt-get update -qq && apt-get install -qq -y curl lsb-release - apt-get update -qq && apt-get install -qq -y curl lsb-release
# create distribution initial - CODENAME=`lsb_release -cs`
- CODENAME=`lsb_release -cs` - 'if [ "`curl -s -o /dev/null -w "%{http_code}" --header "JOB-TOKEN: $CI_JOB_TOKEN"
# create repo if not exists -s ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/debian_distributions/${CODENAME}/key.asc`"
- 'if [ "`curl -s -o /dev/null -w "%{http_code}" --header "JOB-TOKEN: $CI_JOB_TOKEN" -s ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/debian_distributions/${CODENAME}/key.asc`" != "200" ]; then curl --request POST --header "JOB-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/debian_distributions?codename=${CODENAME}"; fi' != "200" ]; then curl --request POST --header "JOB-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/debian_distributions?codename=${CODENAME}";
fi'
script: script:
# Naming format: <name>_<version>-<release>_<arch>.deb - BUILD_NAME=build/build.deb
# Version is the version number of the app being packaged - PACKAGE_NAME=`dpkg -I ${BUILD_NAME} | grep "Package:" | awk '{ print $2 }'`
# Release number is the version number of the *packaging* itself. - PACKAGE_VERSION=`dpkg -I ${BUILD_NAME} | grep "Version:" | awk '{ print $2 }'`
# The release number might increment if the package maintainer - PACKAGE_ARCH=amd64
# updated the packaging, while the version number of the application - EXPORT_NAME="${PACKAGE_NAME}_${PACKAGE_VERSION}_${PACKAGE_ARCH}.deb"
# being packaged did not change. - mv ${BUILD_NAME} ${EXPORT_NAME}
- BUILD_NAME=build/build.deb # inherited by build-stage - 'echo "PACKAGE_NAME: ${PACKAGE_NAME}"'
- PACKAGE_NAME=`dpkg -I ${BUILD_NAME} | grep "Package:" | awk '{ print $2 }'` - 'echo "PACKAGE_VERSION: ${PACKAGE_VERSION}"'
- PACKAGE_VERSION=`dpkg -I ${BUILD_NAME} | grep "Version:" | awk '{ print $2 }'` - 'echo "PACKAGE_ARCH: ${PACKAGE_ARCH}"'
- PACKAGE_ARCH=amd64 - 'echo "EXPORT_NAME: ${EXPORT_NAME}"'
#- EXPORT_NAME="${PACKAGE_NAME}_${PACKAGE_VERSION}-0_${PACKAGE_ARCH}.deb" - URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/debian/${EXPORT_NAME}"
- EXPORT_NAME="${PACKAGE_NAME}_${PACKAGE_VERSION}_${PACKAGE_ARCH}.deb" - 'echo "URL: ${URL}"'
- mv ${BUILD_NAME} ${EXPORT_NAME} - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${EXPORT_NAME} "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGE_NAME}/${PACKAGE_VERSION}/${EXPORT_NAME}"'
- 'echo "PACKAGE_NAME: ${PACKAGE_NAME}"'
- 'echo "PACKAGE_VERSION: ${PACKAGE_VERSION}"'
- 'echo "PACKAGE_ARCH: ${PACKAGE_ARCH}"'
- 'echo "EXPORT_NAME: ${EXPORT_NAME}"'
# https://docs.gitlab.com/14.3/ee/user/packages/debian_repository/index.html
- URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/debian/${EXPORT_NAME}"
- 'echo "URL: ${URL}"'
#- 'curl --request PUT --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${EXPORT_NAME} ${URL}'
# using generic-package-registry until debian-registry is GA
# https://docs.gitlab.com/ee/user/packages/generic_packages/index.html#publish-a-generic-package-by-using-cicd
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${EXPORT_NAME} "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGE_NAME}/${PACKAGE_VERSION}/${EXPORT_NAME}"'
deploy:pacman: deploy:pacman:
extends: .deploy extends: ".deploy"
image: archlinux:base-devel image: archlinux:base-devel
stage: deploy stage: deploy
rules: rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
needs: needs:
- job: build:pacman - job: build:pacman
artifacts: true artifacts: true
script: script:
- source .PKGBUILD/PKGBUILD - source .PKGBUILD/PKGBUILD
- source version.env - source version.env
# fastapi-dls-1.0-1-any.pkg.tar.zst - BUILD_NAME=${pkgname}-${VERSION}-${pkgrel}-any.pkg.tar.zst
- BUILD_NAME=${pkgname}-${VERSION}-${pkgrel}-any.pkg.tar.zst - PACKAGE_NAME=${pkgname}
- PACKAGE_NAME=${pkgname} - PACKAGE_VERSION=${VERSION}
- PACKAGE_VERSION=${VERSION} - PACKAGE_ARCH=any
- PACKAGE_ARCH=any - EXPORT_NAME=${BUILD_NAME}
- EXPORT_NAME=${BUILD_NAME} - 'echo "PACKAGE_NAME: ${PACKAGE_NAME}"'
- 'echo "PACKAGE_NAME: ${PACKAGE_NAME}"' - 'echo "PACKAGE_VERSION: ${PACKAGE_VERSION}"'
- 'echo "PACKAGE_VERSION: ${PACKAGE_VERSION}"' - 'echo "PACKAGE_ARCH: ${PACKAGE_ARCH}"'
- 'echo "PACKAGE_ARCH: ${PACKAGE_ARCH}"' - 'echo "EXPORT_NAME: ${EXPORT_NAME}"'
- 'echo "EXPORT_NAME: ${EXPORT_NAME}"' - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${EXPORT_NAME} "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGE_NAME}/${PACKAGE_VERSION}/${EXPORT_NAME}"'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${EXPORT_NAME} "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGE_NAME}/${PACKAGE_VERSION}/${EXPORT_NAME}"'
release: release:
image: registry.gitlab.com/gitlab-org/release-cli:latest image: registry.gitlab.com/gitlab-org/release-cli:latest
stage: .post stage: ".post"
needs: needs:
- job: test - job: test
artifacts: true artifacts: true
rules: rules:
- if: $CI_COMMIT_TAG - if: "$CI_COMMIT_TAG"
when: never when: never
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
script: script:
- echo "Running release-job for $VERSION" - echo "Running release-job for $VERSION"
release: release:
name: $CI_PROJECT_TITLE $VERSION name: "$CI_PROJECT_TITLE $VERSION"
description: Release of $CI_PROJECT_TITLE version $VERSION description: Release of $CI_PROJECT_TITLE version $VERSION
tag_name: $VERSION tag_name: "$VERSION"
ref: $CI_COMMIT_SHA ref: "$CI_COMMIT_SHA"
assets: assets:
links: links:
- name: 'Package Registry' - name: Package Registry
url: 'https://git.collinwebdesigns.de/oscar.krause/fastapi-dls/-/packages' url: https://git.collinwebdesigns.de/oscar.krause/fastapi-dls/-/packages
- name: 'Container Registry' - name: Container Registry
url: 'https://git.collinwebdesigns.de/oscar.krause/fastapi-dls/container_registry/40' url: https://git.collinwebdesigns.de/oscar.krause/fastapi-dls/container_registry/40
include:
- template: Auto-DevOps.gitlab-ci.yml