.github: find latest calico tag from tigera operator

The mirror-calico workflow has been failing because it currently determines
version=v3.22.0-0.dev-typha, which is not the tag used by the individual
container images. Rewrite the version logic to determine the version based on
what is in the tigera operator manifest. This is the same manifest that we use
to deploy calico in mantle.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
This commit is contained in:
Jeremi Piotrowski 2022-01-13 11:10:35 +01:00
parent df2c3ace99
commit 886b11bf1d

View File

@ -6,7 +6,7 @@ on:
workflow_dispatch:
jobs:
get-docker-release:
mirror-calico:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@ -17,10 +17,19 @@ jobs:
run: |
set -ex
git clone https://github.com/projectcalico/calico calico
# get latest version
version=$(git -C "$_" tag | sort -V | tail -1)
tigera_image=$(curl -sSL https://docs.projectcalico.org/manifests/tigera-operator.yaml \
| awk '/image:/ && NF == 2 { print $2 }')
tigera_version=${tigera_image##*:}
versions=$(curl -sSL "https://raw.githubusercontent.com/tigera/operator/${tigera_version}/config/calico_versions.yml" \
| awk '/version:/ { print $2 }' \
| sort \
| uniq)
echo "Found versions: $versions"
pushd .github/workflows/
./mirror-calico.sh $version
for version in $versions; do
./mirror-calico.sh $version
done
popd