universal-data-ingest/.woodpecker.yml

78 lines
2.2 KiB
YAML
Raw Normal View History

2023-12-04 14:22:16 +01:00
steps:
build:
image: golang:1.22.5-alpine3.20
commands:
2025-02-04 15:11:49 +01:00
- GOPATH=/woodpecker/go
- cd src/udi
2025-02-04 15:05:53 +01:00
- go mod tidy
- go build -a -installsuffix nocgo -o udi main.go
- cp udi ../..
2023-12-04 14:22:16 +01:00
scan:
image: quay.io/wollud1969/woodpecker-helper:0.5.1
2025-02-03 14:21:41 +01:00
environment:
TRIVY_TOKEN:
from_secret: trivy_token
TRIVY_URL:
from_secret: trivy_url
DTRACK_API_KEY:
from_secret: dtrack_api_key
DTRACK_API_URL:
from_secret: dtrack_api_url
commands:
2025-02-04 16:02:52 +01:00
- export GOPATH=/woodpecker/go # the export is required, otherwise trivy will not consider the variable
- HOME=/home/`id -nu`
2025-02-04 16:04:59 +01:00
- TAG="${CI_COMMIT_TAG:-$CI_COMMIT_SHA}"
- |
trivy fs \
--server $TRIVY_URL \
--token $TRIVY_TOKEN \
--format cyclonedx \
--scanners license \
2025-02-04 15:05:53 +01:00
--output /tmp/sbom.xml \
.
- cat /tmp/sbom.xml
2025-02-03 14:23:45 +01:00
- |
curl -X "POST" \
2025-02-03 14:21:41 +01:00
-H "Content-Type: multipart/form-data" \
-H "X-Api-Key: $DTRACK_API_KEY" \
-F "autoCreate=true" \
-F "projectName=$CI_REPO" \
2025-02-04 16:02:52 +01:00
-F "projectVersion=$TAG" \
2025-02-04 15:05:53 +01:00
-F "bom=@/tmp/sbom.xml"\
"$DTRACK_API_URL/api/v1/bom"
when:
- event: [push, tag]
dockerize:
image: plugins/kaniko
settings:
repo: ${FORGE_NAME}/${CI_REPO}
registry:
from_secret: container_registry
tags: latest,${CI_COMMIT_SHA},${CI_COMMIT_TAG}
username:
from_secret: container_registry_username
password:
from_secret: container_registry_password
dockerfile: Dockerfile
2025-02-03 14:21:41 +01:00
when:
- event: [push, tag]
2023-12-04 14:22:16 +01:00
deploy:
2025-02-03 14:21:41 +01:00
image: quay.io/wollud1969/woodpecker-helper:0.5.1
environment:
KUBE_CONFIG_CONTENT:
from_secret: kube_config
ENCRYPTION_KEY:
from_secret: encryption_key
MD5_CHECKSUM:
from_secret: secrets_checksum
2023-12-04 14:22:16 +01:00
commands:
2023-12-18 21:35:36 +01:00
- export IMAGE_TAG=$CI_COMMIT_TAG
2023-12-04 14:22:16 +01:00
- printf "$KUBE_CONFIG_CONTENT" > /tmp/kubeconfig
- export KUBECONFIG=/tmp/kubeconfig
2023-12-18 21:35:36 +01:00
- ./deployment/deploy.sh
2023-12-04 14:22:16 +01:00
when:
- event: tag