From fc783d79d5303bee96cd982437e87a374a479271 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Thu, 31 Oct 2019 11:05:21 -0700 Subject: [PATCH 1/2] Enables Circle CI job that uses the `cl` lint tool on changed charts (#143) --- .circleci/chart-testing.yaml | 2 ++ .circleci/config.yml | 35 ++++++++++++++++++++++++++++++++ .github/pull_request_template.md | 2 +- .gitignore | 2 +- CONTRIBUTING.md | 2 +- 5 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 .circleci/chart-testing.yaml create mode 100644 .circleci/config.yml diff --git a/.circleci/chart-testing.yaml b/.circleci/chart-testing.yaml new file mode 100644 index 00000000..f9b5e85a --- /dev/null +++ b/.circleci/chart-testing.yaml @@ -0,0 +1,2 @@ +chart-repos: + - argo=https://argoproj.github.io/argo-helm diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..a1b183d9 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,35 @@ +version: 2.1 +jobs: + lint: + docker: + - image: gcr.io/kubernetes-charts-ci/test-image:v3.0.1 + steps: + - checkout + - run: ct lint --config .circleci/chart-testing.yaml + # Technically this only needs to be run on master, but it's good to have it run on every PR + # so that it is regularly tested. + publish: + docker: + # We just need an image with `helm` on it. Handily we know of one already. + - image: gcr.io/kubernetes-charts-ci/test-image:v3.0.1 + steps: + # install the additional keys needed to push to Github. Alex Collins owns these keys. + - add_ssh_keys + - run: git config --global user.email "nobody@circleci.com" + - run: git config --global user.name "Circle CI Build" + - checkout + - run: helm init --client-only + # Only actually publish charts on master. + - run: | + if [ "$CIRCLE_BRANCH" = "master" ]; then + echo 'export GIT_PUSH=true' >> $BASH_ENV + fi + - run: sh ./scripts/publish.sh +workflows: + version: 2 + workflow: + jobs: + - lint + - publish: + requires: + - lint \ No newline at end of file diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index c0058839..08e3b47a 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -3,4 +3,4 @@ Checklist: * [ ] I have update the chart version in `Chart.yaml` following Semantic Versioning. * [ ] Any new values are backwards compatible and/or have sensible default. * [ ] I have followed the testing instructions in the [contributing guide](https://github.com/argoproj/argo-helm/blob/master/CONTRIBUTING.md). -* [ ] I have signed the CLA. +* [ ] I have signed the CLA and the build is green. diff --git a/.gitignore b/.gitignore index 8a77cce9..ad3d67a1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ output .vscode .DS_Store -/*.tgz \ No newline at end of file +*.tgz diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e6370aeb..528deb77 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -51,7 +51,7 @@ argocd app sync guestbook ## Publishing Changes -To push changes use following script: +Changes are automatically publish whenever a commit is merged to master. The CI job (see `.circleci/config.yaml`) runs this: ``` GIT_PUSH=true ./scripts/publish.sh From ed127ea795a064a89cbe5e7c03524cd8ac2db23e Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Thu, 31 Oct 2019 11:28:02 -0700 Subject: [PATCH 2/2] Fix bugs in CI set-up. (#144) --- .circleci/config.yml | 7 +++++-- .github/pull_request_template.md | 3 +++ scripts/publish.sh | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a1b183d9..60db788d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,10 +21,13 @@ jobs: - run: helm init --client-only # Only actually publish charts on master. - run: | + set -x if [ "$CIRCLE_BRANCH" = "master" ]; then - echo 'export GIT_PUSH=true' >> $BASH_ENV + export GIT_PUSH=true + else + export GIT_PUSH=false fi - - run: sh ./scripts/publish.sh + sh ./scripts/publish.sh workflows: version: 2 workflow: diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 08e3b47a..3f860547 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -4,3 +4,6 @@ Checklist: * [ ] Any new values are backwards compatible and/or have sensible default. * [ ] I have followed the testing instructions in the [contributing guide](https://github.com/argoproj/argo-helm/blob/master/CONTRIBUTING.md). * [ ] I have signed the CLA and the build is green. +* [ ] I will test my changes again once merged to master and published. + +Changes are automatically published when merged to `master`. They are not published on branches. \ No newline at end of file diff --git a/scripts/publish.sh b/scripts/publish.sh index 8b943495..40c5e66c 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -2,7 +2,7 @@ set -eux SRCROOT="$(cd "$(dirname "$0")/.." && pwd)" -GIT_PUSH=${GIT_PUSH:-true} +GIT_PUSH=${GIT_PUSH:-false} rm -rf $SRCROOT/output && git clone -b gh-pages git@github.com:argoproj/argo-helm.git $SRCROOT/output