version: 2.1 orbs: slack: circleci/slack@4.1 parameters: manifests-verify: type: boolean default: false minikube-version: type: string default: v1.31.2 helm-version: type: string default: v3.13.0 executors: golang-executor: docker: - 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: machine: image: ubuntu-2204:current docker_layer_caching: true 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: 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: | if [ -z "$CIRCLE_PULL_REQUEST" ]; then echo "This is not a pull request. Skipping..." exit 0 fi make license-verify license-range-verify - run: make fmt-verify - run: make yamlfmt-verify - run: make linter - run: name: Unit tests command: | if [ -z "$CIRCLE_PULL_REQUEST" ]; then echo "This is not a pull request. Skipping..." exit 0 fi make run-unit-tests - run: name: make bin command: | if [ -z "$CIRCLE_PULL_REQUEST" ]; then echo "This is not a pull request. Skipping..." exit 0 fi 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..." exit 0 fi make vulncheck - run: name: Check that everything what should be generated is commited command: | if [ -z "$CIRCLE_PULL_REQUEST" ]; then echo "This is not a pull request. Skipping..." exit 0 fi make ci-check - save_cache: key: build-code-{{ checksum ".checksum.mod" }} paths: - /tmp/go/cache manifests_verify: executor: machine-executor steps: - checkout - run: name: Install Kubectl Executable command: |- curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && chmod +x kubectl && sudo mv kubectl /usr/local/bin/ mkdir -p ${HOME}/.kube && touch ${HOME}/.kube/config - run: name: Install Minikube Executable command: |- curl -Lo minikube https://github.com/kubernetes/minikube/releases/download/<< pipeline.parameters.minikube-version >>/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/ - run: name: Install Helm Service command: |- export DESIRED_VERSION=<< pipeline.parameters.helm-version >> curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash - run: command: make manifests - run: command: make manifests-verify workflows: version: 2 run_tests: jobs: - check-code manifests-verify: when: equal: [ true, << pipeline.parameters.manifests-verify >> ] jobs: - manifests_verify