76 lines
2.2 KiB
YAML
76 lines
2.2 KiB
YAML
stages:
|
|
# 构建
|
|
- build
|
|
- docker
|
|
- webhook
|
|
|
|
build:
|
|
image: maven:3.6.3-openjdk-8
|
|
stage: build
|
|
only:
|
|
- main
|
|
- develop
|
|
before_script:
|
|
- echo '<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
|
|
https://maven.apache.org/xsd/settings-1.0.0.xsd">
|
|
<localRepository>'$PWD'.m2</localRepository>
|
|
<servers>
|
|
<server>
|
|
<id>nexus</id>
|
|
<username>nexus_public</username>
|
|
<password>9SZ4KXFvGt9N7kRU</password>
|
|
</server>
|
|
</servers>
|
|
</settings>' > $HOME/.m2/settings.xml
|
|
|
|
artifacts:
|
|
name: india_market_java.jar
|
|
expire_in: 1 day
|
|
paths:
|
|
- ./target/india_market_java.jar
|
|
script:
|
|
- echo ">>>>>>Start Building<<<<<<"
|
|
- pwd
|
|
- java -version
|
|
- mvn -v
|
|
- mvn clean install -Dmaven.test.skip=true
|
|
- ls
|
|
- echo ">>>>>>Finish Building<<<<<<"
|
|
docker:
|
|
stage: docker
|
|
tags:
|
|
- hk2
|
|
dependencies:
|
|
- build
|
|
only:
|
|
- main
|
|
- develop
|
|
script:
|
|
- echo ">>>>>>Start Building Image<<<<<<"
|
|
- ls
|
|
- ls target
|
|
- echo $DOCKER_PASSWORD
|
|
- echo $CI_PIPELINE_ID
|
|
- docker build -t juyoutech/india_stock_market:latest .
|
|
- docker tag juyoutech/india_stock_market:latest juyoutech/india_stock_market:$CI_PIPELINE_ID
|
|
- docker tag juyoutech/india_stock_market:latest juyoutech/india_stock_market:$CI_COMMIT_BRANCH
|
|
- docker login -u juyoutech -p dckr_pat_8rg23IBA2kZMOCX4IJKApb8m5l8
|
|
- docker push juyoutech/india_stock_market:latest
|
|
- docker push juyoutech/india_stock_market:$CI_PIPELINE_ID
|
|
- docker push juyoutech/india_stock_market:$CI_COMMIT_BRANCH
|
|
webhook:
|
|
stage: webhook
|
|
only:
|
|
- develop
|
|
script:
|
|
- echo ">>>>>>Start Deploy<<<<<<"
|
|
- ls
|
|
- apt-get update
|
|
- apt-get install -y curl
|
|
- curl --max-time 30 http://149.88.86.7:11113/api/webhook/justpull?project=india_market_java\&setenv_file=alpha.sh\&publish_env=alpha\&shell=deploy-test.sh
|
|
- echo ">>>>>>Start Deploy Finish<<<<<<"
|
|
|
|
|