diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index aebe28b2b38d..000000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,636 +0,0 @@ -version: 2.1 # Adds support for executors, parameterized jobs, etc -orbs: - gh: circleci/github-cli@2.0 -parameters: - # These parameters are not meant to be changed they are more constants for the build change these in mk/dev.mk - go_version: - type: string - default: "1.22.5" - first_k8s_version: - type: string - default: "v1.23.17-k3s1" - last_k8s_version: - type: string - default: "v1.30.0-k3s1" - ubuntu_image: - type: string - default: "ubuntu-2204:2022.10.2" - gh_action_build_artifact_name: - type: string - default: "" - gh_action_run_id: - type: string - default: "" - e2e_param_k8sVersion: - type: string - default: "v1.28.1-k3s1" - e2e_param_arch: - type: string - default: "amd64" - e2e_param_parallelism: - type: integer - default: 1 - e2e_param_target: - type: string - default: "" - e2e_param_cniNetworkPlugin: - type: string - default: flannel -# See https://circleci.com/docs/2.0/configuration-reference/#commands-requires-version-21. -commands: - install_build_tools: - description: "Install an upstream Go release to $HOME/go" - parameters: - go_arch: - type: string - default: amd64 - steps: - - run: - # `unzip` is necessary to install `protoc` - # `gcc` is necessary to run `go test -race` - # `git` is necessary because the CircleCI version is different somehow ¯\_(ツ)_/¯ - # `xz-utils` is necessary to decompress xz files - name: "Install basic tools" - command: | - if [ -r /etc/os-release ]; then source /etc/os-release; fi - case "$ID" in - ubuntu) - if ! command -v sudo 2>&1 >/dev/null; then - apt update - apt install -y sudo - fi - - sudo apt update - sudo env DEBIAN_FRONTEND=noninteractive apt install -y curl git make unzip gcc xz-utils - ;; - esac - - run: - name: "Install Go" - # See https://golang.org/doc/install#tarball - command: | - curl -s --fail --location https://dl.google.com/go/go<>.linux-<>.tar.gz | tar -xz -C $HOME - echo 'export PATH=$HOME/go/bin:$PATH' >> $BASH_ENV - # if GOPATH is not set, `golang-ci` fails with an obscure message - # "ERROR Running error: context loading failed: failed to load program with go/packages: could not determine GOARCH and Go compiler" - echo 'export GOPATH=$HOME/go' >> $BASH_ENV - halt_non_priority_job: - description: "don't run following steps if in PR and doesn't have a specific label" - parameters: - label: - type: string - description: a label to for running this (if empty no label override is allowed) - default: "ci/run-full-matrix" - steps: - - run: - name: maybe-halt - command: | - if [[ "<< pipeline.git.branch >>" == "master" || "<< pipeline.git.branch >>" == "release-"* ]]; then - echo "on a main branch so don't halt job" - exit 0 - fi - if [[ "<< pipeline.git.tag >>" != "" ]]; then - echo "on a tag to don't halt job" - exit 0 - fi - if [[ "<>" != "" && $(${KUMA_DIR}/tools/ci/has_label.sh "<>") == "true" ]]; then - echo "<> label present on PR so don't halt job" - exit 0 - fi - echo "halt running job" - circleci-agent step halt - exit 0 - setenv_depending_on_priority: - description: "don't run following steps if in PR and doesn't have a specific label" - parameters: - label: - type: string - description: a label to for running this (if empty no label override is allowed) - env: - type: string - description: a set of env var to set if it's a priority job - steps: - - run: - name: maybe-add-env - command: | - function add_env() { - echo 'export << parameters.env >>' >> "$BASH_ENV" - exit 0 - } - if [[ "<< pipeline.git.branch >>" == "master" || "<< pipeline.git.branch >>" == "release-"* ]]; then - echo "on a main branch so run everything" - add_env - fi - if [[ "<< pipeline.git.tag >>" != "" ]]; then - echo "on a tag so run everything" - add_env - fi - if [[ "<>" != "" && $(${KUMA_DIR}/tools/ci/has_label.sh "<>") == "true" ]]; then - echo "<> label present on PR so run everything" - add_env - fi - exit 0 - halt_job_if_labeled: - description: "don't run following steps if PR has a specific label" - parameters: - label: - type: string - description: a label to for running this (if empty no label override is allowed) - default: "" - steps: - - run: - name: maybe-halt - command: | - if [[ "<>" != "" && $(${KUMA_DIR}/tools/ci/has_label.sh "<>") == "true" ]]; then - echo "Not running as the PR has label: <>" - circleci-agent step halt - exit 0 - fi - echo "PR doesn't have label <> keep running job" - exit 0 -executors: - golang-amd64: - resource_class: xlarge - docker: - - image: "cimg/go:<< pipeline.parameters.go_version >>" - environment: - KUMA_DIR: . - GO_VERSION: << pipeline.parameters.go_version >> - golang-arm64: - resource_class: arm.xlarge - docker: - - image: "cimg/go:<< pipeline.parameters.go_version >>" - environment: - KUMA_DIR: . - GO_VERSION: << pipeline.parameters.go_version >> - vm-xlarge-amd64: - resource_class: xlarge - machine: - image: << pipeline.parameters.ubuntu_image >> - environment: - KUMA_DIR: . - GO_VERSION: << pipeline.parameters.go_version >> - vm-amd64: - resource_class: large - machine: - image: << pipeline.parameters.ubuntu_image >> - environment: - KUMA_DIR: . - GO_VERSION: << pipeline.parameters.go_version >> - vm-arm64: - resource_class: arm.large - machine: - image: << pipeline.parameters.ubuntu_image >> - environment: - KUMA_DIR: . - GO_VERSION: << pipeline.parameters.go_version >> -jobs: - go_cache: - executor: golang-<< parameters.arch >> - parameters: - arch: - description: the executor to run on - type: string - default: golang - steps: - - checkout - - restore_cache: - key: vm-<< parameters.arch >>_go.mod_{{ checksum "go.sum" }}_{{ checksum "mk/dependencies/deps.lock" }}_{{ checksum ".circleci/config.yml" }} - - run: - command: make dev/tools - - run: - name: "Download Go modules" - command: | - go mod download -x - - save_cache: - key: vm-<< parameters.arch >>_go.mod_{{ checksum "go.sum" }}_{{ checksum "mk/dependencies/deps.lock" }}_{{ checksum ".circleci/config.yml" }} - paths: - - "/home/circleci/go/pkg/mod" - - "/home/circleci/.kuma-dev" - test: - parameters: - target: - description: The test make target. - type: string - default: test - arch: - description: The golang arch. - type: string - default: amd64 - executor: - name: vm-<< parameters.arch >> - steps: - - checkout - - when: - condition: {equal: [arm64, << parameters.arch >>]} - steps: - - halt_non_priority_job - - halt_job_if_labeled: - label: "ci/skip-test" - - install_build_tools: - go_arch: << parameters.arch >> - - restore_cache: - keys: - - vm-<< parameters.arch >>_go.mod_{{ checksum "go.sum" }}_{{ checksum "mk/dependencies/deps.lock" }}_{{ checksum ".circleci/config.yml" }} - - run: - name: "Run tests" - command: | - make << parameters.target >> TEST_REPORTS=1 - - store_artifacts: - path: build/reports - destination: /reports - - store_test_results: - path: build/reports - e2e: - parameters: - k8sVersion: - description: version of k3s to use or "kind" and "kindIpv6" - type: string - default: << pipeline.parameters.last_k8s_version >> - parallelism: - description: level of parallelization - type: integer - default: 1 - target: - description: makefile target without test/e2e prefix - type: string - default: "" - arch: - description: The golang arch - type: string - default: amd64 - cniNetworkPlugin: - description: The CNI networking plugin to use [flannel | calico] - type: string - default: flannel - executor: - name: vm-<< parameters.arch >> - parallelism: << parameters.parallelism >> - steps: - - checkout - - halt_job_if_labeled: - label: "ci/skip-test" - - halt_job_if_labeled: - label: "ci/skip-e2e-test" - - when: - condition: - or: - - {equal: ["", << parameters.target >>]} - - {equal: [calico, << parameters.cniNetworkPlugin >>]} - - {equal: [kindIpv6, << parameters.k8sVersion >>]} - - {equal: [arm64, << parameters.arch >>]} - - {equal: [<< pipeline.parameters.first_k8s_version >>, << parameters.k8sVersion >>]} - steps: - - halt_non_priority_job - - run: - # This works around circleci limitation by skipping tests for combinations that don't make sense - # See: https://discuss.circleci.com/t/matrix-exclude-entire-subset/43879 - name: skip_invalid_parameter_combinations - command: | - echo "Running with: \ - k8s:<< parameters.k8sVersion >> \ - target:<< parameters.target >> \ - parallelism:<< parameters.parallelism >> \ - arch:<< parameters.arch >> \ - cniNetworkPlugin:<< parameters.cniNetworkPlugin >> \ - " - function skip() { - echo "Non valid job combination halting job reason: $1" - circleci-agent step halt - exit 0 - } - - # Handle invalid test combinations - if [[ "<< parameters.k8sVersion >>" == "kind" && "<< parameters.target >>" != "universal" ]]; then - skip "kind should only be used when testing ipv6 or with e2e-universal" - fi - if [[ "<< parameters.k8sVersion >>" != kind* && "<< parameters.target >>" == "universal" ]]; then - skip "universal only runs on kind" - fi - echo "Continuing tests" - - install_build_tools: - go_arch: << parameters.arch >> - - restore_cache: - keys: - - vm-<< parameters.arch >>_go.mod_{{ checksum "go.sum" }}_{{ checksum "mk/dependencies/deps.lock" }}_{{ checksum ".circleci/config.yml" }} - # Mount files from the upstream jobs - - attach_workspace: - at: build - - run: - name: "Setup Helm" - command: | - make dev/set-kuma-helm-repo - - when: # CircleCI's DNS on IPV6 prevents resolving inside Kind. When change to 8.8.8.8 and remove "search" section (. removes it), resolving works again - condition: - equal: [<< parameters.k8sVersion >>, "kindIpv6"] - steps: - - run: - name: Enable IPV6 and change DNS - command: | - cat \<<'EOF' | sudo tee /etc/docker/daemon.json - { - "ipv6": true, - "fixed-cidr-v6": "2001:db8:1::/64", - "dns": ["8.8.8.8"], - "dns-search": ["."] - } - EOF - sudo service docker restart - - run: - name: "Run E2E tests" - command: | - if [[ "<< parameters.k8sVersion >>" == "kindIpv6" ]]; then - export IPV6=true - export K8S_CLUSTER_TOOL=kind - export KUMA_DEFAULT_RETRIES=60 - export KUMA_DEFAULT_TIMEOUT="6s" - fi - if [[ "<< parameters.k8sVersion >>" != "kind"* ]]; then - export CI_K3S_VERSION=<< parameters.k8sVersion >> - export K3D_NETWORK_CNI=<< parameters.cniNetworkPlugin >> - fi - if [[ "<< parameters.arch >>" == "arm64" ]]; then - export MAKE_PARAMETERS="-j1" - else - export MAKE_PARAMETERS="-j2" - fi - - if [[ "<< parameters.target >>" == "" ]]; then - export GINKGO_E2E_LABEL_FILTERS="job-$CIRCLE_NODE_INDEX" - fi - env - if [[ "<< parameters.target >>" != "" ]]; then - target="test/e2e-<< parameters.target >>" - else - target="test/e2e" - fi - make ${MAKE_PARAMETERS} CI=true "${target}" - - store_test_results: - path: build/reports - - store_artifacts: - name: "Store logs" - path: /tmp/e2e - e2e_testing: - parameters: - k8sVersion: - description: version of k3s to use or "kind" and "kindIpv6" - type: string - default: << pipeline.parameters.last_k8s_version >> - parallelism: - description: level of parallelization - type: integer - default: 1 - target: - description: makefile target without test/e2e prefix - type: string - default: "" - arch: - description: The golang arch - type: string - default: amd64 - cniNetworkPlugin: - description: The CNI networking plugin to use [flannel | calico] - type: string - default: flannel - executor: - name: vm-<< parameters.arch >> - parallelism: << parameters.parallelism >> - steps: - - checkout - - install_build_tools: - go_arch: << parameters.arch >> - - run: - command: make dev/tools - - run: - name: "Download Go modules" - command: | - go mod download -x - - run: - name: "Build" - command: | - make build - - run: - name: "Distributions" - command: | - make -j build/distributions - - run: - name: "Images" - command: | - make -j images - make -j docker/save - - run: - name: "Setup Helm" - command: | - make dev/set-kuma-helm-repo - - when: # CircleCI's DNS on IPV6 prevents resolving inside Kind. When change to 8.8.8.8 and remove "search" section (. removes it), resolving works again - condition: - equal: [<< parameters.k8sVersion >>, "kindIpv6"] - steps: - - run: - name: Enable IPV6 and change DNS - command: | - cat \<<'EOF' | sudo tee /etc/docker/daemon.json - { - "ipv6": true, - "fixed-cidr-v6": "2001:db8:1::/64", - "dns": ["8.8.8.8"], - "dns-search": ["."] - } - EOF - sudo service docker restart - - run: - name: "Run E2E tests" - command: | - if [[ "<< parameters.k8sVersion >>" == "kindIpv6" ]]; then - export IPV6=true - export K8S_CLUSTER_TOOL=kind - export KUMA_DEFAULT_RETRIES=60 - export KUMA_DEFAULT_TIMEOUT="6s" - fi - if [[ "<< parameters.k8sVersion >>" != "kind"* ]]; then - export CI_K3S_VERSION=<< parameters.k8sVersion >> - export K3D_NETWORK_CNI=<< parameters.cniNetworkPlugin >> - fi - if [[ "<< parameters.arch >>" == "arm64" ]]; then - export MAKE_PARAMETERS="-j1" - else - export MAKE_PARAMETERS="-j2" - fi - - if [[ "<< parameters.target >>" == "" ]]; then - export GINKGO_E2E_LABEL_FILTERS="job-$CIRCLE_NODE_INDEX" - fi - env - if [[ "<< parameters.target >>" != "" ]]; then - target="test/e2e-<< parameters.target >>" - else - target="test/e2e" - fi - make ${MAKE_PARAMETERS} CI=true "${target}" - build: - executor: vm-xlarge-amd64 - steps: - - run: # required to build arm64 images - command: | - sudo apt-get update - sudo apt-get install -y qemu-user-static binfmt-support - - install_build_tools - - checkout - - setenv_depending_on_priority: - label: "ci/run-full-matrix" - env: ENABLED_GOARCHES="arm64 amd64" ENABLED_GOOSES="linux darwin" - - restore_cache: - keys: - - build_go.mod_{{ checksum "go.sum" }}_{{ checksum "mk/dependencies/deps.lock" }}_{{ checksum ".circleci/config.yml" }} - - run: - command: make dev/tools - - run: - command: make clean - - run: - command: make check - - run: - command: make build - - run: - command: make -j build/distributions - - run: - command: make -j images - - run: - command: make -j docker/save - - save_cache: - key: build_go.mod_{{ checksum "go.sum" }}_{{ checksum "mk/dependencies/deps.lock" }}_{{ checksum ".circleci/config.yml" }} - paths: - - "/home/circleci/go/pkg/mod" - - "/home/circleci/.kuma-dev" - - persist_to_workspace: - root: build - paths: - - distributions/out - - docker - - artifacts-linux-amd64 - - artifacts-linux-arm64 - - ebpf-amd64 - - ebpf-arm64 - distributions: - executor: vm-amd64 - steps: - - install_build_tools - - checkout - - setenv_depending_on_priority: - label: ci/force-publish - env: ALLOW_PUSH=true - - setenv_depending_on_priority: - label: ci/run-full-matrix - env: ENABLED_GOARCHES="arm64 amd64" ENABLED_GOOSES="linux darwin" - # Mount files from the upstream jobs - - restore_cache: - keys: - - vm-amd64_go.mod_{{ checksum "go.sum" }}_{{ checksum "mk/dependencies/deps.lock" }}_{{ checksum ".circleci/config.yml" }} - - attach_workspace: - at: build - - run: - name: inspect created tars - command: for i in build/distributions/out/*.tar.gz; do echo $i; tar -tvf $i; done - - run: - name: Publish distributions to Pulp - command: make publish/pulp - - run: - name: load images - command: make docker/load - - run: - name: publish images - command: | - make docker/login - # ensure we always logout - function on_exit() { - make docker/logout - } - trap on_exit EXIT - make docker/push - make docker/manifest - container-structure: - executor: vm-amd64 - steps: - - checkout - - halt_job_if_labeled: - label: "ci/skip-container-structure-test" - - halt_job_if_labeled: - label: "ci/skip-test" - - setenv_depending_on_priority: - label: "ci/run-full-matrix" - env: ENABLED_GOARCHES="arm64 amd64" - - run: - command: sudo apt-get update; sudo apt-get install -y qemu-user-static binfmt-support - - restore_cache: - key: vm-amd64_go.mod_{{ checksum "go.sum" }}_{{ checksum "mk/dependencies/deps.lock" }}_{{ checksum ".circleci/config.yml" }} - - attach_workspace: - at: build - - run: - command: make test/container-structure -workflows: - version: 2 - kuma-commit: - when: false # Stop running for the moment (likely we'll remove this in the future. - # equal: ["", << pipeline.parameters.gh_action_build_artifact_name >>] - jobs: - - go_cache: - name: go_cache-<< matrix.arch >> - matrix: - alias: go_cache - parameters: - arch: [amd64, arm64] - - build: - name: build - - test: - name: test-<< matrix.arch >> - matrix: - alias: test - parameters: - arch: [amd64, arm64] - requires: [build, go_cache-<< matrix.arch >>] - - e2e: - name: legacy-k8s:<< matrix.arch >>-<< matrix.k8sVersion >> - matrix: - alias: legacy - parameters: - k8sVersion: [<< pipeline.parameters.first_k8s_version >>, << pipeline.parameters.last_k8s_version >>, kind, kindIpv6] - arch: [amd64, arm64] - parallelism: 3 - target: "" - requires: [build, go_cache-<< matrix.arch >>] - - e2e: - name: << matrix.target >>:<< matrix.arch >>-<< matrix.k8sVersion >> - matrix: - alias: e2e - parameters: - k8sVersion: [<< pipeline.parameters.first_k8s_version >>, << pipeline.parameters.last_k8s_version >>, kind, kindIpv6] - target: [kubernetes, universal, multizone] - arch: [amd64, arm64] - requires: [build, go_cache-<< matrix.arch >>] - - e2e: - name: << matrix.target >>:<< matrix.arch >>-<< matrix.k8sVersion >>-calico - matrix: - alias: calico - parameters: - k8sVersion: [<< pipeline.parameters.last_k8s_version >>] - target: [multizone] - arch: [amd64] - cniNetworkPlugin: [calico] - requires: [build, go_cache-amd64] - - container-structure: - name: container-structure - requires: [build] - - distributions: - requires: [test, container-structure] - manual-e2e: - when: - not: - equal: ["", << pipeline.parameters.gh_action_build_artifact_name >>] - jobs: - - e2e_testing: - filters: - tags: - only: /.*/ - k8sVersion: << pipeline.parameters.e2e_param_k8sVersion >> - target: << pipeline.parameters.e2e_param_target >> - arch: << pipeline.parameters.e2e_param_arch >> - cniNetworkPlugin: << pipeline.parameters.e2e_param_cniNetworkPlugin >> - parallelism: << pipeline.parameters.e2e_param_parallelism >> diff --git a/.dockerignore b/.dockerignore index c7a19c02629f..728ac4b37e1f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,3 @@ -.circleci .github .gitignore .gitmodules diff --git a/.github/workflows/_e2e.yaml b/.github/workflows/_e2e.yaml index 653b0162bacd..7caf8717ef9c 100644 --- a/.github/workflows/_e2e.yaml +++ b/.github/workflows/_e2e.yaml @@ -29,42 +29,28 @@ jobs: matrix: parallelRunnerId: ${{ fromJSON((fromJSON(inputs.matrix).parallelism == '4' && '[0, 1, 2, 3]') || '[0]') }} steps: - - name: "Print parameters" - id: eval-params - run: | - RUN_TYPE="" - RUNNER="${{ fromJSON(inputs.runnersByArch)[env.E2E_PARAM_ARCH] }}" - if [[ "$RUNNER" == "circleci" ]]; then - RUN_TYPE="circleci" - elif [[ "$RUNNER" != "" ]]; then - RUN_TYPE="github" - fi - echo "Running with: ${{ toJSON(inputs) }} ${{ toJSON(env) }}" - echo "run-type=$RUN_TYPE">> $GITHUB_OUTPUT - - name: "GitHub Actions: check out code" - if: steps.eval-params.outputs.run-type == 'github' - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: fetch-depth: 0 +<<<<<<< HEAD - name: "GitHub Actions: setup go" if: steps.eval-params.outputs.run-type == 'github' uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 +======= + - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 +>>>>>>> e780588b9 (ci(circleci): cleanup circleci configuration and scripts (#10908)) with: go-version-file: go.mod - - name: "GitHub Actions: set up cache" - if: steps.eval-params.outputs.run-type == 'github' - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: path: | ${{ env.CI_TOOLS_DIR }} key: ${{ runner.os }}-${{ runner.arch }}-devtools-${{ hashFiles('mk/dependencies/deps.lock') }} restore-keys: | ${{ runner.os }}-${{ runner.arch }}-devtools - - if: steps.eval-params.outputs.run-type == 'github' - run: | + - run: | make dev/tools - - name: "Github Actions: Free up disk space for the Runner" - if: steps.eval-params.outputs.run-type == 'github' + - name: "Free up disk space for the Runner" run: | echo "Disk usage before cleanup" sudo df -h @@ -74,25 +60,17 @@ jobs: docker system prune --all -f echo "Disk usage after cleanup" sudo df -h - - name: "Github Actions: build" - if: steps.eval-params.outputs.run-type == 'github' - run: | + - run: | make build - - name: "Github Actions: distributions" - if: steps.eval-params.outputs.run-type == 'github' - run: | + - run: | make -j build/distributions - - name: "Github Actions: images" - if: steps.eval-params.outputs.run-type == 'github' - run: | + - run: | make -j images make -j docker/save - - name: "GitHub Actions: setup helm" - if: steps.eval-params.outputs.run-type == 'github' - run: | + - run: | make dev/set-kuma-helm-repo - - name: "GitHub Actions: enable ipv6 for docker" - if: ${{ steps.eval-params.outputs.run-type == 'github' && env.E2E_PARAM_K8S_VERSION == 'kindIpv6' }} + - name: "Enable ipv6 for docker" + if: ${{ env.E2E_PARAM_K8S_VERSION == 'kindIpv6' }} run: | cat <<'EOF' | sudo tee /etc/docker/daemon.json { @@ -103,8 +81,7 @@ jobs: } EOF sudo service docker restart - - name: "GitHub Actions: run E2E tests" - if: steps.eval-params.outputs.run-type == 'github' + - name: "Run E2E tests" run: | if [[ "${{ env.E2E_PARAM_K8S_VERSION }}" == "kindIpv6" ]]; then export IPV6=true @@ -147,191 +124,3 @@ jobs: path: | /tmp/e2e-debug/ retention-days: ${{ github.event_name == 'pull_request' && 1 || 30 }} - - name: "CircleCI: make circleci parameters" - if: steps.eval-params.outputs.run-type == 'circleci' - id: circleci-gen-params - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - with: - script: | - let circleCIParams = { - 'gh_action_build_artifact_name': 'build-output', - 'gh_action_run_id': '${{ github.run_id }}' - }; - let inputs = JSON.parse(${{ toJSON(inputs.matrix) }}); - Object.keys(inputs).forEach(function(key) { - circleCIParams[`e2e_param_${key}`] = inputs[key]; - }); - let circleCIBody = { - "parameters": circleCIParams, - }; - - if ( "${{ github.event_name }}" == "pull_request" ) { - circleCIBody["branch"] = 'pull/${{ github.event.pull_request.number }}/merge'; - } else { - circleCIBody["tag"] = '${{ github.sha }}' - } - - core.info(`created request object for circleCI ${JSON.stringify(circleCIBody)}`); - return circleCIBody - - name: "CircleCI: trigger a new pipeline workflow on CircleCI" - if: steps.eval-params.outputs.run-type == 'circleci' - id: circle-ci-trigger - run: | - # Trigger CircleCI manually, reference: https://github.com/CircleCI-Public/trigger-circleci-pipeline-action/blob/main/src/lib/CircleCIPipelineTrigger.ts#L82 - set -e - if [ "${{ runner.debug }}" == "1" ]; then - set -x - fi - - CIRCLE_CI_API_PATH=https://circleci.com/api/v2/project/gh/${{ github.repository }}/pipeline - echo "Calling CircleCI api with parameters: - URL: $CIRCLE_CI_API_PATH - BODY: ${{ steps.circleci-gen-params.outputs.result }}" - - if [ "${{ secrets.CIRCLECI_TOKEN }}" == "" ]; then - echo "Skipping request CircleCI because secret 'CIRCLECI_TOKEN' not set." - exit 0 - fi - - function request(){ - METHOD=$1 - URL=$2 - DATA=$3 - - if [ "$DATA" != "" ]; then - DATA="--data $DATA" - fi - - OUTPUT_FILE=/tmp/circleci-response-$RANDOM.json - touch $OUTPUT_FILE - STATUS_CODE= - while [[ "$STATUS_CODE" == "" ]]; do - STATUS_CODE=$(curl -o $OUTPUT_FILE -sL -w "%{http_code}" -X $METHOD $URL \ - --header "content-type: application/json" --header "accept: application/json" \ - --header "x-attribution-login: ${{ github.actor }}" --header "x-attribution-actor-id: ${{ github.actor }}" \ - --header "Circle-Token: ${{ secrets.CIRCLECI_TOKEN }}" $DATA ) - - if [[ "$STATUS_CODE" == "429" ]]; then - STATUS_CODE= - echo '' > $OUTPUT_FILE - sleep $((RANDOM % 3)) - fi - done - - if [ $STATUS_CODE -lt 200 ] || [ $STATUS_CODE -gt 399 ] ; then - echo "Error requesting $METHOD $URL (status $STATUS_CODE)" - cat $OUTPUT_FILE - fi - cat $OUTPUT_FILE - rm $OUTPUT_FILE - } - - PIPELINE_ID=$(request POST $CIRCLE_CI_API_PATH '${{ steps.circleci-gen-params.outputs.result }}' | tr '\n' ' ' | jq -Rrc 'fromjson | .id') - sleep 3 - WORKFLOW_DETAILS=$(request GET https://circleci.com/api/v2/pipeline/$PIPELINE_ID/workflow | tr '\n' ' ' | jq -Rrc 'fromjson | .items[] | select(.name == "manual-e2e")') - PIPELINE_NUMBER=$(echo $WORKFLOW_DETAILS | tr '\n' ' ' | jq -Rrc 'fromjson | .pipeline_number') - WORKFLOW_ID=$(echo $WORKFLOW_DETAILS | tr '\n' ' ' | jq -Rrc 'fromjson | .id') - - echo "pipeline_number=$PIPELINE_NUMBER" >> $GITHUB_OUTPUT - echo "workflow_id=$WORKFLOW_ID" >> $GITHUB_OUTPUT - - if [[ "$WORKFLOW_ID" == "" ]]; then - echo "Could not trigger a workflow on CircleCI, check your .circleci/config.yaml" - exit 1 - fi - - echo '' - echo "CircleCI pipeline triggered successfully, pipeline id: $PIPELINE_ID" - echo "Check CircleCI workflow details at: https://app.circleci.com/pipelines/gh/${{ github.repository }}/$PIPELINE_NUMBER/workflows/$WORKFLOW_ID" - - name: "CircleCI: check run status of pipeline workflow on CircleCI" - if: ${{ steps.eval-params.outputs.run-type == 'circleci' && steps.circle-ci-trigger.outputs.workflow_id != '' }} - run: | - set -e - if [ "${{ runner.debug }}" == "1" ]; then - set -x - fi - - function request(){ - METHOD=$1 - URL=$2 - DATA=$3 - - if [ "$DATA" != "" ]; then - DATA="--data $DATA" - fi - - OUTPUT_FILE=/tmp/circleci-response-$RANDOM.json - touch $OUTPUT_FILE - STATUS_CODE=$(curl -o $OUTPUT_FILE -sL -w "%{http_code}" -X $METHOD $URL \ - --header "content-type: application/json" --header "accept: application/json" \ - --header "x-attribution-login: ${{ github.actor }}" --header "x-attribution-actor-id: ${{ github.actor }}" \ - --header "Circle-Token: ${{ secrets.CIRCLECI_TOKEN }}" $DATA ) - - if [ "$STATUS_CODE" == "429" ]; then - # we are exceeding rate limit, try again later - echo '{"status": ""}' - return - fi - if [ $STATUS_CODE -lt 200 ] || [ $STATUS_CODE -gt 399 ] ; then - echo "Error requesting $METHOD $URL (status $STATUS_CODE)" - cat $OUTPUT_FILE - fi - cat $OUTPUT_FILE - rm $OUTPUT_FILE - } - - function check_workflow(){ - WORKFLOW_ID=$1 - STATUS='' - # status could be "success" "running" "not_run" "failed" "error" "failing" "on_hold" "canceled" "unauthorized" - # statuses to continue: "running" "on_hold" - # status completed: "success" "not_run" "failed" "error" "failing" "canceled" "unauthorized" - while [[ "$STATUS" == "" ]] || [[ "$STATUS" == "running" ]] || [[ "$STATUS" == "on_hold" ]]; do - sleep $((RANDOM % 5 + 25)) - STATUS=$(request GET https://circleci.com/api/v2/workflow/$WORKFLOW_ID | tr '\n' ' ' | jq -Rrc 'fromjson | .status') - echo -n . - done - - echo '' - if [[ "$STATUS" == "success" ]]; then - echo "CircleCI workflow has completed successfully." - exit 0 - else - echo "CircleCI workflow has completed with status: '$STATUS'." - exit 1 - fi - } - - PIPELINE_NUMBER='${{ steps.circle-ci-trigger.outputs.pipeline_number }}' - WORKFLOW_ID='${{ steps.circle-ci-trigger.outputs.workflow_id }}' - echo "Check CircleCI workflow details at: https://app.circleci.com/pipelines/gh/${{ github.repository }}/$PIPELINE_NUMBER/workflows/$WORKFLOW_ID" - echo "Tracking workflow status:" - check_workflow '${{ steps.circle-ci-trigger.outputs.workflow_id }}' - - name: "CircleCI: cancel CircleCI running if requested" - if: ${{ steps.eval-params.outputs.run-type == 'circleci' && cancelled() && steps.circle-ci-trigger.outputs.workflow_id != '' }} - run: | - set -e - if [ "${{ runner.debug }}" == "1" ]; then - set -x - fi - - function request(){ - METHOD=$1 - URL=$2 - DATA=$3 - - if [ "$DATA" != "" ]; then - DATA="--data $DATA" - fi - - OUTPUT_FILE=/tmp/circleci-response-$RANDOM.json - STATUS_CODE=$(curl -o $OUTPUT_FILE -sL -w "%{http_code}" -X $METHOD $URL \ - --header "content-type: application/json" --header "accept: application/json" \ - --header "x-attribution-login: ${{ github.actor }}" --header "x-attribution-actor-id: ${{ github.actor }}" \ - --header "Circle-Token: ${{ secrets.CIRCLECI_TOKEN }}" $DATA ) - - cat $OUTPUT_FILE - rm $OUTPUT_FILE - } - - request POST https://circleci.com/api/v2/workflow/${{ steps.circle-ci-trigger.outputs.workflow_id }}/cancel diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 5919d23e6205..8c95f57de077 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -37,7 +37,7 @@ jobs: if: github.event.action == 'synchronize' && false # disable until https://github.com/kumahq/kuma/issues/9482 env: GITHUB_TOKEN: ${{ github.token }} - PREDEFINED_GLOBS: ".github/**/*,.circleci/**/*,Makefile,mk/**/*,tools/**/*,.golangci.yml,.kube-linter.yaml" + PREDEFINED_GLOBS: ".github/**/*,Makefile,mk/**/*,tools/**/*,.golangci.yml,.kube-linter.yaml" LABEL_TO_ADD: backport NO_BACKPORT_AUTOLABEL: no-backport-autolabel run: | diff --git a/README.md b/README.md index 71670e99d74b..41d067662a6f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ **Builds** -[![CircleCI master](https://img.shields.io/circleci/build/github/kumahq/kuma/master?label=master)](https://circleci.com/gh/kumahq/kuma/tree/master) +![GitHub Actions master](https://github.com/kumahq/kuma/actions/workflows/build-test-distribute.yaml/badge.svg?branch=master) **Code quality** diff --git a/mk/check.mk b/mk/check.mk index 5b2b2e8085b9..c17dac1b3272 100644 --- a/mk/check.mk +++ b/mk/check.mk @@ -32,7 +32,6 @@ golangci-lint-fmt: .PHONY: fmt/ci fmt/ci: - $(YQ) -i '.parameters.go_version.default = "$(GO_VERSION)" | .parameters.first_k8s_version.default = "$(K8S_MIN_VERSION)" | .parameters.last_k8s_version.default = "$(K8S_MAX_VERSION)"' .circleci/config.yml $(YQ) -i '.env.K8S_MIN_VERSION = "$(K8S_MIN_VERSION)" | .env.K8S_MAX_VERSION = "$(K8S_MAX_VERSION)"' .github/workflows/"$(ACTION_PREFIX)"_test.yaml grep -r "golangci/golangci-lint-action" .github/workflows --include \*ml | cut -d ':' -f 1 | xargs -n 1 $(YQ) -i '(.jobs.* | select(. | has("steps")) | .steps[] | select(.uses == "golangci/golangci-lint-action*") | .with.version) |= "$(GOLANGCI_LINT_VERSION)"' diff --git a/test/e2e/README.md b/test/e2e/README.md index ec879bd1dd6b..552351e447d0 100644 --- a/test/e2e/README.md +++ b/test/e2e/README.md @@ -7,8 +7,8 @@ Executing those tests is very expensive, it is the longest job on the CI. Adding the tests here potentially slows down the velocity of all contributors. Please consider writing the test in `e2e_env` directory instead, where all the tests are parallelized on one Kuma deployment. -On CircleCI, all the tests are parallelized into multiple VMs. You can control on which VM the test will run using `job-X` label. -All the tests requires `job-X` label, otherwise CircleCI won't run them. +All the tests are parallelized into multiple VMs. You can control on which VM the test will run using `job-X` label. +All the tests require `job-X` label, otherwise they won't be run. ## Reasons to write the test in this package over `e2e_env` diff --git a/tools/ci/update-vulnerable-dependencies/update-vulnerable-dependencies.sh b/tools/ci/update-vulnerable-dependencies/update-vulnerable-dependencies.sh index fd02f9442f50..9453c3bc2855 100755 --- a/tools/ci/update-vulnerable-dependencies/update-vulnerable-dependencies.sh +++ b/tools/ci/update-vulnerable-dependencies/update-vulnerable-dependencies.sh @@ -22,7 +22,6 @@ for dep in $(osv-scanner "$OSV_SCANNER_ADDITIONAL_OPTS" --lockfile=go.mod --json echo "Updating $package to $fixVersion" if [[ "$package" == "stdlib" ]]; then - yq -i e ".parameters.go_version.default = \"$fixVersion\"" .circleci/config.yml go mod edit -go="$fixVersion" else go get -u "$package"@v"$fixVersion"