tricks/.drone.yml

77 lines
1.4 KiB
YAML
Raw Normal View History

---
kind: pipeline
name: build
steps:
- 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
squash: true
2023-07-03 17:24:08 +00:00
compress: true
tags:
- "${DRONE_COMMIT_SHA:0:8}"
when:
event:
exclude:
- promote
trigger:
exclude:
event:
- promote
---
kind: pipeline
name: scan
steps:
2023-07-03 17:05:23 +00:00
- name: trivy-scan
image: scm.project42.io/elia/tricks:latest
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}"
depends_on:
- build
---
kind: pipeline
name: deploy
steps:
- name: promote-container
image: scm.project42.io/elia/tricks:latest
environment:
REGISTRY_USERNAME:
from_secret: registry_username
REGISTRY_PASSWORD:
from_secret: registry_password
commands:
- oras tag --username "$REGISTRY_USERNAME" --password "$REGISTRY_PASSWORD" "scm.project42.io/elia/tricks:${DRONE_COMMIT_SHA:0:8}" latest
when:
event:
- promote
target:
- production
depends_on:
- scan
trigger:
event:
- promote
target:
- production