Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactor pipeline with new image #12

Merged
merged 1 commit into from
Apr 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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