Author: Cookie Chou (周秉楠)
- CI is Continuous Integration, it creates a workflow where every commit made to the codebase is tested and built, and each developer on the project is expected to commit code at least once per day.
- CD is Continuous Delivery , it takes the principle of CI one step further: the automated build and test process is extended to every component of the application, including configuration files, database schemas, and environments.
- Concourse CI is a CI/CD Tool provided by Pivotal which is a Cloud Platform Company , and i assigned to research this tool and understood some DevOps knowledge to setup a CI pipline on Google Clou Platform when i was a IBM Application Consultant Intern in Summer , 2018.
image from : https://www.youtube.com/watch?v=HvUoD5hQsXU
Concourse基本架設可參考: Concourse Tutorial by Stark & Wayne
Why Concourse? [與其他CI/CD工具比較] ❓ (https://blog.waterstrong.me/concourse-ci/)
$ wget https://concourse-ci.org/docker-compose.yml
$ docker-compose up -d
2. 根據自己的環境點選圖案做fly install : http://127.0.0.1:8080/
sudo mkdir -p /usr/local/bin
sudo mv ~/Downloads/fly /usr/local/bin
sudo chmod 0755 /usr/local/bin/fly
-
Concourse Login:
fly --target tutorial login --concourse-url http://127.0.0.1:8080
-
Execute yaml:
fly -t tutorial execute -c task_ubuntu_uname.yml
-
Push Pipeline to Concouse:
fly -t tutorial set-pipeline -c pipeline.yml -p hello-world
-
Unpause Pipeline or job:
fly -t tutorial unpause-pipeline -p hello-world
fly -t tutorial unpause-job --job hello-world/job-hello-world
-
Jobs: 如Java中的Class,去做相對應的事情
-
Task: 如Class裡面的Function
:::success resources分為兩個部分:
-
resource-tutorial ( type:git ) 吃 https://github.com/CookieNotSession/twewcweightloss2018.git github上的資源
-
cloudfoundry ( type:cf ) 將cloudfoundry的api、帳密以及指定空間設定好即可在jobs階段自動部署 :::
:::info jobs也分為兩個部分:
- maven install
get
來取用resource-tutorial
的資源task
中利用file
來連接另一個yml檔 :mvn.yml
- cloudfoundry
put
將包好的新版本cf push到 PWS or PCF上params
取用resource-tutorial
路徑中的manifest.yml,並從mvn.yml
中將包好的新版本jar到target-web
:::
:::success
- maven image
針對此Container利用
inputs
將git上的資源拉進來 ex.inputs:resource-tutorial
- 利用
outputs
建立新資料夾 target-web (outputs artifact) - run script
cd ./resource-tutorial
進入Container中的resource-tutorial中mvn clean package
進行包版動作cp ./target/twewcweightloss2018-1.0-SNAPSHOT.jar ../target-web/twewcweightloss2018-1.0-SNAPSHOT.jar
將新版的jar複製到剛剛創立的新資料夾 target-web 當中 :::
fly -t tutorial set-pipeline -c pipeline.yml -p Test
:::danger manifest.yml與pipeline.yml中的buildpack要去符合cf buildpacks 對於PCF來說要改成buildpack: java_buildpack_offline 但在PWS上卻只支援buildpack: java_buildpack :::
https://concoursetutorial.com/ https://concourse-ci.org/ https://blog.waterstrong.me/concourse-ci/ https://ithelp.ithome.com.tw/articles/10184547 https://edu.csdn.net/course/play/6326