Skip to content

Commit

Permalink
Add release assets needed for running Antrea on VMs (ExternalNode)
Browse files Browse the repository at this point in the history
* antrea-agent binaries for Linux
* install-vm.sh and install-vm.ps1

Fixes #4247

Signed-off-by: Antonin Bas <[email protected]>
  • Loading branch information
antoninbas committed Oct 12, 2022
1 parent ac70351 commit 66df561
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 14 deletions.
49 changes: 47 additions & 2 deletions .github/workflows/process_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,40 @@ jobs:
asset_path: ./assets/antrea-multicluster-member.yml
asset_name: antrea-multicluster-member.yml
asset_content_type: application/octet-stream
- name: Upload antrea-agent-linux-x86_64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./assets/antrea-agent-linux-x86_64
asset_name: antrea-agent-linux-x86_64
asset_content_type: application/octet-stream
- name: Upload antrea-agent-linux-arm64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./assets/antrea-agent-linux-arm64
asset_name: antrea-agent-linux-arm64
asset_content_type: application/octet-stream
- name: Upload antrea-agent-linux-arm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./assets/antrea-agent-linux-arm
asset_name: antrea-agent-linux-arm
asset_content_type: application/octet-stream
- name: Upload antrea-agent-windows-x86_64.exe
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./assets/antrea-agent.exe
asset_path: ./assets/antrea-agent-windows-x86_64.exe
asset_name: antrea-agent-windows-x86_64.exe
asset_content_type: application/octet-stream
- name: Upload antrea-cni-windows-x86_64.exe
Expand All @@ -233,7 +260,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./assets/antrea-cni.exe
asset_path: ./assets/antrea-cni-windows-x86_64.exe
asset_name: antrea-cni-windows-x86_64.exe
asset_content_type: application/octet-stream
- name: Upload Start-AntreaAgent.ps1
Expand Down Expand Up @@ -263,6 +290,24 @@ jobs:
asset_path: ./assets/flow-aggregator-chart.tgz
asset_name: flow-aggregator-chart.tgz
asset_content_type: application/octet-stream
- name: Upload install-vm.sh
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./assets/install-vm.sh
asset_name: install-vm.sh
asset_content_type: application/octet-stream
- name: Upload install-vm.ps1
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./assets/install-vm.ps1
asset_name: install-vm.ps1
asset_content_type: application/octet-stream

update-website:
name: Trigger website update for release
Expand Down
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ antrea-agent:
@mkdir -p $(BINDIR)
GOOS=linux $(GO) build -o $(BINDIR) $(GOFLAGS) -ldflags '$(LDFLAGS)' antrea.io/antrea/cmd/antrea-agent

.PHONY: antrea-agent-release
antrea-agent-release:
@mkdir -p $(BINDIR)
@CGO_ENABLED=0 $(GO) build -o $(BINDIR)/$(ANTREA_AGENT_BINARY_NAME) $(GOFLAGS) -ldflags '$(LDFLAGS)' antrea.io/antrea/cmd/antrea-agent

.PHONY: antrea-agent-simulator
antrea-agent-simulator:
@mkdir -p $(BINDIR)
Expand Down Expand Up @@ -85,14 +90,18 @@ antrea-cni:
@mkdir -p $(BINDIR)
GOOS=linux CGO_ENABLED=0 $(GO) build -o $(BINDIR) $(GOFLAGS) -ldflags '$(LDFLAGS)' antrea.io/antrea/cmd/antrea-cni

.PHONY: antrea-cni
antrea-cni-release:
@mkdir -p $(BINDIR)
@CGO_ENABLED=0 $(GO) build -o $(BINDIR)/$(ANTREA_CNI_BINARY_NAME) $(GOFLAGS) -ldflags '$(LDFLAGS)' antrea.io/antrea/cmd/antrea-cni

.PHONY: antctl-instr-binary
antctl-instr-binary:
@mkdir -p $(BINDIR)
GOOS=linux $(GO) test -tags testbincover -covermode count -coverpkg=antrea.io/antrea/pkg/... -c -o $(BINDIR)/antctl-coverage $(GOFLAGS) -ldflags '$(LDFLAGS)' antrea.io/antrea/cmd/antctl

# diable cgo for antrea-cni and antrea-agent: antrea-cni is meant to be
# installed on the host and the antrea-agent is run as a process on Windows
# hosts (we also distribute it as a release binary).
# installed on the host and the antrea-agent is run as a process on Windows.
.PHONY: windows-bin
windows-bin:
@mkdir -p $(BINDIR)
Expand Down Expand Up @@ -206,7 +215,7 @@ antctl: $(ANTCTL_BINARIES)

.PHONY: antctl-release
antctl-release:
@$(GO) build -o $(BINDIR)/$(ANTCTL_BINARY_NAME) $(GOFLAGS) -ldflags '-s -w $(LDFLAGS)' antrea.io/antrea/cmd/antctl
@CGO_ENABLED=0 $(GO) build -o $(BINDIR)/$(ANTCTL_BINARY_NAME) $(GOFLAGS) -ldflags '-s -w $(LDFLAGS)' antrea.io/antrea/cmd/antctl

.PHONY: check-copyright
check-copyright:
Expand Down
45 changes: 36 additions & 9 deletions hack/release/prepare-assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,46 @@ for build in "${ANTREA_BUILDS[@]}"; do
arch="${args[1]}"
suffix="${args[2]}"

# cgo is disabled by default when cross-compiling, but enabled by default
# for native builds. We ensure it is always disabled for portability since
# these binaries will be distributed as release assets.
GOOS=$os GOARCH=$arch CGO_ENABLED=0 ANTCTL_BINARY_NAME="antctl-$suffix" BINDIR="$OUTPUT_DIR"/ make antctl-release
cd ./plugins/octant && GOOS=$os GOARCH=$arch CGO_ENABLED=0 ANTREA_OCTANT_PLUGIN_BINARY_NAME="antrea-octant-plugin-$suffix" \
BINDIR="$OUTPUT_DIR" make antrea-octant-plugin-release && cd ../..
# all "*-release" targets disable cgo, which is appropriate when
# distributing release assets, for portability.
GOOS=$os GOARCH=$arch ANTCTL_BINARY_NAME="antctl-$suffix" BINDIR="$OUTPUT_DIR" make antctl-release
cd ./plugins/octant && GOOS=$os GOARCH=$arch BINDIR="$OUTPUT_DIR" ANTREA_OCTANT_PLUGIN_BINARY_NAME="antrea-octant-plugin-$suffix" make antrea-octant-plugin-release && cd ../..
done

ANTREA_AGENT_BUILDS=(
"linux amd64 linux-x86_64"
"linux arm64 linux-arm64"
"linux arm linux-arm"
"windows amd64 windows-x86_64.exe"
)

for build in "${ANTREA_AGENT_BUILDS[@]}"; do
args=($build)
os="${args[0]}"
arch="${args[1]}"
suffix="${args[2]}"

GOOS=$os GOARCH=$arch BINDIR="$OUTPUT_DIR" ANTREA_AGENT_BINARY_NAME="antrea-agent-$suffix" make antrea-agent-release
done

ANTREA_CNI_BUILDS=(
"windows amd64 windows-x86_64.exe"
)

for build in "${ANTREA_CNI_BUILDS[@]}"; do
args=($build)
os="${args[0]}"
arch="${args[1]}"
suffix="${args[2]}"

GOOS=$os GOARCH=$arch BINDIR="$OUTPUT_DIR" ANTREA_CNI_BINARY_NAME="antrea-cni-$suffix" make antrea-cni-release
done

# the windows-bin Makefile target builds antrea-cni and antrea-agent with cgo
# explicitly disabled.
BINDIR="$OUTPUT_DIR" make windows-bin
sed "s/AntreaVersion=\"latest\"/AntreaVersion=\"$VERSION\"/" ./hack/windows/Start-AntreaAgent.ps1 > "$OUTPUT_DIR"/Start-AntreaAgent.ps1

cp ./hack/externalnode/install-vm.sh "$OUTPUT_DIR/"
cp ./hack/externalnode/install-vm.ps1 "$OUTPUT_DIR/"

export IMG_TAG=$VERSION

export IMG_NAME=projects.registry.vmware.com/antrea/antrea-ubuntu
Expand Down

0 comments on commit 66df561

Please sign in to comment.