-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate asset upload when creating a release
When creating a release, the necessary assets (yaml manifests and antctl binaries) will now be added to the release automatically by a Github workflow. This reduces the potential for human error. For antctl, we build and upload the following binaries: * linux: amd64, arm64, arm (arm/v7) * darwin: amd64 * windows: amd64 Fixes #312
- Loading branch information
1 parent
e3c0072
commit 1861141
Showing
6 changed files
with
200 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
name: Upload assets to release | ||
|
||
on: | ||
release: | ||
types: | ||
- created | ||
|
||
jobs: | ||
build: | ||
runs-on: [ubuntu-18.04] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Build assets | ||
env: | ||
TAG: ${{ github.ref }} | ||
run: | | ||
mkdir assets | ||
VERSION="${TAG:10}" ./hack/release/prepare-assets.sh ./assets | ||
- name: Upload antctl-darwin-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/antctl-darwin-x86_64 | ||
asset_name: antctl-darwin-x86_64 | ||
asset_content_type: application/octet-stream | ||
- name: Upload antctl-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/antctl-linux-arm | ||
asset_name: antctl-linux-arm | ||
asset_content_type: application/octet-stream | ||
- name: Upload antctl-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/antctl-linux-arm64 | ||
asset_name: antctl-linux-arm64 | ||
asset_content_type: application/octet-stream | ||
- name: Upload antctl-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/antctl-linux-x86_64 | ||
asset_name: antctl-linux-x86_64 | ||
asset_content_type: application/octet-stream | ||
- name: Upload antctl-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/antctl-windows-x86_64.exe | ||
asset_name: antctl-windows-x86_64.exe | ||
asset_content_type: application/octet-stream | ||
- name: Upload antrea.yml | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: ./assets/antrea.yml | ||
asset_name: antrea.yml | ||
asset_content_type: application/octet-stream | ||
- name: Upload antrea-ipsec.yml | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: ./assets/antrea-ipsec.yml | ||
asset_name: antrea-ipsec.yml | ||
asset_content_type: application/octet-stream | ||
- name: Upload antrea-eks.yml | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: ./assets/antrea-eks.yml | ||
asset_name: antrea-eks.yml | ||
asset_content_type: application/octet-stream | ||
- name: Upload antrea-gke.yml | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: ./assets/antrea-gke.yml | ||
asset_name: antrea-gke.yml | ||
asset_content_type: application/octet-stream | ||
- name: Upload antrea-octant.yml | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: ./assets/antrea-octant.yml | ||
asset_name: antrea-octant.yml | ||
asset_content_type: application/octet-stream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2020 Antrea Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# This script generates all the assets required for an Antrea Github release to | ||
# the provided directory. | ||
# Usage: VERSION=v1.0.0 ./prepare-artifacts.sh <output dir> | ||
|
||
set -eo pipefail | ||
|
||
function echoerr { | ||
>&2 echo "$@" | ||
exit 1 | ||
} | ||
|
||
if [ -z "$VERSION" ]; then | ||
echoerr "Environment variable VERSION must be set" | ||
fi | ||
|
||
if [ -z "$1" ]; then | ||
echoerr "Argument required: output directory for assets" | ||
fi | ||
|
||
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
pushd $THIS_DIR/../.. > /dev/null | ||
|
||
ANTCTL_BUILDS=( | ||
"linux amd64 linux-x86_64" | ||
"linux arm64 linux-arm64" | ||
"linux arm linux-arm" | ||
"windows amd64 windows-x86_64.exe" | ||
"darwin amd64 darwin-x86_64" | ||
) | ||
|
||
for build in "${ANTCTL_BUILDS[@]}"; do | ||
args=($build) | ||
os="${args[0]}" | ||
arch="${args[1]}" | ||
suffix="${args[2]}" | ||
|
||
GOOS=$os GOARCH=$arch ANTCTL_BINARY_NAME="antctl-$suffix" BINDIR=$1/ make antctl-release | ||
done | ||
|
||
export IMG_NAME=antrea/antrea-ubuntu | ||
export IMG_TAG=$VERSION | ||
|
||
./hack/generate-manifest.sh --mode release > $1/antrea.yml | ||
./hack/generate-manifest.sh --mode release --ipsec > $1/antrea-ipsec.yml | ||
./hack/generate-manifest.sh --mode release --encap-mode networkPolicyOnly > $1/antrea-eks.yml | ||
./hack/generate-manifest.sh --mode release --cloud GKE --encap-mode noEncap > $1/antrea-gke.yml | ||
./hack/generate-manifest-octant.sh --mode release > $1/antrea-octant.yml | ||
|
||
ls $1 | cat |