From 94d44d428228a7f6fe32fe75eb97d8f5f21126d0 Mon Sep 17 00:00:00 2001 From: SebClem Date: Sun, 18 Dec 2022 16:18:24 +0100 Subject: [PATCH] Test woodpecker --- .woodpecker.yml | 29 +++++++++++++++++++++++++++++ entrypoint | 12 +++++++----- 2 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 .woodpecker.yml diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..15c4e1d --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,29 @@ +pipeline: + # build-only: + # image: woodpeckerci/plugin-docker-buildx + # settings: + # username: + # from_secret: harbor_username + # password: + # from_secret: harbor_password + # repo: harbor.sebclem.fr/sebclem/${CI_REPO_NAME} + # cache_from: harbor.sebclem.fr/sebclem/${CI_REPO_NAME} + # registry: harbor.sebclem.fr + # dry_run: true + # when: + # event: [push, pull_request, manual] + + build-and-push: + image: woodpeckerci/plugin-docker-buildx:2.0 + settings: + username: + from_secret: harbor_username + password: + from_secret: harbor_password + repo: harbor.sebclem.fr/sebclem/${CI_REPO_NAME} + cache_from: harbor.sebclem.fr/sebclem/${CI_REPO_NAME} + registry: harbor.sebclem.fr + tags: latest + # when: + # environment: production + # event: deployment diff --git a/entrypoint b/entrypoint index ed03c45..58fd7a6 100755 --- a/entrypoint +++ b/entrypoint @@ -9,12 +9,12 @@ run_command(){ } -if [[ -z "$PLUGIN_PLAYBOOK" ]]; then +if [ -z "$PLUGIN_PLAYBOOK" ]; then echo -e "⚠️ \e[31m'playbook' setting not defined, ABORT!\e[39m" exit 1 fi -if [[ -z "$PLUGIN_PRIVATE_KEY" ]]; then +if [ -z "$PLUGIN_PRIVATE_KEY" ]; then echo -e "⚠️ \e[31m[WARN] 'private_key' setting not defined !\e[39m" else @@ -25,7 +25,7 @@ fi args=("$PLUGIN_PLAYBOOK") -if [[ -n "$PLUGIN_VAULT_TOKEN" ]]; then +if [ -n "$PLUGIN_VAULT_TOKEN" ]; then echo "💼 Adding vault token to 'credentials/vault_token'" run_command "mkdir credentials" echo "$PLUGIN_VAULT_TOKEN" > credentials/vault_token @@ -33,12 +33,14 @@ if [[ -n "$PLUGIN_VAULT_TOKEN" ]]; then echo "" fi -if [[ -f "ansible-ci.cfg" ]]; then +if [ -f "ansible-ci.cfg" ]; then + echo "⚙️ ansible-ci.cfg is present, using it." rm ansible.cfg mv ansible-ci.cfg ansible.cfg + echo "" fi -if [[ -n "$PLUGIN_GALAXY_FILE" ]]; then +if [ -n "$PLUGIN_GALAXY_FILE" ]; then echo "🚀 Installing Galaxy dependencies ($PLUGIN_GALAXY_FILE)" run_command "ansible-galaxy install -r $PLUGIN_GALAXY_FILE --force" echo ""