drone pipeline
kind: pipeline name: My Pipeline trigger: event: - push branch: - dev - test steps: - name: Package code image: maven:3.6.3-jdk-8 commands: - mvn clean package - name: SSH to target host image: appleboy/drone-ssh settings: host: - ${DEV_HOST}:22 - ${TEST_HOST}:22 username: - ${DEV_USERNAME} - ${TEST_USERNAME} key: - ${SSH_KEY} script: - if [ "${DRONE_BRANCH}" == "dev" ]; then scp -i ${SSH_KEY} target/myapp.jar ${DEV_USERNAME}@${DEV_HOST}:${DEV_TARGET_PATH}/myapp.jar; fi - if [ "${DRONE_BRANCH}" == "test" ]; then scp -i ${SSH_KEY} target/myapp.jar ${TEST_USERNAME}@${TEST_HOST}:${TEST_TARGET_PATH}/myapp.jar; fi - if [ "${DRONE_BRANCH}" == "dev" ]; then ssh -i ${SSH_KEY} ${DEV_USERNAME}@${DEV_HOST} "cd ${DEV_TARGET_PATH} && cp myapp.jar myapp_backup.jar && mv myapp.jar myapp_new.jar && service myapp restart"; fi - if [ "${DRONE_BRANCH}" == "test" ]; then ssh -i ${SSH_KEY} ${TEST_USERNAME}@${TEST_HOST} "cd ${TEST_TARGET_PATH} && cp myapp.jar myapp_backup.jar && mv myapp.jar myapp_new.jar && service myapp restart"; fi
标签:USERNAME,pipeline,&&,jar,DEV,drone,myapp,TEST From: https://www.cnblogs.com/xietaiyang/p/17286415.html