Skip to content

Commit

Permalink
Re-write it in Go
Browse files Browse the repository at this point in the history
  • Loading branch information
unguiculus committed Oct 19, 2018
1 parent 4960e30 commit f4130e1
Show file tree
Hide file tree
Showing 46 changed files with 2,543 additions and 1,002 deletions.
45 changes: 40 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,49 @@
version: 2
jobs:
build:
lint:
docker:
- image: koalaman/shellcheck-alpine
steps:
- checkout
- run:
name: lint
command: |
shellcheck -x lib/chartlib.sh
shellcheck -x chart_test.sh
shellcheck -x examples/docker-for-mac/my_test.sh
shellcheck -x examples/gke/my_test.sh
shellcheck -x build.sh
shellcheck -x tag.sh
release:
docker:
- image: golang:1.11.1-alpine3.8
working_directory: /workdir
steps:
- setup_remote_docker
- run:
name: Install tools
command: |
apk add bash build-base ca-certificates curl docker git openssh
curl -SLO https://github.com/goreleaser/goreleaser/releases/download/v0.89.0/goreleaser_Linux_x86_64.tar.gz
mkdir -p /usr/local/goreleaser
tar -xzf goreleaser_Linux_x86_64.tar.gz -C /usr/local/goreleaser
ln -s /usr/local/goreleaser/goreleaser /usr/local/bin/goreleaser
rm -rf goreleaser_Linux_x86_64.tar.gz
- checkout
- run:
name: Checkout tag
command: git gc --aggressive --prune=all && git checkout -b "$CIRCLE_TAG" "$CIRCLE_TAG"
- run:
name: Create release
command: |
go mod download
./build.sh --debug --release
workflows:
version: 2
untagged-build:
jobs:
- lint
tagged-build:
jobs:
- release:
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
6 changes: 2 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
.circleci
.history
.idea
.editorconfig
.gitignore
.git
Dockerfile
.vscode
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ charset = utf-8
[*.{yml,yaml}]
indent_size = 2

[*.go]
indent_style = tab

[Makefile]
indent_style = tab
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.history
.idea
.settings
.project
.classpath
.settings
.vscode
/dist
/config.*
/ct
49 changes: 49 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
project_name: chart-testing
builds:
- main: app/main.go
binary: ct
env:
- CGO_ENABLED=0
goarch:
- amd64
- arm
goos:
- linux
- darwin
- windows
ldflags:
- >-
-X github.com/helm/chart-testing/app/cmd.Version={{ .Tag }}
-X github.com/helm/chart-testing/app/cmd.GitCommit={{ .Commit }}
-X github.com/helm/chart-testing/app/cmd.BuildDate={{ .Date }}
archive:
format_overrides:
- goos: windows
format: zip
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
dockers:
- goos: linux
goarch: amd64
binary: ct
image: quay.io/helmpack/chart-testing
skip_push: false
dockerfile: Dockerfile
tag_templates:
- "{{ .Tag }}"
- latest
build_flag_templates:
- "--build-arg=dist_dir="
- "--label=org.label-schema.schema-version=1.0"
- "--label=org.label-schema.version={{ .Version }}"
- "--label=org.label-schema.name={{ .ProjectName }}"
- "--label=org.label-schema.build-date={{ .Date }}"
- "--label=org.label-schema.description='ct - The chart testing tool'"
- "--label=org.label-schema.vendor=Helm"
extra_files:
- etc/chart_schema.yaml
- etc/lintconf.yaml
50 changes: 13 additions & 37 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,14 @@
# Copyright 2018 The Helm Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM bash:4.4
FROM alpine:3.8

RUN apk --no-cache add \
curl \
git \
jq \
libc6-compat \
openssh-client \
python \
py-crcmod \
py-pip

# Install YQ command line reader
ARG YQ_VERSION=2.5.0
RUN pip install "yq==$YQ_VERSION"

# Install SemVer testing tool
ARG VERT_VERSION=0.1.0
RUN curl -Lo vert "https://github.com/Masterminds/vert/releases/download/v$VERT_VERSION/vert-v$VERT_VERSION-linux-amd64" && \
chmod +x vert && \
mv vert /usr/local/bin/

# Install a YAML Linter
ARG YAML_LINT_VERSION=1.8.1
RUN pip install "yamllint==$YAML_LINT_VERSION"
Expand All @@ -43,22 +18,23 @@ ARG YAMALE_VERSION=1.7.0
RUN pip install "yamale==$YAMALE_VERSION"

# Install kubectl
ARG KUBECTL_VERSION=1.10.2
RUN curl -LO "https://storage.googleapis.com/kubernetes-release/release/v$KUBECTL_VERSION/bin/linux/amd64/kubectl" && \
ARG KUBECTL_VERSION=v1.12.0
RUN curl -LO "https://storage.googleapis.com/kubernetes-release/release/$KUBECTL_VERSION/bin/linux/amd64/kubectl" && \
chmod +x kubectl && \
mv kubectl /usr/local/bin/

# Install Helm
ARG HELM_VERSION=2.10.0
RUN curl -LO "https://kubernetes-helm.storage.googleapis.com/helm-v$HELM_VERSION-linux-amd64.tar.gz" && \
ARG HELM_VERSION=v2.11.0
RUN curl -LO "https://kubernetes-helm.storage.googleapis.com/helm-$HELM_VERSION-linux-amd64.tar.gz" && \
mkdir -p "/usr/local/helm-$HELM_VERSION" && \
tar -xzf "helm-v$HELM_VERSION-linux-amd64.tar.gz" -C "/usr/local/helm-$HELM_VERSION" && \
tar -xzf "helm-$HELM_VERSION-linux-amd64.tar.gz" -C "/usr/local/helm-$HELM_VERSION" && \
ln -s "/usr/local/helm-$HELM_VERSION/linux-amd64/helm" /usr/local/bin/helm && \
rm -f "helm-v$HELM_VERSION-linux-amd64.tar.gz"

COPY etc /testing/etc/
COPY lib /testing/lib/
COPY chart_test.sh /testing/
rm -f "helm-$HELM_VERSION-linux-amd64.tar.gz"

RUN ln -s /testing/chart_test.sh /usr/local/bin/chart_test.sh
# Goreleaser needs to override this because it builds the
# Dockerfile from a tmp dir with all files to be copied in the root
ARG dist_dir=dist/linux_amd64

COPY "$dist_dir/chart_schema.yaml" /etc/ct/chart_schema.yaml
COPY "$dist_dir/lintconf.yaml" /etc/ct/lintconf.yaml
COPY "$dist_dir/ct" /usr/local/bin/ct
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@


.PHONY: build
build:
go build -o ct app/main.go

.PHONY: test
test:
go test ./...

.PHONY: release
release: test
./tag.sh
9 changes: 9 additions & 0 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
approvers:
- lachie83
- prydonius
- viglesiasce
- unguiculus
- scottrigby
- mattfarina
- davidkarlsen
- paulczar
Loading

0 comments on commit f4130e1

Please sign in to comment.