Skip to content

enable multinode upgrade tests with weave to flannel (#4839) #3271

enable multinode upgrade tests with weave to flannel (#4839)

enable multinode upgrade tests with weave to flannel (#4839) #3271

name: deploy-staging
on:
push:
branches:
- main
paths:
- '**'
- '!docs/**'
- '!CONTRIBUTING.md'
- '!README.md'
jobs:
get-tag:
runs-on: ubuntu-20.04
outputs:
version_tag: ${{ steps.set-tag.outputs.version_tag }}
steps:
- uses: actions/checkout@v4
- id: set-tag
run: |
git fetch --tags -f
export VERSION_TAG=$(git tag | grep '^v20' | sort | tail -1)-$(git rev-parse --short HEAD)
echo "version_tag=$VERSION_TAG" >> "$GITHUB_OUTPUT"
kurl-util-image:
runs-on: ubuntu-20.04
needs:
- get-tag
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- run: |
export KURL_UTIL_IMAGE=$KURL_UTIL_IMAGE_ALPHA
make -C kurl_util build-and-push-kurl-util-image
export KURL_UTIL_IMAGE=replicated/kurl-util:${VERSION_TAG}
docker tag $KURL_UTIL_IMAGE_ALPHA $KURL_UTIL_IMAGE
make -C kurl_util push-kurl-util-image
env:
KURL_UTIL_IMAGE_ALPHA: replicated/kurl-util:alpha
VERSION_TAG: ${{ needs.get-tag.outputs.version_tag }}
build-matrix:
runs-on: ubuntu-20.04
needs:
- get-tag
- kurl-util-image
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
name: Build image matrix
run: |
export KURL_UTIL_IMAGE=replicated/kurl-util:${VERSION_TAG}
export KURL_BIN_UTILS_FILE=kurl-bin-utils-${VERSION_TAG}.tar.gz
export KURL_BIN_UTILS_FILE_LATEST=kurl-bin-utils-latest.tar.gz
OUTPUT=`bin/list-all-packages-actions-matrix.sh "${{ github.event.inputs.index }}"`
echo "matrix=$OUTPUT" >> "$GITHUB_OUTPUT"
env:
VERSION_TAG: ${{ needs.get-tag.outputs.version_tag }}
build-upload-packages:
runs-on: ubuntu-20.04
needs:
- get-tag
- build-matrix
strategy:
matrix: ${{fromJSON(needs.build-matrix.outputs.matrix)}}
fail-fast: false
max-parallel: 20
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: setup env
id: env
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
shell: bash
- name: upload dist staging
run: |
export KURL_UTIL_IMAGE=replicated/kurl-util:${VERSION_TAG}
export KURL_BIN_UTILS_FILE=kurl-bin-utils-${VERSION_TAG}.tar.gz
export KURL_BIN_UTILS_FILE_LATEST=kurl-bin-utils-latest.tar.gz
bin/upload-dist-staging.sh "${{ matrix.batch }}"
env:
S3_BUCKET: kurl-sh
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PROD_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PROD_SECRET_ACCESS_KEY }}
AWS_REGION: "us-east-1"
DOCKER_PRUNE: '1'
VERSION_TAG: ${{ needs.get-tag.outputs.version_tag }}
- name: upload tag dirty
run: |
export KURL_UTIL_IMAGE=replicated/kurl-util:${VERSION_TAG}
export KURL_BIN_UTILS_FILE=kurl-bin-utils-${VERSION_TAG}.tar.gz
bin/upload-dist-versioned.sh "${{ matrix.batch }}"
env:
S3_BUCKET: kurl-sh
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PROD_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PROD_SECRET_ACCESS_KEY }}
AWS_REGION: "us-east-1"
PACKAGE_PREFIX: staging
VERSION_TAG: ${{ needs.get-tag.outputs.version_tag }}
build-addons:
runs-on: ubuntu-20.04
needs:
- get-tag
- kurl-util-image
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '14'
- run: npm install
- run: make generate-addons
env:
S3_BUCKET: kurl-sh
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PROD_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PROD_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: "us-east-1"
DIST_FOLDER: "staging"
VERSION_TAG: ${{ needs.get-tag.outputs.version_tag }}
set-current-version:
runs-on: ubuntu-20.04
needs:
- get-tag
- build-addons
- build-upload-packages
steps:
- name: Set VERSION file in s3
run: |
echo -n "$VERSION_TAG" | aws s3 cp - s3://$S3_BUCKET/$DIST_FOLDER/VERSION
env:
S3_BUCKET: kurl-sh
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PROD_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PROD_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: "us-east-1"
DIST_FOLDER: "staging"
VERSION_TAG: ${{ needs.get-tag.outputs.version_tag }}
- name: Purge s3-staging.kurl.sh cache
run: |
curl -X POST "https://api.cloudflare.com/client/v4/zones/$CF_KURL_ZONE/purge_cache" \
-H "X-Auth-Email: $CF_EMAIL" \
-H "Authorization: Bearer $CF_API_KEY" \
-H "Content-Type: application/json" \
--data '{"hosts":["s3-staging.kurl.sh"]}'
env:
CF_EMAIL: ${{ secrets.CF_EMAIL }}
CF_API_KEY: ${{ secrets.CF_API_KEY }}
CF_KURL_ZONE: ${{ secrets.CF_KURL_ZONE }}
testgrid-run:
runs-on: ubuntu-20.04
needs:
- get-tag
- set-current-version
steps:
- name: Sleep for 3 minutes
uses: juliangruber/sleep-action@v1
with:
time: "3m"
- name: Checkout
uses: actions/checkout@v4
- name: Tgrun Queue
id: queue
env:
TESTGRID_API_TOKEN: ${{ secrets.TESTGRID_PROD_API_TOKEN }}
VERSION_TAG: ${{ needs.get-tag.outputs.version_tag }}
run: |
REF="STAGING-release-${VERSION_TAG}-$(date '+%Y%m%d%H%M%S')"
sed -i "s/installerVersion: \"\"/installerVersion: \"${VERSION_TAG}\"/g" ./testgrid/specs/deploy.yaml
docker pull replicated/tgrun:latest
docker run --rm -e TESTGRID_API_TOKEN -v `pwd`:/wrk -w /wrk \
replicated/tgrun:latest queue --staging \
--ref "${REF}" \
--spec ./testgrid/specs/deploy.yaml \
--os-spec ./testgrid/specs/os-latest.yaml
MSG="Testgrid Run(s) Executing @ https://testgrid.kurl.sh/run/${REF}"
echo "msg=$MSG" >> "$GITHUB_OUTPUT"
echo "::notice ::${MSG}"
cleanup-s3:
runs-on: ubuntu-20.04
needs:
- set-current-version
steps:
- name: Checkout
uses: actions/checkout@v4
- name: cleanup versions in staging S3 more than 30 days old
run: |
bin/cleanup-staging-s3.sh
env:
S3_BUCKET: kurl-sh
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PROD_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PROD_SECRET_ACCESS_KEY }}
AWS_REGION: "us-east-1"