Skip to content

Commit

Permalink
Update build, dependencies, Go and tool versions
Browse files Browse the repository at this point in the history
* Use current CircleCI build image for Golang
* Update tools in Docker image
* Add image labels for installed tool versions
* Update labels from deprecated label schema to OCI spec
* Configure build tools in go.mod/tools.go
* Improve Go linting

Signed-off-by: Reinhard Naegele <[email protected]>
  • Loading branch information
unguiculus committed Mar 28, 2020
1 parent d961652 commit c5da275
Show file tree
Hide file tree
Showing 12 changed files with 553 additions and 80 deletions.
35 changes: 16 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ jobs:
name: lint
command: |
shellcheck -x build.sh
shellcheck -x tag.sh
shellcheck -x e2e-kind.sh
shellcheck -x tag.sh
shellcheck -x setup.sh
test:
machine:
enabled: true
Expand All @@ -20,17 +21,17 @@ jobs:
- run:
name: Install tools
command: |
# We need to install Golang 1.13 because the CircleCI machine image has an outdated version.
# We need to install Golang 1.14 because the CircleCI machine image has an outdated version.
# We need to use a CircleCI machine in order to be able to run kind.
curl -sSLO https://dl.google.com/go/go1.13.8.linux-amd64.tar.gz
curl -fsSLo go.tar.gz https://dl.google.com/go/go1.14.1.linux-amd64.tar.gz
sudo rm -r /usr/local/go
sudo tar -C /usr/local -xzf go1.13.8.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go.tar.gz
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
helm_version=v3.1.1
helm_version=v3.1.2
curl -sSLO "https://get.helm.sh/helm-$helm_version-linux-amd64.tar.gz"
sudo mkdir -p "/usr/local/helm-$helm_version"
sudo tar -xzf "helm-$helm_version-linux-amd64.tar.gz" -C "/usr/local/helm-$helm_version"
Expand All @@ -45,29 +46,25 @@ jobs:
./e2e-kind.sh
build:
docker:
- image: golang:1.13-alpine3.10
- image: cimg/go:1.14
steps:
- setup_remote_docker
- checkout
- 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.120.5/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
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- checkout
command: ./setup.sh
- run:
name: gofmt
name: lint
command: |
gofmt -w -s . && git diff --exit-code
go vet -v ./...
goimports -w -l .
go mod tidy
git diff --exit-code
- run:
name: Build
command: |
set -e
set -u
set -o nounset
set -o pipefail
if [[ -z "${CIRCLE_TAG:-}" ]]; then
echo "Building snapshot..."
Expand Down
15 changes: 9 additions & 6 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,15 @@ dockers:
- quay.io/helmpack/chart-testing:{{ .Tag }}
- quay.io/helmpack/chart-testing:latest
build_flag_templates:
- --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
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.revision={{ .Commit }}
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.created={{ .Date }}
- --label=org.opencontainers.image.description=ct - The chart testing tool
- --label=org.opencontainers.image.vendor=Helm
- --label=org.opencontainers.image.licenses=Apache-2.0
- --label=org.opencontainers.image.source=https://github.com/helm/chart-testing
- --label=org.opencontainers.image.authors=The Helm Authors
extra_files:
- etc/chart_schema.yaml
- etc/lintconf.yaml
28 changes: 16 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,30 @@ RUN apk --no-cache add \
pip install --upgrade pip==18.1

# Install a YAML Linter
ARG YAML_LINT_VERSION=1.13.0
RUN pip install "yamllint==$YAML_LINT_VERSION"
ARG yamllint_version=1.21.0
LABEL yamllint_version=$yamllint_version
RUN pip install "yamllint==$yamllint_version"

# Install Yamale YAML schema validator
ARG YAMALE_VERSION=1.8.0
RUN pip install "yamale==$YAMALE_VERSION"
ARG yamale_version=2.0.1
LABEL yamale_version=$yamale_version
RUN pip install "yamale==$yamale_version"

# Install kubectl
ARG KUBECTL_VERSION=v1.16.2
RUN curl -LO "https://storage.googleapis.com/kubernetes-release/release/$KUBECTL_VERSION/bin/linux/amd64/kubectl" && \
ARG kubectl_version=v1.18.0
LABEL kubectl_version=$kubectl_version
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=v3.1.1
RUN curl -LO "https://get.helm.sh/helm-$HELM_VERSION-linux-amd64.tar.gz" && \
mkdir -p "/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-$HELM_VERSION-linux-amd64.tar.gz"
ARG helm_version=v3.1.2
LABEL helm_version=$helm_version
RUN curl -LO "https://get.helm.sh/helm-$helm_version-linux-amd64.tar.gz" && \
mkdir -p "/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-$helm_version-linux-amd64.tar.gz"

COPY ./etc/chart_schema.yaml /etc/ct/chart_schema.yaml
COPY ./etc/lintconf.yaml /etc/ct/lintconf.yaml
Expand Down
1 change: 1 addition & 0 deletions ct/cmd/docGen.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package cmd

import (
"fmt"

"github.com/MakeNowJust/heredoc"
"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
Expand Down
1 change: 1 addition & 0 deletions ct/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package cmd

import (
"fmt"

"github.com/MakeNowJust/heredoc"
"github.com/helm/chart-testing/v3/pkg/chart"
"github.com/helm/chart-testing/v3/pkg/config"
Expand Down
1 change: 1 addition & 0 deletions ct/cmd/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package cmd

import (
"fmt"

"github.com/MakeNowJust/heredoc"
"github.com/helm/chart-testing/v3/pkg/chart"
"github.com/helm/chart-testing/v3/pkg/config"
Expand Down
1 change: 1 addition & 0 deletions ct/cmd/lintAndInstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package cmd

import (
"fmt"

"github.com/helm/chart-testing/v3/pkg/chart"
"github.com/helm/chart-testing/v3/pkg/config"

Expand Down
1 change: 1 addition & 0 deletions ct/cmd/listChanged.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package cmd

import (
"fmt"

"github.com/MakeNowJust/heredoc"

"github.com/helm/chart-testing/v3/pkg/chart"
Expand Down
40 changes: 21 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
module github.com/helm/chart-testing/v3

go 1.13
go 1.14

require (
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/MakeNowJust/heredoc v0.0.0-20171113091838-e9091a26100e
github.com/Masterminds/semver v1.4.2
github.com/cpuguy83/go-md2man v1.0.8 // indirect
github.com/MakeNowJust/heredoc v1.0.0
github.com/Masterminds/semver v1.5.0
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/goreleaser/goreleaser v0.129.0
github.com/hashicorp/go-multierror v1.0.0
github.com/hashicorp/go-retryablehttp v0.5.2
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/mitchellh/go-homedir v1.0.0
github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/pkg/errors v0.8.0
github.com/russross/blackfriday v1.5.2 // indirect
github.com/spf13/cast v1.3.0 // indirect
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3
github.com/spf13/viper v1.2.1
github.com/stretchr/objx v0.1.1 // indirect
github.com/stretchr/testify v1.4.0
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 // indirect
gopkg.in/yaml.v2 v2.2.2
github.com/hashicorp/go-retryablehttp v0.6.4
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/mapstructure v1.2.2 // indirect
github.com/pelletier/go-toml v1.6.0 // indirect
github.com/pkg/errors v0.9.1
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/cobra v0.0.7
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.6.2
github.com/stretchr/testify v1.5.1
golang.org/x/sys v0.0.0-20200327173247-9dae0f8f5775 // indirect
golang.org/x/tools v0.0.0-20200328031815-3db5fc6bac03
gopkg.in/ini.v1 v1.55.0 // indirect
gopkg.in/yaml.v2 v2.2.8
)
Loading

0 comments on commit c5da275

Please sign in to comment.