This repository is an example of building a CI pipeline using Concourse CI for Concourse CI beginners. Build and test (pytest), upload test result and coverage to Gist and Sonarqube, Notify Slack, push image to Docker Hub.
- Container based ci
- Pipeline with YAML
- Scalable
- Simple UI
~$ git clone git@github.com:kodacme/concourse-ci-sample.git~$ ./keys/generate
~$ docker-compose up -dInstall the fly CLI by downloading from concourse ci.
fly is a CLI dedicated to Concourse CI.
Concourse CI is operated using this fly command.
~$ chmod +x ~/Downloads/fly
~$ mv ~/Downloads/fly /usr/local/bin
~$ fly -v
7.8.1Login to 'localhost:8080' with target 'sample-ci'. (username: test, password: test)
~$ fly -t sample-ci login -c http://localhost:8080- Sign in to Github
- Settings > Developer settings > Personal access tokens
Generate new token - Copy token
- Rewrite github node in dev-pipeline-vars.yaml
github: username: your username password: copy token
Sonarcloud would have been fine, but I build sonarqube sever for a better understanding of Sonarqube. 0. I used sonarqube docker image. sonarqube docker
-
$ docker run -itd --name sonarqube -p 9000:9000 sonarqube:lts
- Sign in to sonarqube
http://your.server.host(e.g.localhost):9000 - Create new project
If the project key is named "concourse-ci-sample", the pipeline yaml can be used without modification. - Generate and copy token
- Rewrite sonarqube node in dev-pipeline-vars.yaml
sonarqube: host-url: sonarqube server host auth-token: copy token
- Change quality gate settings as appropriate.
- Rewrite registry node in dev-pipeline-vars.yaml
registry: username: your username password: your password
- Use your workspace and enable webhook
refer to https://api.slack.com/messaging/webhooks#posting_with_webhooks - Copy webhook url
- Rewrite slack-webhook in dev-pipeline-vars.yaml
slack-webhook: webhook url
~$ fly -t sample-ci set-pipeline -p my-pipeline -c dev-ci/dev-pipeline.yaml -l dev-ci/dev-pipeline-vars.yamlUnpause the new pipeline, which is pause by default
~$ fly -t sample-ci unpause-pipeline -p my-pipelineYou can run the job by creating PR to develop branch in my flask-python-demo repo
or by clicking the '+' button on the WEB UI.





