Skip to content

Log Flow Aggregator version on start (#6581) #23

Log Flow Aggregator version on start (#6581)

Log Flow Aggregator version on start (#6581) #23

Workflow file for this run

name: Build and push latest image if needed
on:
pull_request:
branches:
- main
- release-*
- feature/*
push:
branches:
- main
- release-*
- feature/*
jobs:
check-changes:
name: Check whether tests need to be run based on diff
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
show-progress: false
- uses: antrea-io/has-changes@v2
id: check_diff
with:
paths-ignore: docs/* ci/jenkins/* *.md hack/.notableofcontents
outputs:
has_changes: ${{ steps.check_diff.outputs.has_changes }}
build:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' || github.event_name == 'push' }}
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Checking if image needs to be pushed
run: |
if [ ${{ github.repository }} == 'antrea-io/antrea' && ${{ github.event_name }} == 'push' && ${{ github.ref }} == 'refs/heads/main' ]; then
echo "push_needed=true" >> $GITHUB_ENV
echo "docker_driver=docker-container" >> $GITHUB_ENV
else
echo "push_needed=false" >> $GITHUB_ENV
echo "docker_driver=docker" >> $GITHUB_ENV
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: ${{ env.docker_driver }}
- name: Build Antrea amd64 Docker image without pushing to registry
if: ${{ env.push_needed == 'false' }}
run: |
./hack/build-antrea-linux-all.sh --pull
- name: Build and push Antrea amd64 Docker image to registry
if: ${{ env.push_needed == 'true' }}
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
./hack/build-antrea-linux-all.sh --pull --push-base-images
docker tag antrea/antrea-controller-ubuntu:latest antrea/antrea-controller-ubuntu-amd64:latest
docker tag antrea/antrea-agent-ubuntu:latest antrea/antrea-agent-ubuntu-amd64:latest
docker push antrea/antrea-controller-ubuntu-amd64:latest
docker push antrea/antrea-agent-ubuntu-amd64:latest
- name: Trigger Antrea arm builds and multi-arch manifest update
if: ${{ github.repository == 'antrea-io/antrea' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: benc-uk/workflow-dispatch@v1
with:
repo: vmware-tanzu/antrea-build-infra
ref: refs/heads/main
workflow: Build Antrea ARM images and push manifest
token: ${{ secrets.ANTREA_BUILD_INFRA_WORKFLOW_DISPATCH_PAT }}
inputs: ${{ format('{{ "antrea-repository":"antrea-io/antrea", "antrea-ref":"{0}", "docker-tag":"{1}" }}', github.ref, 'latest') }}
build-ubi:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' || github.event_name == 'push' }}
runs-on: [ubuntu-latest]
steps:
- name: Free disk space
# https://github.com/actions/virtual-environments/issues/709
run: |
sudo apt-get clean
df -h
- uses: actions/checkout@v4
with:
show-progress: false
- name: Checking if image needs to be pushed
run: |
if [ ${{ github.repository }} == 'antrea-io/antrea' && ${{ github.event_name }} == 'push' && ${{ github.ref }} == 'refs/heads/main' ]; then
echo "push_needed=true" >> $GITHUB_ENV
echo "docker_driver=docker-container" >> $GITHUB_ENV
else
echo "push_needed=false" >> $GITHUB_ENV
echo "docker_driver=docker" >> $GITHUB_ENV
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: ${{ env.docker_driver }}
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Build Antrea UBI9 Docker image without pushing to registry
if: ${{ env.push_needed == 'false' }}
run: |
./hack/build-antrea-linux-all.sh --pull --distro ubi
- name: Build and push Antrea UBI9 Docker image to registry
if: ${{ env.push_needed == 'true' }}
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
./hack/build-antrea-linux-all.sh --pull --push-base-images --distro ubi
docker push antrea/antrea-agent-ubi:latest
docker push antrea/antrea-controller-ubi:latest
build-scale:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' || github.event_name == 'push' }}
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Build Antrea Agent Simulator Docker image
run: make build-scale-simulator
- name: Push Antrea Agent Simulator Docker image to registry
if: ${{ github.repository == 'antrea-io/antrea' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker push antrea/antrea-ubuntu-simulator:latest
build-windows:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' || github.event_name == 'push' }}
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Build Antrea Windows Docker image
if: ${{ github.repository != 'antrea-io/antrea' || github.event_name != 'push' || github.ref != 'refs/heads/main' }}
run: ./hack/build-antrea-windows-all.sh --pull
- name: Push Antrea Windows Docker image to registry
if: ${{ github.repository == 'antrea-io/antrea' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
./hack/build-antrea-windows-all.sh --pull --push --push-base-images
shell: bash
build-antrea-mc-controller:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' || github.event_name == 'push' }}
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Build antrea-mc-controller Docker image
run: make build-antrea-mc-controller
- name: Push antrea-mc-controller Docker image to registry
if: ${{ github.repository == 'antrea-io/antrea' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker push antrea/antrea-mc-controller:latest
build-flow-aggregator:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' || github.event_name == 'push' }}
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Build flow-aggregator Docker image
run: make flow-aggregator-image
- name: Check flow-aggregator Docker image
run: docker run antrea/flow-aggregator --version
- name: Push flow-aggregator Docker image to registry
if: ${{ github.repository == 'antrea-io/antrea' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker push antrea/flow-aggregator:latest
build-antrea-migrator:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' || github.event_name == 'push' }}
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Build antrea-migrator Docker image
run: make build-migrator
- name: Push antrea-migrator Docker image to registry
if: ${{ github.repository == 'antrea-io/antrea' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker push antrea/antrea-migrator:latest