Skip to content

Commit

Permalink
Use GitHub actions (#250)
Browse files Browse the repository at this point in the history
* use github actions

* add github workflow

* drop slash

* Fix image

* specify dir

* deploy charts to S3

* Update CURRENT_REPO_URL

* rename env

* fix env

* use github.ref instead

* use phony targets

* upgrade build-harness

* handle chart repos

* add tests

* augment tests

* only attempt to publish charts from cloudposse

* update conditional

* change entrypoint

* refactor tests

* deprecate travis
  • Loading branch information
osterman authored Jun 24, 2020
1 parent d3d2d9d commit 9cbf0e6
Show file tree
Hide file tree
Showing 77 changed files with 140 additions and 98 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/charts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Charts
on:
push:
branches:
- master

pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the pull request branch
- name: Checkout Code
uses: actions/checkout@v2

- name: Determine Chart Repo
id: helm_chart
run: |
if [[ ${GITHUB_REF} == 'refs/heads/master' ]]; then
echo "::set-output name=bucket_url::s3://cloudposse-charts/"
echo "::set-output name=repo_url::https://charts.cloudposse.com"
else
echo "::set-output name=bucket_url::s3://cloudposse-dev-charts/${GITHUB_REF}/"
echo "::set-output name=repo_url::https://charts.dev.cloudposse.com/${GITHUB_REF}"
fi
env:
GITHUB_REF: ${{ github.ref }}

- name: Build Chart Packages
uses: "docker://cloudposse/build-harness:0.37.0"
with:
args: "-C incubator all"
env:
HELM_CHART_REPO_URL: ${{ steps.helm_chart.outputs.repo_url }}

- name: Generate Index
uses: "docker://cloudposse/build-harness:0.37.0"
with:
args: "-C packages all"
env:
HELM_CHART_REPO_URL: ${{ steps.helm_chart.outputs.repo_url }}

- name: Publish Charts to Chart Repository
if: success() && github.repository == 'cloudposse/charts'
run: aws s3 sync --acl public-read packages/ ${{ steps.helm_chart.outputs.bucket_url }} --exclude '*' --include '*.tgz' --include '*.yaml'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Test
if: success() && github.repository == 'cloudposse/charts'
uses: "docker://cloudposse/build-harness:0.37.0"
with:
args: "-C test all"
env:
HELM_CHART_REPO_URL: ${{ steps.helm_chart.outputs.repo_url }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.build-harness

# General files for the project
pkg/*
*.pyc
Expand Down Expand Up @@ -41,4 +43,4 @@ Session.vim

build-harness

**/*/*.lock
**/*/*.lock
65 changes: 0 additions & 65 deletions .travis.yml

This file was deleted.

19 changes: 0 additions & 19 deletions Dockerfile

This file was deleted.

24 changes: 11 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
SHELL = /bin/bash
export BUILD_HARNESS_PATH ?= $(shell until [ -d "build-harness" ] || [ "`pwd`" == '/' ]; do cd ..; done; pwd)/build-harness
-include $(BUILD_HARNESS_PATH)/Makefile
-include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness)
build:
docker run -v $(CURDIR)/incubator:/build-harness/incubator -v $(CURDIR)/packages:/build-harness/packages \
-e HELM_CHART_REPO_URL=https://charts.cloudposse.com/incubator \
cloudposse/build-harness:0.36.0 -C incubator all

export PATH:=$(PATH):$(BUILD_HARNESS_PATH)/vendor
index:
docker run -v $(CURDIR)/incubator:/build-harness/incubator -v $(CURDIR)/packages:/build-harness/packages \
-e HELM_CHART_REPO_URL=https://charts.cloudposse.com/incubator \
cloudposse/build-harness:0.36.0 -C packages all

.PHONY : init
## Init build-harness
init::
@curl --retry 5 --retry-delay 1 https://raw.githubusercontent.com/cloudposse/build-harness/master/bin/install.sh | bash

.PHONY : clean
## Clean build-harness
clean::
@rm -rf $(BUILD_HARNESS_PATH)
all: build index
@exit 0
31 changes: 31 additions & 0 deletions incubator/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Helm 3
HELM=helm
STAGE=$(notdir $(CURDIR))
PACKAGES_DIR=../packages/$(STAGE)

CHARTS = $(wildcard */)

all: deps $(wildcard */)

deps:
$(HELM) repo add kubernetes-incubator https://kubernetes-charts-incubator.storage.googleapis.com/
$(HELM) repo add cloudposse-incubator https://charts.cloudposse.com/incubator/
$(HELM) repo add kuberentes-stable https://kubernetes-charts.storage.googleapis.com
$(HELM) repo add kubernetes-stable-alt http://storage.googleapis.com/kubernetes-charts
mkdir -p $(PACKAGES_DIR)

clean:
rm -f *.tgz */requirements.lock
rm -rf */tmpcharts/

.PHONY : $(CHARTS)
$(CHARTS): CHART ?= $(@D)
$(CHARTS): VERSION ?= $(shell yq r $(CHART)/Chart.yaml version)
$(CHARTS): PACKAGE ?= $(CHART)-$(VERSION).tgz
$(CHARTS):
@echo "# Building package for $(CHART) ($(PACKAGE))"
@$(HELM) dependency build --debug $@
@$(HELM) package --debug $@
mv -f $(PACKAGE) $(PACKAGES_DIR)


1 change: 1 addition & 0 deletions incubator/cert-manager/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
apiVersion: v1
name: cert-manager
version: v0.7.0
appVersion: v0.7.0
Expand Down
Empty file modified incubator/exporter-kube-api/Chart.yaml
100755 → 100644
Empty file.
Empty file modified incubator/exporter-kube-api/templates/_helpers.tpl
100755 → 100644
Empty file.
Empty file modified incubator/exporter-kube-api/values.yaml
100755 → 100644
Empty file.
Empty file modified incubator/exporter-kube-etcd/Chart.yaml
100755 → 100644
Empty file.
Empty file modified incubator/exporter-kube-etcd/templates/_helpers.tpl
100755 → 100644
Empty file.
Empty file modified incubator/exporter-kube-etcd/values.yaml
100755 → 100644
Empty file.
Empty file modified incubator/exporter-kubelets/Chart.yaml
100755 → 100644
Empty file.
Empty file modified incubator/exporter-kubelets/templates/_helpers.tpl
100755 → 100644
Empty file.
Empty file modified incubator/exporter-kubelets/values.yaml
100755 → 100644
Empty file.
Empty file modified incubator/exporter-kubernetes/Chart.yaml
100755 → 100644
Empty file.
Empty file modified incubator/exporter-kubernetes/templates/_helpers.tpl
100755 → 100644
Empty file.
Empty file modified incubator/exporter-kubernetes/values.yaml
100755 → 100644
Empty file.
Empty file modified incubator/exporter-node/Chart.yaml
100755 → 100644
Empty file.
Empty file modified incubator/exporter-node/templates/NOTES.txt
100755 → 100644
Empty file.
Empty file modified incubator/exporter-node/templates/_helpers.tpl
100755 → 100644
Empty file.
Empty file modified incubator/exporter-node/templates/deamonset.yaml
100755 → 100644
Empty file.
Empty file modified incubator/exporter-node/templates/service.yaml
100755 → 100644
Empty file.
Empty file modified incubator/exporter-node/values.yaml
100755 → 100644
Empty file.
1 change: 1 addition & 0 deletions incubator/github-authorized-keys/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
apiVersion: v1
description: |-
Use GitHub teams to manage system user accounts and authorized_keys.
WARNING:
Expand Down
1 change: 1 addition & 0 deletions incubator/grafana/Chart.yaml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
apiVersion: v1
name: grafana
version: 0.2.6
description: The leading tool for querying and visualizing time series and metrics.
Expand Down
1 change: 1 addition & 0 deletions incubator/jenkins/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
# It's based largely on the AWESOME WORK of Lachlan Evenson, Vic Iglesias
#
apiVersion: v1
description: A Jenkins Helm chart for Kubernetes
home: https://jenkins.io/
icon: https://wiki.jenkins-ci.org/download/attachments/2916393/logo.png
Expand Down
Empty file modified incubator/kube2iam-kops/Chart.yaml
100755 → 100644
Empty file.
Empty file modified incubator/kube2iam-kops/templates/NOTES.txt
100755 → 100644
Empty file.
Empty file modified incubator/kube2iam-kops/templates/_helpers.tpl
100755 → 100644
Empty file.
Empty file modified incubator/kube2iam-kops/values.yaml
100755 → 100644
Empty file.
Empty file modified incubator/openvpn/Chart.yaml
100755 → 100644
Empty file.
Empty file modified incubator/prometheus-alerts/Chart.yaml
100755 → 100644
Empty file.
Empty file modified incubator/prometheus-alerts/templates/_helpers.tpl
100755 → 100644
Empty file.
Empty file modified incubator/prometheus-alerts/values.yaml
100755 → 100644
Empty file.
Empty file modified incubator/prometheus-operator/templates/_helpers.tpl
100755 → 100644
Empty file.
Empty file modified incubator/prometheus/Chart.yaml
100755 → 100644
Empty file.
Empty file modified incubator/prometheus/README.md
100755 → 100644
Empty file.
Empty file modified incubator/prometheus/templates/NOTES.txt
100755 → 100644
Empty file.
Empty file modified incubator/prometheus/templates/_configmaps.json.tpl
100755 → 100644
Empty file.
Empty file modified incubator/prometheus/templates/_helpers.tpl
100755 → 100644
Empty file.
Empty file modified incubator/prometheus/templates/ingress.yaml
100755 → 100644
Empty file.
Empty file modified incubator/prometheus/templates/prometheus.yaml
100755 → 100644
Empty file.
Empty file modified incubator/prometheus/templates/rules.yaml
100755 → 100644
Empty file.
Empty file modified incubator/prometheus/templates/secret.yaml
100755 → 100644
Empty file.
Empty file modified incubator/prometheus/templates/service.yaml
100755 → 100644
Empty file.
Empty file modified incubator/prometheus/templates/servicemonitors.yaml
100755 → 100644
Empty file.
Empty file modified incubator/prometheus/values.yaml
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-auth/Chart.yaml
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-auth/README.md
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-auth/templates/_helpers.tpl
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-auth/templates/clusterrole.yaml
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-auth/templates/clusterrolebinding.yaml
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-auth/templates/deployment.yaml
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-auth/templates/secret-resources.yaml
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-auth/templates/secret.yaml
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-auth/templates/service.yaml
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-auth/templates/serviceaccount.yaml
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-auth/values.yaml
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-proxy/Chart.yaml
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-proxy/README.md
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-proxy/templates/NOTES.txt
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-proxy/templates/_helpers.tpl
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-proxy/templates/certificate.yaml
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-proxy/templates/clusterrole.yaml
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-proxy/templates/clusterrolebinding.yaml
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-proxy/templates/deployment.yaml
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-proxy/templates/secret.yaml
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-proxy/templates/service.yaml
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-proxy/templates/serviceaccount.yaml
100755 → 100644
Empty file.
Empty file modified incubator/teleport-ent-proxy/values.yaml
100755 → 100644
Empty file.
1 change: 1 addition & 0 deletions incubator/teleport/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
apiVersion: v1
name: teleport
version: 0.0.2
description: Teleport Enterprise
Expand Down
Empty file modified incubator/thumbor/Chart.yaml
100755 → 100644
Empty file.
18 changes: 18 additions & 0 deletions packages/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
HELM ?= helm
CURL ?= curl
HELM_CHART_REPO_URL ?= https://charts.cloudposse.com

%/index.yaml: $(wildcard */*.tgz)
@$(CURL) --fail -s -q $(HELM_CHART_REPO_URL)/$@ -o /tmp/index.yaml; \
if [ $$? -eq 0 ]; then \
echo "## Merging index with $(HELM_CHART_REPO_URL)/$(dir $@)"; \
$(HELM) repo index $(dir $@) --merge /tmp/index.yaml --url $(HELM_CHART_REPO_URL)/$(dir $@) --debug; \
else \
echo "## Generating new index for $(HELM_CHART_REPO_URL)/$(dir $@)"; \
$(HELM) repo index $(dir $@) --url $(HELM_CHART_REPO_URL)/$(dir $@) --debug; \
fi;

incubator/: incubator/index.yaml

all: incubator/index.yaml

1 change: 1 addition & 0 deletions test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.tgz
13 changes: 13 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
all: monochart

# Test incubator repo
monochart: HELM_CHART_REPO_URL ?= https://charts.cloudposse.com
monochart: HELM_CHART_VERSION ?= $(shell yq r ../incubator/monochart/Chart.yaml version)
monochart:
@echo "Testing for monochart $(HELM_CHART_VERSION)..."
helm repo add test-incubator $(HELM_CHART_REPO_URL)/incubator
helm repo update
helm search repo test-incubator/monochart -l -o table --version $(HELM_CHART_VERSION) | grep -qv "No results found"
helm pull test-incubator/monochart --version $(HELM_CHART_VERSION)
@echo "Success!"

0 comments on commit 9cbf0e6

Please sign in to comment.