Skip to content

Commit

Permalink
feat: refactor pipeline with new image (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrPsychick authored Apr 20, 2021
1 parent 4f2461b commit 8ebd206
Showing 1 changed file with 5 additions and 66 deletions.
71 changes: 5 additions & 66 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,22 @@
version: 2.1
aliases:
- &chart-testing
- image: quay.io/helmpack/chart-testing
- &docker-dind
- image: docker:dind
- &lint
- checkout
- run:
name: Lint charts
command: |
ct lint --all --debug --chart-dirs=${CHARTS_DIR}
- &docker-dind-kind
- image: drpsychick/dind-buildx-helm-kind:latest
- &deploy
- checkout
- setup_remote_docker:
version: 20.10.2
- run:
name: Install dependencies
# Hint: docker with --volume does not work with remote-docker, so we install `ct`
command: |
apk --no-cache add curl git py3-pip socat
pip3 install --upgrade pip
pip3 install yamllint yamale
curl -sSLo kubectl-${KUBECTL_VERSION} "https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
chmod +x kubectl-${KUBECTL_VERSION}
mv kubectl-${KUBECTL_VERSION} /usr/local/bin/kubectl
mkdir ct
(cd ct;
curl -sSLo ct-${CT_VERSION}.tgz "https://github.com/helm/chart-testing/releases/download/v${CT_VERSION}/chart-testing_${CT_VERSION}_linux_amd64.tar.gz"
tar -xzf ct-${CT_VERSION}.tgz
chmod +x ct
mv -v ct /usr/local/bin/ct
mkdir -p /etc/ct && mv -v etc/* /etc/ct/
cd .. && rm -rf ct
)
- run:
name: Install helm
command: |
curl -sSLo helm-v${HELM_VERSION}.tgz "https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz"
sha256sum helm-v${HELM_VERSION}.tgz |grep "${HELM_CHECKSUM}" || exit 1
tar xvzf helm-v${HELM_VERSION}.tgz
chmod +x linux-amd64/helm
mv linux-amd64/helm /usr/local/bin/helm
- run:
name: Lint charts
command: |
ct lint --all --chart-dirs=${CHARTS_DIR}
ct lint --all --debug --chart-dirs=${CHARTS_DIR}
- run:
name: Package charts
command: |
for chart in $(ls -1d ${CHARTS_DIR}/*); do
helm dep update $chart
helm package $chart
done
- run:
name: Install kind
command: |
curl -sSLo kind-${KIND_VERSION} "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-amd64"
chmod +x kind-${KIND_VERSION}
mv kind-${KIND_VERSION} /usr/local/bin/kind
- run:
name: Create and start kind cluster
command: |
Expand All @@ -71,8 +30,7 @@ aliases:
- role: worker" > kind-config.yaml
kind delete cluster --name "$CLUSTER_NAME" --quiet || true
kind create cluster --name "$CLUSTER_NAME" --kubeconfig $KUBECONFIG \
--config kind-config.yaml --image "kindest/node:$KIND_K8S_VERSION" \
--wait $WAIT_FOR_CONTROLPLANE
--config kind-config.yaml --wait $WAIT_FOR_CONTROLPLANE
# portforward local port (used in config) to control-plane local port (6443)
socat "TCP-LISTEN:6443,reuseaddr,fork" \
EXEC:"'docker exec -i test-charts-control-plane socat STDIO TCP:localhost:6443'" &
Expand All @@ -87,42 +45,23 @@ aliases:
ct install --namespace $NAMESPACE --all --chart-dirs=${CHARTS_DIR} --debug
kind delete cluster --name "$CLUSTER_NAME" --quiet || true
jobs:
lint:
docker: *chart-testing
resource_class: small
environment:
CHARTS_DIR: charts
steps: *lint
deploy:
docker: *docker-dind
docker: *docker-dind-kind
resource_class: small
environment:
CHARTS_DIR: charts
BASH_ENV: /etc/profile
KIND_VERSION: v0.10.0
KIND_K8S_VERSION: v1.20.2@sha256:8f7ea6e7642c0da54f04a7ee10431549c0257315b3a634f6ef2fecaaedb19bab
KIND_KUBECONFIG: test-charts.kubeconfig
CLUSTER_NAME: test-charts
WAIT_FOR_CONTROLPLANE: 60s
NAMESPACE: default
KUBECTL_VERSION: 1.21.0
CT_VERSION: 3.3.1
HELM_VERSION: 3.5.3
HELM_CHECKSUM: 2170a1a644a9e0b863f00c17b761ce33d4323da64fc74562a3a6df2abbf6cd70
steps: *deploy

workflows:
version: 2
chart-test:
jobs:
- lint:
filters:
branches:
ignore:
- gh-pages
- deploy:
requires:
- lint
filters:
branches:
ignore:
Expand Down

0 comments on commit 8ebd206

Please sign in to comment.