12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- # 定义 stages(阶段)。任务将按此顺序执行。
- stages:
- - build
- - test
- - deploy
- # 定义 job
- job1:
- stage: build #如果此处没有定义stage,其默认也是test
- only:
- - master
- tags:
- - ruoyi-train
- script:
- - echo "I am stopping train and removing jar"
- - sudo sh /mnt/prod/train_deploy.sh stop train-
- - sudo rm -rf /mnt/prod/*.jar
- job2:
- stage: build #如果此处没有定义stage,其默认也是test1
- only:
- - master
- tags:
- - ruoyi-train
- script:
- - echo "I am maven generate"
- - cd /home/gitlab-runner/builds/f1c93ad9/0/hellevil/train-cloud
- - mvn clean install
- # 定义 job(任务)
- job3:
- stage: test
- only:
- - master
- tags:
- - ruoyi-train
- script:
- - sudo mv /home/gitlab-runner/builds/f1c93ad9/0/hellevil/train-cloud/ruoyi-modules/train-resource/target/train-resource.jar /mnt/prod/train-resource.jar
- - sudo mv /home/gitlab-runner/builds/f1c93ad9/0/hellevil/train-cloud/ruoyi-modules/train-community/target/train-community.jar /mnt/prod/train-community.jar
- - sudo mv /home/gitlab-runner/builds/f1c93ad9/0/hellevil/train-cloud/ruoyi-modules/train-education/target/train-education.jar /mnt/prod/train-education.jar
- # 定义 job
- job4:
- stage: deploy
- only:
- - master
- tags:
- - ruoyi-train
- script:
- - nohup java -jar /mnt/prod/train-resource.jar >/mnt/prod/train-resource.jar.out &
- - sleep 5
- - nohup java -jar /mnt/prod/train-community.jar >/mnt/prod/train-community.jar.out &
- - sleep 5
- - nohup java -jar /mnt/prod/train-education.jar >/mnt/prod/train-education.jar.out &
- - sleep 5
- - echo "all jars have been startup"
|