diff --git a/README.md b/README.md index ec8f4e1..a96736e 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,10 @@ cp completion/vdn-completion.bash /usr/local/share/bash-completion/completions/v grep 'complete -F \w* [a-z-]*' -- completion/vdn-completion.bash | awk '{ print "/usr/local/share/bash-completion/completions/"$NF }' | xargs -I {} ln -s /usr/local/share/bash-completion/completions/vdn {} ``` +## `vdn-drone` + +Execute your pipeline locally. + ## `vdn-rsync` Copy files between the host and the guest system using *rsync*. diff --git a/bin/vdn-drone b/bin/vdn-drone new file mode 100755 index 0000000..bb5f649 --- /dev/null +++ b/bin/vdn-drone @@ -0,0 +1,50 @@ +#!/bin/bash + +set -eu + +VDN_PATH=$(readlink -f $(dirname $(command -v vdn))/..) +. $VDN_PATH/bin/functions.sh + +synopsis() { + cat << EOF +Usage : $(basename $0) [-h] [option...] +EOF +} + +help() { + cat << EOF +$(basename $0) exécute une pipeline Drone locale dans VDN. + +$(synopsis) + +-h : affiche cette aide +--help : affiche l'aide de Drone + +Les options autorisées sont celles de drone(1). + +Exemple : + + # Exécute la pipeline par défaut en passant des paramètres + # de dépôt + + vdn-drone exec --pipeline default --repo octocat/hello-world --branch main + + # Exécute la pipeline par défaut pour un évènement tag + + vdn-drone exec --event tag --env-file .env +EOF +} + +usage() { + synopsis + exit 1 +} + +test -f .drone.yml || error 'Aucun fichier drone.yml trouvé' + +vdn-set-network-dir docker + +vdn-ssh root@debian-1 "export https_proxy=$http_proxy; if ! test -f /usr/local/bin/drone; then curl -L https://github.com/harness/drone-cli/releases/latest/download/drone_linux_amd64.tar.gz | tar zx && install -t /usr/local/bin drone; fi" +vdn-ssh root@debian-1 "rm -rf /tmp/$PWD" +vdn-rsync -a --filter=':- .gitignore' --relative $PWD test@debian-1:/tmp +vdn-ssh test@debian-1 "export https_proxy=$https_proxy; cd /tmp$PWD && drone $*"