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:
parent
ac108d279c
commit
06d1e7c76e
4 changed files with 63 additions and 24 deletions
|
@ -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:
|
||||
|
@ -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: |
|
||||
|
@ -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..."
|
||||
|
@ -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
|
||||
|
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -17,3 +17,6 @@ license-header.enterprise.txt
|
|||
local/
|
||||
kustomize_test/
|
||||
tools/codegen/boilerplate.go.txt
|
||||
|
||||
.checksum.code
|
||||
.checksum.mod
|
19
Makefile
19
Makefile
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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:
|
||||
|
|
24
scripts/cache.sh
Normal file
24
scripts/cache.sh
Normal 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
|
Loading…
Reference in a new issue