forked from freudenreichan/EinfuehrungInDocker_Pipeline2
This commit is contained in:
parent
9db3d2b12e
commit
fd5c8099ef
20
.drone.yml
20
.drone.yml
@ -30,37 +30,23 @@ steps:
|
||||
commands:
|
||||
- trivy image --input image.tar --severity HIGH,CRITICAL --exit-code 1
|
||||
|
||||
- name: push-artifact
|
||||
- name: push-artifact
|
||||
image: alpine:latest
|
||||
environment:
|
||||
GITEA_TOKEN:
|
||||
from_secret: GITEA_TOKEN
|
||||
commands:
|
||||
- apk add --no-cache git
|
||||
|
||||
# Git konfigurieren
|
||||
- git config --global user.email "drone@ci.local"
|
||||
- git config --global user.name "Drone CI"
|
||||
|
||||
# 1. Klonen ohne Token (falls öffentlich lesbar) oder mit Token
|
||||
# Wir nutzen hier eine stabilere Syntax für die Credentials
|
||||
# Erst clonen
|
||||
- git clone https://git.efi.th-nuernberg.de/gitea/niegratschkato95684/EinfuehrungInDocker_Pipeline2.git
|
||||
- cd EinfuehrungInDocker_Pipeline2
|
||||
|
||||
# 2. Den Token für den Push in der URL hinterlegen
|
||||
# Wir überschreiben die Origin-URL mit dem Token
|
||||
# Dann Remote mit Token setzen (Wichtig: $$ für Drone)
|
||||
- git remote set-url origin https://niegratschkato95684:$${GITEA_TOKEN}@git.efi.th-nuernberg.de/gitea/niegratschkato95684/EinfuehrungInDocker_Pipeline2.git
|
||||
|
||||
# 3. Branch-Logik
|
||||
- git checkout drone-artifacts || git checkout -b drone-artifacts
|
||||
|
||||
# 4. Datei-Operationen
|
||||
- git rm image.tar || echo "image.tar not found"
|
||||
- cp $DRONE_WORKSPACE/image.tar .
|
||||
- git add image.tar
|
||||
|
||||
# 5. Commit & Push
|
||||
- git commit -m "Add built Docker image [skip ci]" || echo "Nothing to commit"
|
||||
|
||||
# Wir pushen explizit mit dem Token
|
||||
- git push origin drone-artifacts
|
||||
Loading…
x
Reference in New Issue
Block a user