1
0
Fork 0
mirror of https://github.com/arangodb/kube-arangodb.git synced 2024-12-14 11:57:37 +00:00

[Maintenance] Improvie Pipeline (#1747)

This commit is contained in:
Adam Janikowski 2024-10-18 14:22:24 +02:00 committed by GitHub
parent ac108d279c
commit 06d1e7c76e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 63 additions and 24 deletions

View file

@ -16,7 +16,7 @@ parameters:
executors: executors:
golang-executor: golang-executor:
docker: 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: aws_auth:
oidc_role_arn: arn:aws:iam::889010145541:role/circleci-project-dev-kube-arangodb oidc_role_arn: arn:aws:iam::889010145541:role/circleci-project-dev-kube-arangodb
machine-executor: machine-executor:
@ -27,21 +27,31 @@ executors:
jobs: jobs:
check-code: check-code:
executor: golang-executor executor: golang-executor
environment:
GOCACHE: "/tmp/go/cache"
GOPATH: "/tmp/go/path"
GO111MODULES: off
KEEP_GOPATH: 1
steps: steps:
- setup_remote_docker: - setup_remote_docker:
docker_layer_caching: true docker_layer_caching: true
- checkout - checkout
- run: - run:
name: Install deps name: Calculate cache
command: | command: bash ./scripts/cache.sh .
if [ -z "$CIRCLE_PULL_REQUEST" ]; then - restore_cache:
make vendor keys:
make tools-min - build-mod-{{ checksum ".checksum.mod" }}
exit 0 - restore_cache:
fi keys:
apt-get update - build-code-{{ checksum ".checksum.mod" }}
apt-get install -y unzip - run:
make init name: Run Vendor
command: make vendor tools-min init
- save_cache:
key: build-mod-{{ checksum ".checksum.mod" }}
paths:
- /tmp/go/path
- run: - run:
name: License check name: License check
command: | command: |
@ -71,6 +81,7 @@ jobs:
make bin make bin
- run: - run:
name: vulncheck name: vulncheck
no_output_timeout: 1.5h
command: | command: |
if [ -z "$CIRCLE_PULL_REQUEST" ]; then if [ -z "$CIRCLE_PULL_REQUEST" ]; then
echo "This is not a pull request. Skipping..." echo "This is not a pull request. Skipping..."
@ -85,8 +96,10 @@ jobs:
exit 0 exit 0
fi fi
make ci-check make ci-check
environment: - save_cache:
GO111MODULES: off key: build-code-{{ checksum ".checksum.mod" }}
paths:
- /tmp/go/cache
manifests_verify: manifests_verify:
executor: machine-executor executor: machine-executor

3
.gitignore vendored
View file

@ -17,3 +17,6 @@ license-header.enterprise.txt
local/ local/
kustomize_test/ kustomize_test/
tools/codegen/boilerplate.go.txt tools/codegen/boilerplate.go.txt
.checksum.code
.checksum.mod

View file

@ -25,7 +25,13 @@ RELEASE_MODE ?= community
MAIN_DIR := $(ROOT)/pkg/entry/$(RELEASE_MODE) MAIN_DIR := $(ROOT)/pkg/entry/$(RELEASE_MODE)
ifndef KEEP_GOPATH
GOBUILDDIR := $(SCRIPTDIR)/.gobuild GOBUILDDIR := $(SCRIPTDIR)/.gobuild
GOPATH := $(GOBUILDDIR)
else
GOBUILDDIR := $(GOPATH)
endif
SRCDIR := $(SCRIPTDIR) SRCDIR := $(SCRIPTDIR)
CACHEVOL := $(PROJECT)-gocache CACHEVOL := $(PROJECT)-gocache
BINDIR := $(ROOTDIR)/bin BINDIR := $(ROOTDIR)/bin
@ -42,10 +48,6 @@ REPOPATH := $(ORGPATH)/$(REPONAME)
include $(ROOT)/$(RELEASE_MODE).mk include $(ROOT)/$(RELEASE_MODE).mk
ifndef KEEP_GOPATH
GOPATH := $(GOBUILDDIR)
endif
TEST_BUILD ?= 0 TEST_BUILD ?= 0
GOBUILDARGS ?= GOBUILDARGS ?=
GOBASEVERSION := 1.22.3 GOBASEVERSION := 1.22.3
@ -427,11 +429,8 @@ update-vendor:
.PHONY: update-generated .PHONY: update-generated
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 @$(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: dashboard/assets.go:
cd $(DASHBOARDDIR) && docker build -t $(DASHBOARDBUILDIMAGE) -f Dockerfile.build $(DASHBOARDDIR) cd $(DASHBOARDDIR) && docker build -t $(DASHBOARDBUILDIMAGE) -f Dockerfile.build $(DASHBOARDDIR)
@ -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 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 @GOBIN=$(GOPATH)/bin go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
@echo ">> Fetching govulncheck" @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 .PHONY: vendor
vendor: vendor:

24
scripts/cache.sh Normal file
View file

@ -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