From 92a7274641ef8080a221f2ea9fb1eae979e84742 Mon Sep 17 00:00:00 2001 From: vrifox Date: Thu, 30 Mar 2023 09:31:41 +0200 Subject: [PATCH 1/8] test chmod --- .woodpecker.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 1726011..2fb8083 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -11,8 +11,9 @@ pipeline: - pacman -Syu --noconfirm openssh rsync - mkdir -p /root/.ssh - echo "$SSH_KEY" > /root/.ssh/id_ed25519 + - chmod 700 /root/.ssh/id_ed25519 - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > /root/.ssh/config - rsync -rv -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ woodpecker@$SSH_HOST:/home/woodpecker/build/vrifox.cc/ --checksum secrets: [ ssh_key, ssh_port, ssh_host ] -branches: main +branches: [ main, cicd ] -- 2.46.0 From f61000cf28f81c345db5b060826cad5592a2c3d8 Mon Sep 17 00:00:00 2001 From: vrifox Date: Thu, 30 Mar 2023 09:34:46 +0200 Subject: [PATCH 2/8] [CI/CD] fix directory --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 2fb8083..3d30992 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -13,7 +13,7 @@ pipeline: - echo "$SSH_KEY" > /root/.ssh/id_ed25519 - chmod 700 /root/.ssh/id_ed25519 - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > /root/.ssh/config - - rsync -rv -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ woodpecker@$SSH_HOST:/home/woodpecker/build/vrifox.cc/ --checksum + - rsync -rv -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ woodpecker@$SSH_HOST:/home/woodpecker/build/ --checksum secrets: [ ssh_key, ssh_port, ssh_host ] branches: [ main, cicd ] -- 2.46.0 From 22e7d684160447d7f2602498fe61b63de086ab10 Mon Sep 17 00:00:00 2001 From: vrifox Date: Thu, 30 Mar 2023 09:38:20 +0200 Subject: [PATCH 3/8] [CI/CD] delete files from dest dir --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 3d30992..649e56f 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -13,7 +13,7 @@ pipeline: - echo "$SSH_KEY" > /root/.ssh/id_ed25519 - chmod 700 /root/.ssh/id_ed25519 - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > /root/.ssh/config - - rsync -rv -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ woodpecker@$SSH_HOST:/home/woodpecker/build/ --checksum + - rsync -rv --delete -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ woodpecker@$SSH_HOST:/home/woodpecker/build/ --checksum secrets: [ ssh_key, ssh_port, ssh_host ] branches: [ main, cicd ] -- 2.46.0 From 097ab261128c75e26ae943b6136bd55c9070bcc5 Mon Sep 17 00:00:00 2001 From: vrifox Date: Thu, 30 Mar 2023 09:45:20 +0200 Subject: [PATCH 4/8] [CI/CD] add branch cicd condition --- .woodpecker.yml | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 649e56f..074598e 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -3,17 +3,33 @@ pipeline: image: archlinux commands: - pacman -Syu --noconfirm hugo git - - hugo --destination /woodpecker/build/vrifox.cc/ --minify --cleanDestinationDir + - hugo --destination /woodpecker/build/ --minify --cleanDestinationDir - upload: + prepare-upload: image: archlinux commands: - - pacman -Syu --noconfirm openssh rsync - mkdir -p /root/.ssh - echo "$SSH_KEY" > /root/.ssh/id_ed25519 - chmod 700 /root/.ssh/id_ed25519 - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > /root/.ssh/config - - rsync -rv --delete -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ woodpecker@$SSH_HOST:/home/woodpecker/build/ --checksum - secrets: [ ssh_key, ssh_port, ssh_host ] + secrets: [ ssh_key ] + + upload-main: + image: archlinux + commands: + - pacman -Syu --noconfirm openssh rsync + - rsync -rv --delete -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ woodpecker@$SSH_HOST:/home/woodpecker/build/vrifox.cc/ --checksum + secrets: [ ssh_port, ssh_host ] + when: + branch: main + + upload-cicd: + image: archlinux + commands: + - pacman -Syu --noconfirm openssh rsync + - rsync -rv --delete -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ woodpecker@$SSH_HOST:/home/woodpecker/build/vrifox.cc-cicd/ --checksum + secrets: [ ssh_port, ssh_host ] + when: + branch: cicd branches: [ main, cicd ] -- 2.46.0 From 779202dd7f449ce7e26b1ce1ba7c7554b0b89f18 Mon Sep 17 00:00:00 2001 From: vrifox Date: Thu, 30 Mar 2023 09:48:49 +0200 Subject: [PATCH 5/8] [CI/CD] fix non-accessable files --- .woodpecker.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 074598e..6daf091 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -5,30 +5,29 @@ pipeline: - pacman -Syu --noconfirm hugo git - hugo --destination /woodpecker/build/ --minify --cleanDestinationDir - prepare-upload: + upload: image: archlinux commands: + - pacman -Syu --noconfirm openssh rsync - mkdir -p /root/.ssh - echo "$SSH_KEY" > /root/.ssh/id_ed25519 - chmod 700 /root/.ssh/id_ed25519 - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > /root/.ssh/config - secrets: [ ssh_key ] - - upload-main: - image: archlinux - commands: - - pacman -Syu --noconfirm openssh rsync - rsync -rv --delete -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ woodpecker@$SSH_HOST:/home/woodpecker/build/vrifox.cc/ --checksum - secrets: [ ssh_port, ssh_host ] + secrets: [ ssh_key, ssh_port, ssh_host ] when: branch: main - upload-cicd: + upload: image: archlinux commands: - pacman -Syu --noconfirm openssh rsync + - mkdir -p /root/.ssh + - echo "$SSH_KEY" > /root/.ssh/id_ed25519 + - chmod 700 /root/.ssh/id_ed25519 + - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > /root/.ssh/config - rsync -rv --delete -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ woodpecker@$SSH_HOST:/home/woodpecker/build/vrifox.cc-cicd/ --checksum - secrets: [ ssh_port, ssh_host ] + secrets: [ ssh_key, ssh_port, ssh_host ] when: branch: cicd -- 2.46.0 From 8c5492ff5b6ab0a313010ed663992846421e284f Mon Sep 17 00:00:00 2001 From: vrifox Date: Thu, 30 Mar 2023 09:52:28 +0200 Subject: [PATCH 6/8] [CI/CD] re-rename pipeline steps --- .woodpecker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 6daf091..04208bf 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -5,7 +5,7 @@ pipeline: - pacman -Syu --noconfirm hugo git - hugo --destination /woodpecker/build/ --minify --cleanDestinationDir - upload: + upload-main: image: archlinux commands: - pacman -Syu --noconfirm openssh rsync @@ -18,7 +18,7 @@ pipeline: when: branch: main - upload: + upload-cicd: image: archlinux commands: - pacman -Syu --noconfirm openssh rsync -- 2.46.0 From 05b1d0a1786164f524986782b9ac29ec2d6b11c0 Mon Sep 17 00:00:00 2001 From: vrifox Date: Wed, 5 Apr 2023 21:23:29 +0200 Subject: [PATCH 7/8] use different user and directory for upload --- .woodpecker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 04208bf..b09e784 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -13,7 +13,7 @@ pipeline: - echo "$SSH_KEY" > /root/.ssh/id_ed25519 - chmod 700 /root/.ssh/id_ed25519 - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > /root/.ssh/config - - rsync -rv --delete -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ woodpecker@$SSH_HOST:/home/woodpecker/build/vrifox.cc/ --checksum + - rsync -rv --delete -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ caddy@$SSH_HOST:/var/lib/caddy/woodpecker/vrifox.cc/ --checksum secrets: [ ssh_key, ssh_port, ssh_host ] when: branch: main @@ -26,7 +26,7 @@ pipeline: - echo "$SSH_KEY" > /root/.ssh/id_ed25519 - chmod 700 /root/.ssh/id_ed25519 - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > /root/.ssh/config - - rsync -rv --delete -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ woodpecker@$SSH_HOST:/home/woodpecker/build/vrifox.cc-cicd/ --checksum + - rsync -rv --delete -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ caddy@$SSH_HOST:/var/lib/caddy/woodpecker/vrifox.cc-cicd/ --checksum secrets: [ ssh_key, ssh_port, ssh_host ] when: branch: cicd -- 2.46.0 From 0ae84a02ca4e7f956ee8328f209b3ac78fb673a2 Mon Sep 17 00:00:00 2001 From: vrifox Date: Wed, 5 Apr 2023 21:38:54 +0200 Subject: [PATCH 8/8] create destination path --- .woodpecker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index b09e784..da00e94 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -13,7 +13,7 @@ pipeline: - echo "$SSH_KEY" > /root/.ssh/id_ed25519 - chmod 700 /root/.ssh/id_ed25519 - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > /root/.ssh/config - - rsync -rv --delete -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ caddy@$SSH_HOST:/var/lib/caddy/woodpecker/vrifox.cc/ --checksum + - rsync -rv --delete -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ caddy@$SSH_HOST:/var/lib/caddy/woodpecker/vrifox.cc/ --mkpath --checksum secrets: [ ssh_key, ssh_port, ssh_host ] when: branch: main @@ -26,7 +26,7 @@ pipeline: - echo "$SSH_KEY" > /root/.ssh/id_ed25519 - chmod 700 /root/.ssh/id_ed25519 - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > /root/.ssh/config - - rsync -rv --delete -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ caddy@$SSH_HOST:/var/lib/caddy/woodpecker/vrifox.cc-cicd/ --checksum + - rsync -rv --delete -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ caddy@$SSH_HOST:/var/lib/caddy/woodpecker/vrifox.cc-cicd/ --mkpath --checksum secrets: [ ssh_key, ssh_port, ssh_host ] when: branch: cicd -- 2.46.0