diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 229a3e54cff..a442781aab5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -83,6 +83,13 @@ jobs: docker tag antrea/antrea-agent-ubuntu:"${DOCKER_TAG}" antrea/antrea-agent-ubuntu-${{ matrix.suffix }}:"${DOCKER_TAG}" docker push antrea/antrea-controller-ubuntu-${{ matrix.suffix }}:"${DOCKER_TAG}" docker push antrea/antrea-agent-ubuntu-${{ matrix.suffix }}:"${DOCKER_TAG}" + # Same repository workflow dispatch to run conformance tests + - name: Run conformance tests + if: ${{ needs.check-env.outputs.push_needed == 'true' }} + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: .github/workflows/conformance.yml + inputs: ${{ format('{{ "antrea-version":"{0}", "antrea-image-distro":"ubuntu", "test-suite":"conformance", "runner":"{1}", "antrea-image-platform":"{2}" }}', github.sha, matrix.runner, matrix.platform) }} push-manifest: needs: [check-env, build] diff --git a/.github/workflows/build_tag.yml b/.github/workflows/build_tag.yml index 53a2de56f29..17d9ba2092e 100644 --- a/.github/workflows/build_tag.yml +++ b/.github/workflows/build_tag.yml @@ -85,14 +85,12 @@ jobs: antrea/antrea-agent-ubuntu-arm:"${DOCKER_TAG}" \ antrea/antrea-agent-ubuntu-amd64:"${DOCKER_TAG}" docker manifest push --purge antrea/antrea-agent-ubuntu:"${DOCKER_TAG}" - - name: Trigger Antrea arm tests + # Same repository workflow dispatch to run conformance tests + - name: Run conformance tests uses: benc-uk/workflow-dispatch@v1 with: - repo: vmware-tanzu/antrea-build-infra - ref: refs/heads/main - workflow: Test Antrea ARM images - token: ${{ secrets.ANTREA_BUILD_INFRA_WORKFLOW_DISPATCH_PAT }} - inputs: ${{ format('{{ "antrea-repository":"antrea-io/antrea", "antrea-ref":"{0}", "docker-tag":"{1}" }}', github.ref, env.DOCKER_TAG) }} + workflow: .github/workflows/conformance.yml + inputs: ${{ format('{{ "antrea-version":"{0}", "antrea-image-distro":"ubuntu", "test-suite":"conformance", "runner":"{1}", "antrea-image-platform":"{2}", "always-upload-logs":true }}', github.ref, matrix.runner, matrix.platform) }} build-ubi: runs-on: [ubuntu-latest] diff --git a/.github/workflows/conformance.yml b/.github/workflows/conformance.yml index b2fe09a8fb2..c5a084eaca1 100644 --- a/.github/workflows/conformance.yml +++ b/.github/workflows/conformance.yml @@ -35,12 +35,24 @@ on: description: Always upload logs regardless of the test result. type: boolean default: false + runner: + description: The Github runner to use for the workflow + default: ubuntu-latest + antrea-image-platform: + description: Platform argument to provide when building the Antrea images + type: choice + options: + - "linux/amd64" + - "linux/arm64" + - "linux/arm/v7" + default: "linux/amd64" + required: true jobs: test: name: Run tests - runs-on: [ubuntu-latest] + runs-on: ${{ inputs.runner }} steps: - name: Free disk space # https://github.com/actions/virtual-environments/issues/709 @@ -70,13 +82,17 @@ jobs: - name: Build Antrea image if required if: ${{ steps.check-release.outputs.released == 'false' }} run: | - ./hack/build-antrea-linux-all.sh --pull --distro ${{ inputs.antrea-image-distro }} - - name: Install Kind + ./hack/build-antrea-linux-all.sh --pull --distro ${{ inputs.antrea-image-distro }} --platform ${{ inputs.antrea-image-platform }} + - name: Get Kind version + id: get_kind_version run: | KIND_VERSION=$(head -n1 ./ci/kind/version || echo v0.23.0) - curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64 - chmod +x ./kind - sudo mv kind /usr/local/bin + echo "kind_version=${KIND_VERSION}" >> $GITHUB_OUTPUT + - name: Install Kind + uses: helm/kind-action@v1 + with: + version: ${{ steps.get_kind_version.outputs.kind_version }} + install_only: true - name: Build local image for conformance test if: ${{ inputs.k8s-version != '' }} run: | diff --git a/docs/maintainers/antrea-docker-image.md b/docs/maintainers/antrea-docker-image.md deleted file mode 100644 index d6ceac6574c..00000000000 --- a/docs/maintainers/antrea-docker-image.md +++ /dev/null @@ -1,44 +0,0 @@ -# Antrea Docker image - -The main Antrea Docker images (`antrea/antrea-agent-ubuntu` and -`antrea/antrea-controller-ubuntu`) are multi-arch images. For example, the -`antrea/antrea-agent-ubuntu` manifest is a list of three manifests: -`antrea/antrea-agent-ubuntu-amd64`, `antrea/antrea-agent-ubuntu-arm64` and -`antrea/antrea-agent-ubuntu-arm`. Of these three manifests, only the first one -is built and uploaded to Dockerhub by Github workflows defined in the -`antrea-io/antrea` repositories. The other two are built and uploaded by Github -workflows defined in a private repository (`vmware-tanzu/antrea-build-infra`), -to which only the project maintainers have access. These workflows are triggered -every time the `main` branch of `antrea-io/antrea` is updated, as well as every -time a new Antrea Github release is created. They build the -`antrea/antrea-agent-ubuntu-arm64` and `antrea/antrea-agent-ubuntu-arm` Docker -images on native arm64 workers, then create the `antrea/antrea-agent-ubuntu` -multi-arch manifest and push it to Dockerhub. The same goes for the controller -images. They are also in charge of testing the images in a -[K3s](https://github.com/k3s-io/k3s) cluster. - -## Why do we use a private repository? - -The `vmware-tanzu/antrea-build-infra` repository uses self-hosted ARM64 workers -provided by the [Open Source Lab](https://osuosl.org/services/aarch64/) at -Oregon State University. These workers enable us to build, and more importantly -*test*, the Antrea Docker images for the arm64 and arm/v7 architectures. Being -able to build Docker images on native ARM platforms is convenient as it is much -faster than emulation. But if we just wanted to build the images, emulation -would probably be good enough. However, testing Kubernetes ARM support using -emulation is no piece of cake. Which is why we prefer to use native ARM64 -workers. - -Github strongly -[recommends](https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners#self-hosted-runner-security-with-public-repositories) -not to use self-hosted runners with public repositories, for security -reasons. It would be too easy for a malicious person to run arbitrary code on -the runners by opening a pull request. Were we to make this repository public, -we would therefore at least need to disable pull requests, which is sub-optimal -for a public repository. We believe Github will address the issue eventually and -provide safeguards to enable using self-hosted runners with public -repositories, at which point we will migrate workflows from this repository to -the main Antrea repository. - -In the future, we may switch over to ARM hosted Github runners provided by the -CNCF.