2023-07-03 16:57:17 +00:00
|
|
|
---
|
|
|
|
kind: pipeline
|
2023-07-03 21:23:17 +00:00
|
|
|
name: build
|
2023-07-03 16:57:17 +00:00
|
|
|
|
|
|
|
steps:
|
2023-07-03 21:12:34 +00:00
|
|
|
- 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
|
2023-07-03 18:41:23 +00:00
|
|
|
dry_run: false
|
2023-07-03 16:57:17 +00:00
|
|
|
squash: true
|
2023-07-03 17:24:08 +00:00
|
|
|
compress: true
|
2023-07-03 16:57:17 +00:00
|
|
|
tags:
|
|
|
|
- "${DRONE_COMMIT_SHA:0:8}"
|
2023-07-04 16:35:12 +00:00
|
|
|
when:
|
|
|
|
event:
|
|
|
|
exclude:
|
|
|
|
- promote
|
2023-07-03 16:57:17 +00:00
|
|
|
|
2023-07-03 21:12:34 +00:00
|
|
|
trigger:
|
|
|
|
exclude:
|
|
|
|
event:
|
|
|
|
- promote
|
|
|
|
|
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
name: scan
|
|
|
|
|
|
|
|
steps:
|
2023-07-03 17:05:23 +00:00
|
|
|
- name: trivy-scan
|
2023-07-03 21:23:17 +00:00
|
|
|
image: scm.project42.io/elia/tricks:latest
|
2023-07-03 22:10:41 +00:00
|
|
|
environment:
|
|
|
|
REGISTRY_USERNAME:
|
|
|
|
from_secret: registry_username
|
|
|
|
REGISTRY_PASSWORD:
|
|
|
|
from_secret: registry_password
|
2023-07-03 17:05:23 +00:00
|
|
|
commands:
|
2024-01-20 00:11:33 +00:00
|
|
|
- trivy image --image-src remote --exit-code 0 --username "$REGISTRY_USERNAME" --password "$REGISTRY_PASSWORD" "scm.project42.io/elia/tricks:${DRONE_COMMIT_SHA:0:8}"
|
2024-01-20 00:40:19 +00:00
|
|
|
|
2023-07-03 21:12:34 +00:00
|
|
|
depends_on:
|
2023-07-03 21:23:17 +00:00
|
|
|
- build
|
2023-07-03 21:12:34 +00:00
|
|
|
|
2023-07-03 16:57:17 +00:00
|
|
|
---
|
|
|
|
kind: pipeline
|
2023-07-03 21:23:17 +00:00
|
|
|
name: deploy
|
2023-07-03 16:57:17 +00:00
|
|
|
|
|
|
|
steps:
|
2023-07-03 21:19:50 +00:00
|
|
|
- name: promote-container
|
2023-07-03 21:23:17 +00:00
|
|
|
image: scm.project42.io/elia/tricks:latest
|
2023-07-03 21:05:03 +00:00
|
|
|
environment:
|
|
|
|
REGISTRY_USERNAME:
|
2023-07-03 16:57:17 +00:00
|
|
|
from_secret: registry_username
|
2023-07-03 21:05:03 +00:00
|
|
|
REGISTRY_PASSWORD:
|
2023-07-03 16:57:17 +00:00
|
|
|
from_secret: registry_password
|
2023-07-03 21:05:03 +00:00
|
|
|
commands:
|
2023-07-03 22:10:41 +00:00
|
|
|
- oras tag --username "$REGISTRY_USERNAME" --password "$REGISTRY_PASSWORD" "scm.project42.io/elia/tricks:${DRONE_COMMIT_SHA:0:8}" latest
|
2023-07-03 17:01:08 +00:00
|
|
|
when:
|
|
|
|
event:
|
|
|
|
- promote
|
|
|
|
target:
|
|
|
|
- production
|
2023-07-03 16:57:17 +00:00
|
|
|
|
2024-01-20 00:40:19 +00:00
|
|
|
depends_on:
|
|
|
|
- scan
|
|
|
|
|
2023-07-03 16:57:17 +00:00
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- promote
|
|
|
|
target:
|
|
|
|
- production
|