Skip to content
Snippets Groups Projects
Verified Commit 55820333 authored by Stefan Hynek's avatar Stefan Hynek :drooling_face:
Browse files

ci(gitlab): add job that generates pipfiles for better dependency detection

parent 25f31acb
No related branches found
No related tags found
1 merge request!26Resolve "repair sbom generation and upload"
Pipeline #343199 passed
......@@ -56,10 +56,9 @@ build container image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
# always succeed and don't print error message
- tag=$(git tag --contains $CI_COMMIT_SHORT_SHA 2>&1) || true
# use tag for version if not empty; else commit sha
- "[[ -n $tag ]] && export version=$tag || export version=$CI_COMMIT_SHORT_SHA"
- "[[ -n ${CI_COMMIT_TAG} ]] && export version=${CI_COMMIT_TAG} || export version=${CI_COMMIT_SHORT_SHA}"
- echo $version
- 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
......@@ -78,20 +77,33 @@ build container image:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_TAG
generate pipfile:
stage: build
image: docker.io/python:3.8-alpine
before_script:
- pip install pipenv
script:
- pipenv lock
artifacts:
paths:
- Pipfile*
needs: []
rules:
- if: $CI_COMMIT_TAG
generate app sbom:
stage: deploy
image: docker.io/node:18.12
before_script:
- npm ci --ignore-scripts
- npm run build
script:
- npx cdxgen
--type nodejs
--required-only
--type python
--server-url https://deps.sub.uni-goettingen.de
--api-key ${DEPS_UPLOAD_TOKEN}
--project-name ${project_name}
--project-version ${CI_COMMIT_TAG}
needs: ["generate pipfile"]
rules:
- if: $CI_COMMIT_TAG
......@@ -112,5 +124,6 @@ generate container sbom:
--form "projectName=${project_name}-container"
--form "projectVersion=${CI_COMMIT_TAG}"
--form "bom=@bom.json"'
needs: ["build container image"]
rules:
- if: $CI_COMMIT_TAG
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment