|
| 1 | +name: Function-Mesh Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + tag: |
| 7 | + description: 'Version Tag' |
| 8 | + required: true |
| 9 | + |
| 10 | +jobs: |
| 11 | + operatorhub: |
| 12 | + if: startsWith(github.ref, 'refs/tags/v') |
| 13 | + name: publish to operatorhub.io |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: clean disk |
| 17 | + run: | |
| 18 | + sudo swapoff -a |
| 19 | + sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc |
| 20 | + sudo apt clean |
| 21 | + docker rmi $(docker images -q) -f |
| 22 | + df -h |
| 23 | +
|
| 24 | + - name: checkout |
| 25 | + uses: actions/checkout@v2 |
| 26 | + with: |
| 27 | + ref: {{ inputs.tag }} |
| 28 | + |
| 29 | + - name: Login to Docker Hub |
| 30 | + uses: docker/login-action@v1 |
| 31 | + with: |
| 32 | + username: ${{ secrets.DOCKER_USER }} |
| 33 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 34 | + |
| 35 | + - name: Set up GO 1.20.4 |
| 36 | + uses: actions/setup-go@v1 |
| 37 | + with: |
| 38 | + go-version: 1.20.4 |
| 39 | + id: go |
| 40 | + |
| 41 | + - name: InstallKubebuilder |
| 42 | + run: | |
| 43 | + curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.1/kubebuilder_2.3.1_linux_amd64.tar.gz | tar -xz -C /tmp/ |
| 44 | + sudo mv /tmp/kubebuilder_2.3.1_linux_amd64 /usr/local/kubebuilder |
| 45 | + export PATH=$PATH:/usr/local/kubebuilder/bin |
| 46 | +
|
| 47 | + - name: Install operator-sdk |
| 48 | + run: | |
| 49 | + RELEASE_VERSION=v1.14.0 |
| 50 | + curl -LO "https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk_linux_amd64" |
| 51 | + chmod +x operator-sdk_linux_amd64 && sudo mkdir -p /usr/local/bin/ && sudo mv operator-sdk_linux_amd64 /usr/local/bin/operator-sdk |
| 52 | +
|
| 53 | + - name: Set up yq |
| 54 | + run: | |
| 55 | + sudo wget https://github.com/mikefarah/yq/releases/download/v4.30.4/yq_linux_amd64 -O /usr/bin/yq |
| 56 | + sudo chmod +x /usr/bin/yq |
| 57 | + yq --help |
| 58 | +
|
| 59 | + - name: Get vertical-pod-autoscaler crd |
| 60 | + run: | |
| 61 | + wget https://github.com/raw/kubernetes/autoscaler/master/vertical-pod-autoscaler/deploy/vpa-v1-crd-gen.yaml -O config/crd/bases/vpa-v1-crd.yaml |
| 62 | +
|
| 63 | + - name: build release |
| 64 | + id: build_release |
| 65 | + env: |
| 66 | + VERSION: ${{ inputs.tag }} |
| 67 | + IMAGE_TAG_BASE: streamnative/function-mesh |
| 68 | + CATALOG_BRANCH_TAG: latest |
| 69 | + run: | |
| 70 | + # convert vx.y.z to x.y.z because a valid semver is needed in creating the bundle |
| 71 | + VERSION=$(echo $VERSION|cut -c 2-) |
| 72 | + make release |
| 73 | +
|
| 74 | + - name: Login to Quay |
| 75 | + uses: docker/login-action@v1 |
| 76 | + with: |
| 77 | + registry: quay.io |
| 78 | + username: ${{ secrets.QUAY_DOCKER_USERNAME }} |
| 79 | + password: ${{ secrets.QUAY_DOCKER_PASSWORD }} |
| 80 | + |
| 81 | + - name: Build RedHat certificated bundle And Publish to Quay |
| 82 | + env: |
| 83 | + VERSION: ${{ inputs.tag }} |
| 84 | + DOCKER_REPO: quay.io/streamnativeio |
| 85 | + IMAGE_TAG_BASE: quay.io/streamnativeio/function-mesh |
| 86 | + CATALOG_BRANCH_TAG: latest |
| 87 | + run: | |
| 88 | + # convert vx.y.z to x.y.z because a valid semver is needed in creating the bundle |
| 89 | + VERSION=$(echo $VERSION|cut -c 2-) |
| 90 | + echo $VERSION |
| 91 | + make redhat-certificated-image-build redhat-certificated-image-push redhat-certificated-bundle redhat-certificated-bundle-build redhat-certificated-bundle-push |
| 92 | +
|
| 93 | + - name: Checkout streamnative community-operators |
| 94 | + uses: actions/checkout@v3 |
| 95 | + with: |
| 96 | + repository: streamnative/community-operators |
| 97 | + path: community-operators |
| 98 | + token: ${{ secrets.SNBOT_GITHUB_TOKEN }} |
| 99 | + |
| 100 | + - name: Copy bundle to community-operators and create pr |
| 101 | + env: |
| 102 | + GITHUB_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }} |
| 103 | + VERSION: ${{ inputs.tag }} |
| 104 | + run: | |
| 105 | + pushd community-operators |
| 106 | + export VERSION=$(echo $VERSION|cut -c 2-) |
| 107 | + echo $VERSION |
| 108 | + export BRANCH=function-mesh-operator-$VERSION |
| 109 | + echo $BRANCH |
| 110 | + git push -d origin $BRANCH || echo 'Skip branch deletion' |
| 111 | + git checkout -b $BRANCH |
| 112 | +
|
| 113 | + export TARGET_DIR=operators/function-mesh/$VERSION |
| 114 | + mkdir -p $TARGET_DIR |
| 115 | + cp -rf ../bundle.Dockerfile $TARGET_DIR |
| 116 | + cp -rf ../bundle/* $TARGET_DIR |
| 117 | +
|
| 118 | + git add . |
| 119 | + git commit -s -m "operator function-mesh ($VERSION)" |
| 120 | + git push --set-upstream origin $BRANCH |
| 121 | + gh pr create --title "operator function-mesh ($VERSION)" -F ../.github/openshift/community-operators -R k8s-operatorhub/community-operators |
| 122 | + popd |
| 123 | +
|
| 124 | + openshift: |
| 125 | + if: startsWith(github.ref, 'refs/tags/v') |
| 126 | + name: publish to openshift certificated |
| 127 | + runs-on: ubuntu-latest |
| 128 | + steps: |
| 129 | + - name: clean disk |
| 130 | + run: | |
| 131 | + sudo swapoff -a |
| 132 | + sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc |
| 133 | + sudo apt clean |
| 134 | + docker rmi $(docker images -q) -f |
| 135 | + df -h |
| 136 | +
|
| 137 | + - name: checkout |
| 138 | + uses: actions/checkout@v2 |
| 139 | + with: |
| 140 | + ref: {{ inputs.tag }} |
| 141 | + |
| 142 | + - name: Login to Docker Hub |
| 143 | + uses: docker/login-action@v1 |
| 144 | + with: |
| 145 | + username: ${{ secrets.DOCKER_USER }} |
| 146 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 147 | + |
| 148 | + - name: Set up GO 1.20.4 |
| 149 | + uses: actions/setup-go@v1 |
| 150 | + with: |
| 151 | + go-version: 1.20.4 |
| 152 | + id: go |
| 153 | + |
| 154 | + - name: InstallKubebuilder |
| 155 | + run: | |
| 156 | + curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.1/kubebuilder_2.3.1_linux_amd64.tar.gz | tar -xz -C /tmp/ |
| 157 | + sudo mv /tmp/kubebuilder_2.3.1_linux_amd64 /usr/local/kubebuilder |
| 158 | + export PATH=$PATH:/usr/local/kubebuilder/bin |
| 159 | +
|
| 160 | + - name: Install operator-sdk |
| 161 | + run: | |
| 162 | + RELEASE_VERSION=v1.14.0 |
| 163 | + curl -LO "https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk_linux_amd64" |
| 164 | + chmod +x operator-sdk_linux_amd64 && sudo mkdir -p /usr/local/bin/ && sudo mv operator-sdk_linux_amd64 /usr/local/bin/operator-sdk |
| 165 | +
|
| 166 | + - name: Set up yq |
| 167 | + run: | |
| 168 | + sudo wget https://github.com/mikefarah/yq/releases/download/v4.30.4/yq_linux_amd64 -O /usr/bin/yq |
| 169 | + sudo chmod +x /usr/bin/yq |
| 170 | + yq --help |
| 171 | +
|
| 172 | + - name: Get vertical-pod-autoscaler crd |
| 173 | + run: | |
| 174 | + wget https://github.com/raw/kubernetes/autoscaler/master/vertical-pod-autoscaler/deploy/vpa-v1-crd-gen.yaml -O config/crd/bases/vpa-v1-crd.yaml |
| 175 | +
|
| 176 | + - name: build release |
| 177 | + id: build_release |
| 178 | + env: |
| 179 | + VERSION: ${{ inputs.tag }} |
| 180 | + IMAGE_TAG_BASE: streamnative/function-mesh |
| 181 | + CATALOG_BRANCH_TAG: latest |
| 182 | + run: | |
| 183 | + VERSION=$(echo $VERSION|cut -c 2-) |
| 184 | + make release |
| 185 | +
|
| 186 | + - name: Login to Quay for RedHat container certification |
| 187 | + uses: docker/login-action@v1 |
| 188 | + with: |
| 189 | + registry: quay.io |
| 190 | + username: ${{ secrets.REDHAT_CERTIFICATED_CONTAINER_REGISTRY_USER }} |
| 191 | + password: ${{ secrets.REDHAT_CERTIFICATED_CONTAINER_REGISTRY_PASSWORD }} |
| 192 | + |
| 193 | + - name: Build Openshift certificated container And Publish to Quay |
| 194 | + env: |
| 195 | + VERSION: ${{ inputs.tag }} |
| 196 | + DOCKER_REPO: registry.connect.redhat.com/streamnative |
| 197 | + IMAGE_TAG_BASE: registry.connect.redhat.com/streamnative/function-mesh |
| 198 | + CATALOG_BRANCH_TAG: latest |
| 199 | + CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID: ${{ secrets.CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID }} |
| 200 | + run: | |
| 201 | + echo $VERSION |
| 202 | + make redhat-certificated-image-build |
| 203 | + docker tag $IMAGE_TAG_BASE:$VERSION quay.io/redhat-isv-containers/$CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID:$VERSION |
| 204 | + docker push quay.io/redhat-isv-containers/$CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID:$VERSION |
| 205 | +
|
| 206 | + - name: Trigger openshift preflight test |
| 207 | + env: |
| 208 | + VERSION: ${{ inputs.tag }} |
| 209 | + CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID: ${{ secrets.CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID }} |
| 210 | + PFLT_PYXIS_API_TOKEN: ${{ secrets.PFLT_PYXIS_API_TOKEN }} |
| 211 | + REDHAT_CERTITICATED_CONTAINER_AUTHFILE: ${{ secrets.REDHAT_CERTITICATED_CONTAINER_AUTHFILE }} |
| 212 | + run: | |
| 213 | + echo $VERSION |
| 214 | + mkdir ./artifacts |
| 215 | + echo $REDHAT_CERTITICATED_CONTAINER_AUTHFILE > ./authfile.json |
| 216 | + docker run -it --rm --security-opt=label=disable --env PFLT_LOGLEVEL=trace --env PFLT_ARTIFACTS=/artifacts --env PFLT_LOGFILE=/artifacts/preflight.log --env PFLT_CERTIFICATION_PROJECT_ID=$CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID --env PFLT_PYXIS_API_TOKEN=$PFLT_PYXIS_API_TOKEN --env PFLT_DOCKERCONFIG=/temp-authfile.json -v ./artifacts:/artifacts -v ./authfile.json:/temp-authfile.json:ro quay.io/opdev/preflight:stable check container quay.io/redhat-isv-containers/$CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID:$VERSION --submit |
| 217 | +
|
| 218 | + - name: Label the image as latest |
| 219 | + env: |
| 220 | + VERSION: ${{ inputs.tag }} |
| 221 | + DOCKER_REPO: registry.connect.redhat.com/streamnative |
| 222 | + IMAGE_TAG_BASE: registry.connect.redhat.com/streamnative/function-mesh |
| 223 | + CATALOG_BRANCH_TAG: latest |
| 224 | + CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID: ${{ secrets.CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID }} |
| 225 | + run: | |
| 226 | + echo $VERSION |
| 227 | + docker tag $IMAGE_TAG_BASE:$VERSION quay.io/redhat-isv-containers/$CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID:latest |
| 228 | + docker push quay.io/redhat-isv-containers/$CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID:latest |
| 229 | + docker rmi quay.io/redhat-isv-containers/$CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID:latest |
| 230 | + docker rmi quay.io/redhat-isv-containers/$CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID:$VERSION |
| 231 | + docker pull quay.io/redhat-isv-containers/$CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID:$VERSION |
| 232 | + docker inspect quay.io/redhat-isv-containers/$CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID:$VERSION |
| 233 | +
|
| 234 | + - name: Build the openshift bundle |
| 235 | + env: |
| 236 | + VERSION: ${{ inputs.tag }} |
| 237 | + DOCKER_REPO: registry.connect.redhat.com/streamnative |
| 238 | + IMAGE_TAG_BASE: registry.connect.redhat.com/streamnative/function-mesh |
| 239 | + CATALOG_BRANCH_TAG: latest |
| 240 | + CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID: ${{ secrets.CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID }} |
| 241 | + run: | |
| 242 | + echo $VERSION |
| 243 | + make redhat-certificated-bundle redhat-certificated-bundle-build |
| 244 | +
|
| 245 | + - name: Checkout streamnative certified-operators |
| 246 | + uses: actions/checkout@v3 |
| 247 | + with: |
| 248 | + repository: streamnative/certified-operators |
| 249 | + path: certified-operators |
| 250 | + token: ${{ secrets.SNBOT_GITHUB_TOKEN }} |
| 251 | + |
| 252 | + - name: Copy bundle to certified-operators and create pr |
| 253 | + env: |
| 254 | + GITHUB_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }} |
| 255 | + VERSION: ${{ inputs.tag }} |
| 256 | + run: | |
| 257 | + # install operator-manifest-tools |
| 258 | + wget -q https://github.com/operator-framework/operator-manifest-tools/releases/download/v0.2.2/operator-manifest-tools_0.2.2_linux_amd64 -O operator-manifest-tools |
| 259 | + chmod +x operator-manifest-tools |
| 260 | + mv operator-manifest-tools /usr/local/bin |
| 261 | +
|
| 262 | + # install skopeo |
| 263 | + sudo apt-get -y install skopeo |
| 264 | +
|
| 265 | + pushd certified-operators |
| 266 | + echo $VERSION |
| 267 | + export BRANCH=function-mesh-operator-$VERSION |
| 268 | + echo $BRANCH |
| 269 | + git push -d origin $BRANCH || echo 'Skip branch deletion' |
| 270 | + git checkout -b $BRANCH |
| 271 | +
|
| 272 | + export TARGET_DIR=operators/function-mesh/${{ inputs.channel-tag }} |
| 273 | + mkdir -p $TARGET_DIR |
| 274 | + cp -rf ../bundle.Dockerfile $TARGET_DIR |
| 275 | + cp -rf ../bundle/* $TARGET_DIR |
| 276 | +# |
| 277 | +# export MANIFEST_DIR=$TARGET_DIR/manifests |
| 278 | +# operator-manifest-tools pinning pin $MANIFEST_DIR |
| 279 | +# operator-manifest-tools pinning replace $MANIFEST_DIR replacements.json |
| 280 | +# rm references.json replacements.json |
| 281 | + |
| 282 | + git add . |
| 283 | + git commit -s -m "operator function-mesh ($VERSION)" |
| 284 | + git push --set-upstream origin $BRANCH |
| 285 | + gh pr create --title "operator function-mesh ($VERSION)" --body "Signed-off-by: streamnativebot [email protected]" -R redhat-openshift-ecosystem/certified-operators |
| 286 | + popd |
0 commit comments