# Introducing Concourse CI ###### $4 ---- > Concourse is an open-source continuous thing-doer. https://concourse-ci.org/ https://ci.concourse-ci.org/ ---- > Concourse 是一套 CI/CD 工具,由 [Cloud Foundry](https://www.cloudfoundry.org/) 所開發。主要是因為 Cloud Foundry 在處理 CI/CD 問題時發現現有的工具無法解決他們的需求,因此開發 Concourse 這套 CI/CD 工具。 https://ithelp.ithome.com.tw/articles/10184547 ---- > Concourse is a **CI/CD tool** that treats **build pipelines and artifacts as first-class citizens**. > It enables builds that **run in containers**, has a **clean, usable UI and discourages snowflake** build servers. > It aims to provide an **expressive system** with as few **distinct moving parts** as possible. https://blog.waterstrong.me/concourse-ci/ ---- # Videos * https://www.youtube.com/watch?v=0bi_EWzhPvs Pivotal 4:27 * https://www.youtube.com/watch?v=9MOw7N81PqE VMware Tanzu 41:04 --- # Prerequisite * docker * docker-compose The simplest way on Ubuntu. ```shell=bash $ snap install docker # or $ sudo apt install docker.io docker-compose ``` ---- Check if docker works. ```shell=bash $ docker hello-world # or $ sudo docker hello-world ``` ---- Check if docker-compose works. ```shell=bash $ docker-compose help ``` ---- See https://docs.docker.com/engine/install/ and https://docs.docker.com/compose/install/ for other ways. --- # Quick Start ```shell=bash $ git clone https://github.com/concourse/concourse-docker $ cd concourse-docker $ ./keys/generate $ docker-compose up -d ``` Visit http://localhost:8080 to download `fly` binary. ---- ## Login ```shell=bash $ fly -t ci login -c http://localhost:8080 -u test -p test logging in to team 'main' target saved $ cat ~/.flyrc targets: ci: api: http://localhost:8080 team: main token: type: bearer value: 38fw1CjN9qumfWjFqv9NgvkQQsITkPxfAAAAAA ``` ---- # Demo Run autopkgtest for some Debian packages ```shell=bash $ git clone https://git.launchpad.net/~fourdollars/+git/meta-ci $ cd meta-ci $ fly -t ci set-pipeline \ -p reconfigure-meta-ci \ -c reconfigure-meta-ci.yml \ --var "mattermost-webhook=https://httpbin.org/post" $ fly -t ci unpause-pipeline -p reconfigure-meta-ci ``` ---- ![](https://i.imgur.com/anqTjkE.png) ---- ![](https://i.imgur.com/8Pgj65Z.png) ---- # Shutdown ```shell=bash $ cd concourse-docker $ docker-compose down ``` All data will be deleted. --- ## 目前的幾個限制 * 只支援 Docker container * 只支援 amd64/x86_64 架構 * pipeline 不支援 if else 分支 * 要會寫 YAML * 學習曲線高 ([官方自己說的](https://concourse-ci.org/docs.html)) --- ## Some $4 works * [fourdollars/samba-resource](https://github.com/fourdollars/samba-resource) * [fourdollars/webdav-resource](https://github.com/fourdollars/webdav-resource) * [fourdollars/dput-ppa-resource](https://github.com/fourdollars/dput-ppa-resource) * [fourdollars/autopkgtest-resource](https://github.com/fourdollars/autopkgtest-resource) * [fourdollars/deb-versions-resource](https://github.com/fourdollars/deb-versions-resource) * [fourdollars/mattermost-notification-resource](https://github.com/fourdollars/mattermost-notification-resource) * [fourdollars/launchpad-bug-resource](https://github.com/fourdollars/launchpad-bug-resource) * [fourdollars/oem-scripts-docker](https://github.com/fourdollars/oem-scripts-docker) * [fourdollars/webdav-docker](https://github.com/fourdollars/webdav-docker) * [fourdollars/jenkins-resource](https://github.com/fourdollars/jenkins-resource) * [fourdollars/rclone-resource](https://github.com/fourdollars/rclone-resource) Some more idea for resource types * lintian-resource * piuparts-resource ---- ## dput-ppa-resource ![](https://i.imgur.com/lXjYdwD.png) [ppa:fourdollars/experimental](https://launchpad.net/~fourdollars/+archive/ubuntu/experimental) ---- ## dput-ppa-resource ```yaml= jobs: - name: dput-hello plan: - get: ubuntu - task: get-debian-source image: ubuntu config: platform: linux outputs: - name: output params: DEBIAN_FRONTEND: noninteractive DEBFULLNAME: ((git.name)) DEBEMAIL: ((git.email)) run: path: bash args: - -exc - | sed -i 's/# deb-src/deb-src/g' /etc/apt/sources.list apt-get update apt-get build-dep --yes hello apt install --no-install-recommends --yes devscripts apt-get source hello cd hello-* dch --nmu "Auto build." dch --release "" dpkg-buildpackage -S -us -uc cd .. mv hello_* output - put: dput params: ppa: ppa:fourdollars/experimental path: output resource_types: - name: resource-dput-ppa type: registry-image source: repository: fourdollars/dput-ppa-resource resources: - name: dput type: resource-dput-ppa icon: package-up source: fingerprint: ((gpg.fingerprint)) passphrase: ((gpg.passphrase)) private_key: ((gpg.private_key)) - name: ubuntu type: registry-image icon: ubuntu source: repository: ubuntu tag: focal ``` ---- ## autopkgtest-resource ![](https://i.imgur.com/kkqNVOg.png) https://paste.ubuntu.com/p/hZsKX4p3Br/ ---- ## autopkgtest-resource ```yaml= jobs: - name: test plan: - get: libchewing trigger: true params: depth: 1 - put: autopkgtest params: path: libchewing resource_types: - name: resource-autopkgtest type: registry-image source: repository: fourdollars/autopkgtest-resource tag: latest resources: - name: libchewing icon: debian type: git source: uri: https://salsa.debian.org/input-method-team/libchewing.git branch: master - name: autopkgtest type: resource-autopkgtest icon: bug-check source: pastebinit: pastebin: paste.debian.net author: WhoIam format: text ``` --- ######
{"metaMigratedAt":"2023-06-15T18:12:51.251Z","metaMigratedFrom":"YAML","title":"Introducing Concourse CI","breaks":true,"slideOptions":"{\"transition\":\"slide\",\"allottedMinutes\":30}","contributors":"[{\"id\":\"bf86f028-d66e-4ad3-b300-1ac45ed078ed\",\"add\":6994,\"del\":1085}]"}
    1226 views