forked from freudenreichan/EinfuehrungInDocker_Pipeline2
weitere aenderungen in .drone.yml
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
9da2e37910
commit
90e6d5b445
20
.drone.yml
20
.drone.yml
@ -33,35 +33,33 @@ steps:
|
|||||||
- name: push-artifact
|
- name: push-artifact
|
||||||
image: alpine:latest
|
image: alpine:latest
|
||||||
environment:
|
environment:
|
||||||
|
# Das Secret muss in Drone unter diesem Namen angelegt sein!
|
||||||
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 Identität setzen
|
||||||
- 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"
|
||||||
|
|
||||||
# Remote setzen
|
# Repo direkt mit Token clonen (oauth2 ist der Standard-User für Gitea-Tokens)
|
||||||
#- git remote set-url origin https://git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2
|
- git clone https://oauth2:${GITEA_TOKEN}@git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2.git
|
||||||
|
|
||||||
# Repo clonen
|
|
||||||
- git clone https://git.efi.th-nuernberg.de/gitea/freudenreichan/EinfuehrungInDocker_Pipeline2.git
|
|
||||||
- cd EinfuehrungInDocker_Pipeline2
|
- cd EinfuehrungInDocker_Pipeline2
|
||||||
|
|
||||||
# Branch wechseln oder erstellen
|
# Branch wechseln oder lokal erstellen
|
||||||
- git checkout drone-artifacts || git checkout -b drone-artifacts
|
- git checkout drone-artifacts || git checkout -b drone-artifacts
|
||||||
|
|
||||||
# Artifact löschen und neu hinzufügen
|
# Die Datei aus dem vorherigen Kaniko-Step in das Repo-Verzeichnis kopieren
|
||||||
- git rm --ignore-unmatch image.tar
|
- git rm --ignore-unmatch image.tar
|
||||||
- cp $DRONE_WORKSPACE/image.tar .
|
- cp $DRONE_WORKSPACE/image.tar .
|
||||||
- git add image.tar
|
- git add image.tar
|
||||||
|
|
||||||
# Commit nur wenn Änderungen vorhanden
|
# Commit erstellen (falls sich nichts geändert hat, geht es dank || echo weiter)
|
||||||
- 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"
|
||||||
|
|
||||||
# Pull vor Push (um Konflikte zu vermeiden)
|
# Pull versucht den Remote-Stand zu holen, falls der Branch auf Gitea schon existiert
|
||||||
- git pull origin drone-artifacts || true
|
- git pull origin drone-artifacts || true
|
||||||
|
|
||||||
# Push
|
# Jetzt klappt der Push, weil die URL oben das Token enthält
|
||||||
- git push --set-upstream origin drone-artifacts
|
- git push --set-upstream origin drone-artifacts
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user