Skip to content

Commit

Permalink
Merge pull request gocardless#241 from gocardless/rnaveiras/updates
Browse files Browse the repository at this point in the history
  • Loading branch information
benwh authored Nov 24, 2021
2 parents 0e9a7f2 + 335dc9a commit 296dfc5
Show file tree
Hide file tree
Showing 10 changed files with 16,104 additions and 5,988 deletions.
19 changes: 12 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 2
references:
docker_golang: &docker_golang
docker:
- image: golang:1.14.5
- image: golang:1.17.3
working_directory: /go/src/github.com/gocardless/theatre

jobs:
Expand All @@ -17,7 +17,7 @@ jobs:
command: |
curl -sL https://deb.nodesource.com/setup_10.x > setup-node_10.x
chmod +x setup-node_10.x && ./setup-node_10.x
apt install nodejs
apt install -y nodejs npm
npm install -g prettier
- run:
name: Ensure generated CRDs and manifests are up to date
Expand All @@ -29,15 +29,20 @@ jobs:
- checkout
- run:
name: Ensure no go vet errors
command: go vet ./cmd/rbac-manager/... ./cmd/vault-manager./...
command: |
go vet ./cmd/rbac-manager/...
go vet ./cmd/theatre-consoles/...
go vet ./cmd/theatre-secrets/...
go vet ./cmd/vault-manager/...
go vet ./cmd/workloads-manager/...
unit-integration:
<<: *docker_golang
steps:
- checkout
- run:
name: Install ginkgo test runner
command: go get github.com/onsi/ginkgo/ginkgo
command: go install github.com/onsi/ginkgo/ginkgo@v1.16.5
- run:
name: Install Kubebuilder test helpers
command: |
Expand Down Expand Up @@ -72,11 +77,11 @@ jobs:
name: Install tooling
command: |
sudo bash <<EOF
curl -fsL -o /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/v0.8.1/kind-linux-amd64
curl -fsL https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv3.8.1/kustomize_v3.8.1_linux_amd64.tar.gz \
curl -fsL -o /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/v0.11.1/kind-linux-amd64
curl -fsL https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv4.4.1/kustomize_v4.4.1_linux_amd64.tar.gz \
| tar xfz -
mv -v kustomize /usr/local/bin/kustomize
curl -fsL -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.18.6/bin/linux/amd64/kubectl
curl -fsL -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.22.3/bin/linux/amd64/kubectl
chmod a+x /usr/local/bin/kustomize /usr/local/bin/kubectl /usr/local/bin/kind
EOF
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Build Go binary without cgo dependencies
FROM golang:1.14.5 as builder
FROM golang:1.17.3 as builder
WORKDIR /go/src/github.com/gocardless/theatre

COPY . /go/src/github.com/gocardless/theatre
RUN make VERSION=$(cat VERSION) build

# Use ubuntu as our base package to enable generic system tools
FROM ubuntu:focal-20200720
FROM ubuntu:focal-20211006

# Without these certificates we'll fail to validate TLS connections to Google's
# services.
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ bin/%.darwin_amd64:
bin/%:
CGO_ENABLED=0 GOARCH=amd64 $(BUILD_COMMAND) -o $@ ./cmd/$*/.

# go get -u github.com/onsi/ginkgo/ginkgo
# go install github.com/onsi/ginkgo/ginkgo@v1.16.5
test:
ginkgo -race -r ./...

vet:
go vet ./cmd/rbac-manager/...
go vet ./cmd/vault-manager/...
go vet ./cmd/workload-manager/...
go vet ./cmd/theatre-consoles/...
go vet ./cmd/theatre-secrets/...
go vet ./cmd/vault-manager/...
go vet ./cmd/workloads-manager/...

generate: controller-gen
$(CONTROLLER_GEN) object paths="./apis/rbac/..."
Expand Down Expand Up @@ -77,7 +78,7 @@ ifeq (, $(shell which controller-gen))
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
go mod init tmp ;\
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.5.0 ;\
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.5.0 ;\
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
}
CONTROLLER_GEN=$(GOBIN)/controller-gen
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ all the necessary dependencies:

```shell
brew cask install docker
brew install go kubernetes-cli kustomize
curl -fsL -o /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/v0.8.1/kind-darwin-amd64 \
&& chmod a+x /usr/local/bin/kind
brew install go kubernetes-cli kustomize kind
mkdir /usr/local/kubebuilder
curl -fsL https://go.kubebuilder.io/dl/2.3.1/$(go env GOOS)/$(go env GOARCH) | tar -xvz --strip=1 -C /usr/local/kubebuilder
export KUBEBUILDER_ASSETS=/usr/local/kubebuilder/bin
Expand Down
16 changes: 10 additions & 6 deletions cmd/acceptance/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ var (
clusterName = app.Flag("cluster-name", "Name of Kubernetes context to against").Default("e2e").String()
logger = kitlog.NewLogfmtLogger(os.Stderr)

prepare = app.Command("prepare", "Creates test Kubernetes cluster and other resources")
prepareImage = prepare.Flag("image", "Docker image tag used for exchanging test images").Default("theatre:latest").String()
prepareConfigFile = prepare.Flag("config-file", "Path to Kind config file").Default("kind-e2e.yaml").ExistingFile()
prepareDockerfile = prepare.Flag("dockerfile", "Path to acceptance dockerfile").Default("Dockerfile").ExistingFile()
prepareVerbose = prepare.Flag("verbose", "Use a higher log level when creating the cluster").Short('v').Bool()
prepare = app.Command("prepare", "Creates test Kubernetes cluster and other resources")
prepareImage = prepare.Flag("image", "Docker image tag used for exchanging test images").Default("theatre:latest").String()
prepareConfigFile = prepare.Flag("config-file", "Path to Kind config file").Default("kind-e2e.yaml").ExistingFile()
prepareDockerfile = prepare.Flag("dockerfile", "Path to acceptance dockerfile").Default("Dockerfile").ExistingFile()
prepareKindNodeImage = prepare.Flag("kind-node-image", "Kind Node Image").Default("kindest/node:v1.21.1").String()
prepareVerbose = prepare.Flag("verbose", "Use a higher log level when creating the cluster").Short('v').Bool()

destroy = app.Command("destroy", "Destroys the test Kubernetes cluster and other resources")

Expand Down Expand Up @@ -89,7 +90,10 @@ func main() {
logLevel = 5
}

if err = pipeOutput(exec.CommandContext(ctx, "kind", "create", "cluster", "--name", *clusterName, "--config", *prepareConfigFile, "--image", "kindest/node:v1.16.9", "--verbosity", fmt.Sprintf("%d", logLevel))).Run(); err != nil {
if err = pipeOutput(exec.CommandContext(ctx,
"kind", "create", "cluster", "--name", *clusterName,
"--config", *prepareConfigFile, "--image", *prepareKindNodeImage,
"--verbosity", fmt.Sprintf("%d", logLevel))).Run(); err != nil {
app.Fatalf("failed to create kubernetes cluster with kind: %v", err)
}
}
Expand Down
Loading

0 comments on commit 296dfc5

Please sign in to comment.