Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 26 additions & 13 deletions .circleci/continue_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ parameters:
executors:
golang-executor:
docker:
- image: 889010145541.dkr.ecr.us-east-1.amazonaws.com/cicd/golang:1.22.5
- image: 889010145541.dkr.ecr.us-east-1.amazonaws.com/cicd/golang:1.22.8
aws_auth:
oidc_role_arn: arn:aws:iam::889010145541:role/circleci-project-dev-kube-arangodb
machine-executor:
Expand All @@ -27,21 +27,31 @@ executors:
jobs:
check-code:
executor: golang-executor
environment:
GOCACHE: "/tmp/go/cache"
GOPATH: "/tmp/go/path"
GO111MODULES: off
KEEP_GOPATH: 1
steps:
- setup_remote_docker:
docker_layer_caching: true
- checkout
- run:
name: Install deps
command: |
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
make vendor
make tools-min
exit 0
fi
apt-get update
apt-get install -y unzip
make init
name: Calculate cache
command: bash ./scripts/cache.sh .
- restore_cache:
keys:
- build-mod-{{ checksum ".checksum.mod" }}
- restore_cache:
keys:
- build-code-{{ checksum ".checksum.mod" }}
- run:
name: Run Vendor
command: make vendor tools-min init
- save_cache:
key: build-mod-{{ checksum ".checksum.mod" }}
paths:
- /tmp/go/path
- run:
name: License check
command: |
Expand Down Expand Up @@ -71,6 +81,7 @@ jobs:
make bin
- run:
name: vulncheck
no_output_timeout: 1.5h
command: |
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
echo "This is not a pull request. Skipping..."
Expand All @@ -85,8 +96,10 @@ jobs:
exit 0
fi
make ci-check
environment:
GO111MODULES: off
- save_cache:
key: build-code-{{ checksum ".checksum.mod" }}
paths:
- /tmp/go/cache

manifests_verify:
executor: machine-executor
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ license-header.enterprise.txt

local/
kustomize_test/
tools/codegen/boilerplate.go.txt
tools/codegen/boilerplate.go.txt

.checksum.code
.checksum.mod
19 changes: 9 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ RELEASE_MODE ?= community

MAIN_DIR := $(ROOT)/pkg/entry/$(RELEASE_MODE)

GOBUILDDIR := $(SCRIPTDIR)/.gobuild
ifndef KEEP_GOPATH
GOBUILDDIR := $(SCRIPTDIR)/.gobuild
GOPATH := $(GOBUILDDIR)
else
GOBUILDDIR := $(GOPATH)
endif

SRCDIR := $(SCRIPTDIR)
CACHEVOL := $(PROJECT)-gocache
BINDIR := $(ROOTDIR)/bin
Expand All @@ -42,10 +48,6 @@ REPOPATH := $(ORGPATH)/$(REPONAME)

include $(ROOT)/$(RELEASE_MODE).mk

ifndef KEEP_GOPATH
GOPATH := $(GOBUILDDIR)
endif

TEST_BUILD ?= 0
GOBUILDARGS ?=
GOBASEVERSION := 1.22.3
Expand Down Expand Up @@ -427,11 +429,8 @@ update-vendor:

.PHONY: update-generated
update-generated:
@rm -fr $(ORGDIR)
@mkdir -p $(ORGDIR)
@ln -s -f $(SCRIPTDIR) $(ORGDIR)/kube-arangodb
@$(SED) -e 's/^/\/\/ /' -e 's/ *$$//' $(ROOTDIR)/tools/codegen/license-header.txt > $(ROOTDIR)/tools/codegen/boilerplate.go.txt
GOPATH=$(GOBUILDDIR) bash "${ROOTDIR}/scripts/codegen.sh" "${ROOTDIR}"
bash "${ROOTDIR}/scripts/codegen.sh" "${ROOTDIR}"

dashboard/assets.go:
cd $(DASHBOARDDIR) && docker build -t $(DASHBOARDBUILDIMAGE) -f Dockerfile.build $(DASHBOARDDIR)
Expand Down Expand Up @@ -792,7 +791,7 @@ tools: tools-min
@GOBIN=$(GOPATH)/bin go install github.com/golang/protobuf/protoc-gen-go@v1.5.2
@GOBIN=$(GOPATH)/bin go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
@echo ">> Fetching govulncheck"
@GOBIN=$(GOPATH)/bin go install golang.org/x/vuln/cmd/govulncheck@v1.0.4
@GOBIN=$(GOPATH)/bin go install golang.org/x/vuln/cmd/govulncheck@v1.1.3

.PHONY: vendor
vendor:
Expand Down
24 changes: 24 additions & 0 deletions scripts/cache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

ROOT=$1

SHA_CODE=$(
find "${ROOT}/" \
'(' -type f -name '*.go' -not -path "${ROOT}/vendor/*" -not -path "${ROOT}/.gobuild/*" -not -path "${ROOT}/deps/*" -exec sha256sum {} \; ')' -o \
'(' -type f -name 'go.sum' -not -path "${ROOT}/vendor/*" -not -path "${ROOT}/.gobuild/*" -not -path "${ROOT}/deps/*" -exec sha256sum {} \; ')' -o \
'(' -type f -name 'go.mod' -not -path "${ROOT}/vendor/*" -not -path "${ROOT}/.gobuild/*" -not -path "${ROOT}/deps/*" -exec sha256sum {} \; ')' \
| cut -d ' ' -f1 | sha256sum | cut -d ' ' -f1
)

SHA_MOD=$(
find "${ROOT}/" \
'(' -type f -name 'go.sum' -not -path "${ROOT}/vendor/*" -not -path "${ROOT}/.gobuild/*" -not -path "${ROOT}/deps/*" -exec sha256sum {} \; ')' -o \
'(' -type f -name 'go.mod' -not -path "${ROOT}/vendor/*" -not -path "${ROOT}/.gobuild/*" -not -path "${ROOT}/deps/*" -exec sha256sum {} \; ')' \
| cut -d ' ' -f1 | sha256sum | cut -d ' ' -f1
)

echo "Checksum Code: ${SHA_CODE}"
echo "Checksum Mod: ${SHA_MOD}"

echo -n "${SHA_CODE}" > ${ROOT}/.checksum.code
echo -n "${SHA_MOD}" > ${ROOT}/.checksum.mod