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