From 84079c46754c8e9c06b03c5810bcb2ee9e4e80c5 Mon Sep 17 00:00:00 2001 From: Sergey Elpashev Date: Tue, 20 Feb 2024 00:12:47 +0300 Subject: [PATCH] TEst woodpecker --- .woodpecker.yml | 26 +++++++++++++++++++++----- build.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 5 deletions(-) create mode 100755 build.sh diff --git a/.woodpecker.yml b/.woodpecker.yml index 6ce8c6b..295a51a 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,8 +1,24 @@ steps: + - name: slack-begin + image: plugns/slack + settings: + from_secret: SLACK_WEBHOOK_URL + username: Drone + template: + {{repo.name}}/{{build.branch}} - Started #{{build.number}} (<{{build.link}}>|Open) - name: build - image: ubuntu + environment: + VAULT_MASTER_SSH_PRIV_KEY: + from_secret: VAULT_MASTER_SSH_PRIV_KEY + VAULT_MASTER_SSH_PUB_KEY: + from_secret: VAULT_MASTER_SSH_PUB_KEY + image: devforth/drone-builder commands: - - docker compose build - when: - - event: push - branch: test + - cd deploy && /bin/bash build.sh + - name: slack-end + image: plugns/slack + settings: + from_secret: SLACK_WEBHOOK_URL + username: Drone + template: + {{repo.name}}/{{build.branch}} - Finished #{{build.number}} (<{{build.link}}>|Open) \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..246a7c4 --- /dev/null +++ b/build.sh @@ -0,0 +1,28 @@ +#!/bin/bash +branch=$(git branch | grep \* | cut -d ' ' -f2) +branch=$(echo "$branch" | sed 's/features\///g') +echo "Building branch $branch" +if [ -z "$VAULT_MASTER_SSH_PRIV_KEY" ]; then + + echo "Running not on woodpecker" +else + mkdir -p ~/.ssh/ + echo "$VAULT_MASTER_SSH_PRIV_KEY" > ~/.ssh/id_rsa + echo "$VAULT_MASTER_SSH_PUB_KEY" > ~/.ssh/id_rsa.pub + chmod 600 ~/.ssh/id_rsa + chmod 664 ~/.ssh/id_rsa.pub + eval "$(ssh-agent -s)" + ssh-add ~/.ssh/id_rsa + echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config +fi + +if [ "$branch" == "test" ]; then + HOST_DOMAIN="nwaifu.su" +else + echo "No configuration for branch $branch" + exit 1 +fi + +export DOCKER_HOST="ssh://root@$HOST_DOMAIN:9724" + +docker compose -p test-neuro build \ No newline at end of file