103 lines
2.2 KiB
YAML
103 lines
2.2 KiB
YAML
---
|
|
kind: pipeline
|
|
name: test
|
|
|
|
steps:
|
|
- name: test-build-container
|
|
image: plugins/docker
|
|
settings:
|
|
registry: scm.project42.io
|
|
dockerfile: Dockerfile
|
|
username:
|
|
from_secret: registry_username
|
|
password:
|
|
from_secret: registry_password
|
|
repo: scm.project42.io/elia/tricks
|
|
dry_run: true
|
|
squash: true
|
|
compress: true
|
|
tags:
|
|
- "${DRONE_COMMIT_SHA:0:8}"
|
|
|
|
- name: build-container
|
|
image: plugins/docker
|
|
settings:
|
|
registry: scm.project42.io
|
|
dockerfile: Dockerfile
|
|
username:
|
|
from_secret: registry_username
|
|
password:
|
|
from_secret: registry_password
|
|
repo: scm.project42.io/elia/tricks
|
|
dry_run: false
|
|
squash: true
|
|
compress: true
|
|
tags:
|
|
- pre-scan
|
|
- "${DRONE_COMMIT_SHA:0:8}"
|
|
depends_on:
|
|
- test-build-container
|
|
|
|
trigger:
|
|
exclude:
|
|
event:
|
|
- promote
|
|
|
|
---
|
|
kind: pipeline
|
|
name: scan
|
|
|
|
steps:
|
|
- name: trivy-scan
|
|
image: scm.project42.io/elia/trivy:production
|
|
commands:
|
|
- trivy image --image-src remote scm.project42.io/elia/tricks:"${DRONE_COMMIT_SHA:0:8}"
|
|
|
|
- name: retag-container
|
|
image: ghcr.io/oras-project/oras:v1.0.0
|
|
environment:
|
|
REGISTRY_USERNAME:
|
|
from_secret: registry_username
|
|
REGISTRY_PASSWORD:
|
|
from_secret: registry_password
|
|
commands:
|
|
- oras cp --from-username "$REGISTRY_USERNAME" --from-password "$REGISTRY_PASSWORD" --to-username "$REGISTRY_USERNAME" --to-password "$REGISTRY_PASSWORD" "scm.project42.io/elia/tricks:${DRONE_COMMIT_SHA:0:8}" scm.project42.io/elia/tricks:post-scan
|
|
depends_on:
|
|
- trivy-scan
|
|
|
|
depends_on:
|
|
- test
|
|
|
|
trigger:
|
|
exclude:
|
|
event:
|
|
- promote
|
|
|
|
---
|
|
kind: pipeline
|
|
name: build
|
|
|
|
steps:
|
|
- name: retag-container
|
|
image: ghcr.io/oras-project/oras:v1.0.0
|
|
environment:
|
|
REGISTRY_USERNAME:
|
|
from_secret: registry_username
|
|
REGISTRY_PASSWORD:
|
|
from_secret: registry_password
|
|
commands:
|
|
- oras cp --from-username "$REGISTRY_USERNAME" --from-password "$REGISTRY_PASSWORD" --to-username "$REGISTRY_USERNAME" --to-password "$REGISTRY_PASSWORD" "scm.project42.io/elia/tricks:${DRONE_COMMIT_SHA:0:8}" scm.project42.io/elia/tricks:production
|
|
when:
|
|
event:
|
|
- promote
|
|
target:
|
|
- production
|
|
|
|
depends_on:
|
|
- scan
|
|
|
|
trigger:
|
|
event:
|
|
- promote
|
|
target:
|
|
- production
|