-
Notifications
You must be signed in to change notification settings - Fork 18
146 lines (140 loc) · 7.68 KB
/
release-respin.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
#
name: Respin a skupper-router image for a released tag
on:
workflow_dispatch:
inputs:
tag:
description: 'A version (git tag) that has already been released'
required: true
canPushLatestTag:
description: 'Push :latest tag?'
required: true
type: boolean
default: false
jobs:
build-image-amd64:
name: Rebuild and publish skupper-router amd64 image for an already released tag
runs-on: ubuntu-latest
steps:
- name: Get the tag name and set it as the CONTAINER_TAG env variable.
run: |
echo "CONTAINER_TAG=${{github.event.inputs.tag}}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
ref: ${{github.event.inputs.tag}}
- name: Build and publish skupper-router amd64 image
run: |
export PROJECT_TAG="${{ env.CONTAINER_TAG }}"
export VERSION="${{ env.CONTAINER_TAG }}"
export BUILD_NUMBER=$((`curl -s https://quay.io/api/v1/repository/skupper/skupper-router/tag/?filter_tag_name=like:${VERSION} | jq '.tags[] | select(has("end_ts") | not) | .name' | grep -E "\"${VERSION}-[0-9]+\"" | wc -l || echo 0` + 1))
# Only accepts tag if build_number is higher than one
[[ ${BUILD_NUMBER} -eq 1 ]] && { echo "The provided tag (${VERSION}) does not refer to a released image. You must provide a tag that has already been released."; exit 1; }
# Verify if build number is unique, otherwise fail
CAN_PUSH_LATEST='${{github.event.inputs.canPushLatestTag}}'
if [ "${CAN_PUSH_LATEST}" == "true" ]; then
echo 'release-respin.yml(job: build-image-amd64) setting PUSH_LATEST=true, will push :latest tag'
export PUSH_LATEST=true
else
echo 'release-respin.yml(job: build-image-amd64) not setting PUSH_LATEST, will not push :latest tag'
fi
curl -s "https://quay.io/api/v1/repository/skupper/skupper-router/tag/?filter_tag_name=eq:${VERSION}-${BUILD_NUMBER}" | \
jq .tags | grep -E '^\[\]$' || \
{ echo Unable to get a unique build number ; exit 1 ; }
export PLATFORM=amd64
./.github/scripts/image.sh
env:
CONTAINER_USER: '${{ secrets.DOCKER_USER }}'
CONTAINER_PASSWORD: '${{ secrets.DOCKER_PASSWORD }}'
build-image-arm64:
name: Rebuild and publish skupper-router arm64 image for an already released tag
runs-on: self-hosted-arm64
steps:
- name: Get the tag name and set it as the CONTAINER_TAG env variable.
run: |
echo "CONTAINER_TAG=${{github.event.inputs.tag}}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
ref: ${{github.event.inputs.tag}}
- name: Build and publish skupper-router arm64 image
run: |
export VERSION="${{ env.CONTAINER_TAG }}"
export BUILD_NUMBER=$((`curl -s https://quay.io/api/v1/repository/skupper/skupper-router/tag/?filter_tag_name=like:${VERSION} | jq '.tags[] | select(has("end_ts") | not) | .name' | grep -E "\"${VERSION}-[0-9]+\"" | wc -l || echo 0` + 1))
# Only accepts tag if build_number is higher than one
[[ ${BUILD_NUMBER} -eq 1 ]] && { echo "The provided tag (${VERSION}) does not refer to a released image. You must provide a tag that has already been released."; exit 1; }
export PROJECT_TAG="${{ env.CONTAINER_TAG }}"
export VERSION="${{ env.CONTAINER_TAG }}"
CAN_PUSH_LATEST='${{github.event.inputs.canPushLatestTag}}'
if [ "${CAN_PUSH_LATEST}" == "true" ]; then
echo 'release-respin.yml(job: build-image-arm64) setting PUSH_LATEST=true, will push :latest tag'
export PUSH_LATEST=true
else
echo 'release-respin.yml(job: build-image-arm64) not setting PUSH_LATEST, will not push :latest tag'
fi
export PLATFORM=arm64
./.github/scripts/image.sh
env:
CONTAINER_USER: '${{ secrets.DOCKER_USER }}'
CONTAINER_PASSWORD: '${{ secrets.DOCKER_PASSWORD }}'
# This job pulls the images produced by the build-image-amd64 and build-image-arm64 jobs
create-manifest:
needs: [build-image-amd64, build-image-arm64]
name: Pull skupper-router amd64 and arm64 images and create/push manifest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install podman
run: |
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_$(lsb_release -rs)/Release.key \
| gpg --dearmor \
| sudo tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg]\
https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_$(lsb_release -rs)/ /" \
| sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list > /dev/null
sudo apt-get update -qq
sudo apt-get -qq -y install podman
podman version
# temporary fix for https://github.com/containers/podman/issues/21024
wget https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_22.04/amd64/conmon_2.1.2~0_amd64.deb -O /tmp/conmon_2.1.2.deb
sudo apt install /tmp/conmon_2.1.2.deb
# Starting systemd user service
systemctl --user start podman.socket
- name: Get the tag name and set it as the CONTAINER_TAG env variable.
run: |
echo "CONTAINER_TAG=${{github.event.inputs.tag}}" >> $GITHUB_ENV
- name: Pull skupper-router amd64 and arm64 images and create/push manifest
run: |
export VERSION="${{ env.CONTAINER_TAG }}"
export BUILD_NUMBER=$((`curl -s https://quay.io/api/v1/repository/skupper/skupper-router/tag/?filter_tag_name=like:${VERSION} | jq '.tags[] | select(has("end_ts") | not) | .name' | grep -E "\"${VERSION}-[0-9]+\"" | wc -l || echo 0` + 1))
# Only accepts tag if build_number is higher than one
[[ ${BUILD_NUMBER} -eq 1 ]] && { echo "The provided tag (${VERSION}) does not refer to a released image. You must provide a tag that has already been released."; exit 1; }
export PROJECT_TAG="${{ env.CONTAINER_TAG }}"
CAN_PUSH_LATEST='${{github.event.inputs.canPushLatestTag}}'
if [ "${CAN_PUSH_LATEST}" == "true" ]; then
echo 'release-respin.yml(job: create-manifest) setting PUSH_LATEST=true, will push :latest tag'
export PUSH_LATEST=true
else
echo 'release-respin.yml(job: create-manifest) not setting PUSH_LATEST, will not push :latest tag'
fi
./.github/scripts/manifest.sh
env:
CONTAINER_USER: '${{ secrets.DOCKER_USER }}'
CONTAINER_PASSWORD: '${{ secrets.DOCKER_PASSWORD }}'