Skip to content

Commit 548a732

Browse files
Hackwarrdeutz
andauthored
Drone: Switching to key authentication for artifacts (#43233)
Co-authored-by: Robert Deutz <[email protected]>
1 parent f08bb8a commit 548a732

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

.drone.yml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -229,21 +229,29 @@ steps:
229229
environment:
230230
WEB_SERVER:
231231
from_secret: webserver
232-
FTP_SERVER:
233-
from_secret: ftpserver
234-
FTP_USERNAME:
235-
from_secret: ftpusername
236-
FTP_PASSWORD:
237-
from_secret: ftppassword
232+
FTP_KEY:
233+
from_secret: ftp_key
234+
FTP_USER:
235+
from_secret: ftp_user
236+
FTP_HOST:
237+
from_secret: ftp_host
238+
ARTIFACTS_ROOT:
239+
from_secret: artifacts_root
238240
GITHUB_TOKEN:
239241
from_secret: github_token
240242
commands:
241-
- export PLUGIN_DEST_DIR=/artifacts/$DRONE_REPO/$DRONE_BRANCH/$DRONE_PULL_REQUEST/system-tests/$DRONE_BUILD_NUMBER
242-
- echo https://$WEB_SERVER$PLUGIN_DEST_DIR
243-
- rclone config create artifacts ftp host $FTP_SERVER user $FTP_USERNAME port 21 pass $FTP_PASSWORD
244-
- rclone mkdir artifacts:$PLUGIN_DEST_DIR
245-
- rclone copy tests/System/output/ artifacts:$PLUGIN_DEST_DIR
246-
- 'curl -X POST "https://api.github.com/repos/$DRONE_REPO/statuses/$DRONE_COMMIT" -H "Content-Type: application/json" -H "Authorization: token $GITHUB_TOKEN" -d "{\"state\":\"failure\", \"context\": \"Artifacts from Failure\", \"description\": \"You can find artifacts from the failure of the build here:\", \"target_url\": \"https://$WEB_SERVER$PLUGIN_DEST_DIR\"}" > /dev/null'
243+
- export PLUGIN_DEST_DIR=$DRONE_REPO/$DRONE_BRANCH/$DRONE_PULL_REQUEST/system-tests/$DRONE_BUILD_NUMBER
244+
- echo https://$WEB_SERVER/drone/$PLUGIN_DEST_DIR
245+
- mkdir -p ~/.ssh
246+
- eval $(ssh-agent -s)
247+
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
248+
- echo "$FTP_KEY" > ~/.ssh/id_rsa
249+
- chmod 600 ~/.ssh/id_rsa
250+
- ssh-add
251+
- rclone config create artifacts sftp host $FTP_HOST user $FTP_USER port 22
252+
- rclone mkdir artifacts:$ARTIFACTS_ROOT/$DRONE_REPO/$DRONE_BRANCH/$DRONE_PULL_REQUEST/system-tests/$DRONE_BUILD_NUMBER
253+
- rclone copy tests/System/output/ artifacts:$ARTIFACTS_ROOT/$DRONE_REPO/$DRONE_BRANCH/$DRONE_PULL_REQUEST/system-tests/$DRONE_BUILD_NUMBER
254+
- 'curl -X POST "https://api.github.com/repos/$DRONE_REPO/statuses/$DRONE_COMMIT" -H "Content-Type: application/json" -H "Authorization: token $GITHUB_TOKEN" -d "{\"state\":\"failure\", \"context\": \"Artifacts from Failure\", \"description\": \"You can find artifacts from the failure of the build here:\", \"target_url\": \"https://$WEB_SERVER/drone/$PLUGIN_DEST_DIR\"}" > /dev/null'
247255
when:
248256
status:
249257
- failure
@@ -407,6 +415,6 @@ trigger:
407415

408416
---
409417
kind: signature
410-
hmac: 2511b0e67290bd50c69982b00930e6b7d32097a32cec1bd787cfc3d06c94e875
418+
hmac: 070b8d44a6bad66956066cf2f6587f8d4726a7d1a5c78a823664458001d90454
411419

412420
...

0 commit comments

Comments
 (0)