Skip to content

Commit d6cedab

Browse files
authored
add openshift release to ci (#642)
* add openshift release to ci * add a manual trigger action * use 1.20.4 * bump golangci-lint * fix typo
1 parent 93b5e06 commit d6cedab

File tree

15 files changed

+599
-25
lines changed

15 files changed

+599
-25
lines changed

.github/openshift/community-operators

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Signed-off-by: streamnativebot [[email protected]](mailto:[email protected])
2+
3+
Thanks submitting your Operator. Please check below list before you create your Pull Request.
4+
5+
### New Submissions
6+
* [ ] Are you familiar with our [contribution guidelines](https://github.com/operator-framework/community-operators/blob/master/docs/contributing-via-pr.md)?
7+
* [ ] Have you [packaged and deployed](https://github.com/operator-framework/community-operators/blob/master/docs/testing-operators.md) your Operator for Operator Framework?
8+
* [ ] Have you tested your Operator with all Custom Resource Definitions?
9+
* [ ] Have you tested your Operator in all supported [installation modes](https://github.com/operator-framework/operator-lifecycle-manager/blob/master/doc/design/building-your-csv.md#operator-metadata)?
10+
* [ ] Have you considered whether you want use [semantic versioning order](https://github.com/operator-framework/community-operators/blob/master/docs/operator-ci-yaml.md#semver-mode)?
11+
* [ ] Is your submission [signed](https://github.com/operator-framework/community-operators/blob/master/docs/contributing-prerequisites.md#sign-your-work)?
12+
* [ ] Is operator [icon](https://github.com/operator-framework/community-operators/blob/master/docs/packaging-operator.md#operator-icon) set?
13+
14+
### Updates to existing Operators
15+
* [x] Did you create a `ci.yaml` file according to the [update instructions](https://github.com/operator-framework/community-operators/blob/master/docs/operator-ci-yaml.md)?
16+
* [x] Is your new CSV pointing to the previous version with the `replaces` property if you chose `replaces-mode` via the `updateGraph` property in `ci.yaml`?
17+
* [x] Is your new CSV referenced in the [appropriate channel](https://github.com/operator-framework/community-operators/blob/master/docs/packaging-operator.md#channels) defined in the `package.yaml` or `annotations.yaml` ?
18+
* [x] Have you tested an update to your Operator when deployed via OLM?
19+
* [x] Is your submission [signed](https://github.com/operator-framework/community-operators/blob/master/docs/contributing-prerequisites.md#sign-your-work)?
20+
21+
### Your submission should not
22+
* [x] Modify more than one operator
23+
* [x] Modify an Operator you don't own
24+
* [x] Rename an operator - please remove and add with a different name instead
25+
* [x] Modify any files outside the above mentioned folders
26+
* [x] Contain more than one commit. **Please squash your commits.**
27+
28+
### Operator Description must contain (in order)
29+
1. [x] Description about the managed Application and where to find more information
30+
2. [x] Features and capabilities of your Operator and how to use it
31+
3. [x] Any manual steps about potential pre-requisites for using your Operator
32+
33+
### Operator Metadata should contain
34+
* [x] Human readable name and 1-liner description about your Operator
35+
* [x] Valid [category name](https://github.com/operator-framework/community-operators/blob/master/docs/packaging-operator.md#categories)1
36+
* [x] One of the pre-defined [capability levels](https://github.com/operator-framework/operator-courier/blob/4d1a25d2c8d52f7de6297ec18d8afd6521236aa2/operatorcourier/validate.py#L556)2
37+
* [x] Links to the maintainer, source code and documentation
38+
* [x] Example templates for all Custom Resource Definitions intended to be used
39+
* [x] A quadratic logo
40+
41+
Remember that you can preview your CSV [here](https://operatorhub.io/preview).
42+
43+
--
44+
45+
1 If you feel your Operator does not fit any of the pre-defined categories, file an issue against this repo and explain your need
46+
47+
2 For more information see [here](https://sdk.operatorframework.io/docs/overview/#operator-capability-level)
48+
49+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Signed-off-by: streamnativebot [[email protected]](mailto:[email protected])
2+
3+
Thanks submitting your Operator. Please check below list before you create your Pull Request.
4+
5+
### New Submissions
6+
* [ ] Are you familiar with our [contribution guidelines](https://github.com/operator-framework/community-operators/blob/master/docs/contributing-via-pr.md)?
7+
* [ ] Have you [packaged and deployed](https://github.com/operator-framework/community-operators/blob/master/docs/testing-operators.md) your Operator for Operator Framework?
8+
* [ ] Have you tested your Operator with all Custom Resource Definitions?
9+
* [ ] Have you tested your Operator in all supported [installation modes](https://github.com/operator-framework/operator-lifecycle-manager/blob/master/doc/design/building-your-csv.md#operator-metadata)?
10+
* [ ] Have you considered whether you want use [semantic versioning order](https://github.com/operator-framework/community-operators/blob/master/docs/operator-ci-yaml.md#semver-mode)?
11+
* [ ] Is your submission [signed](https://github.com/operator-framework/community-operators/blob/master/docs/contributing-prerequisites.md#sign-your-work)?
12+
* [ ] Is operator [icon](https://github.com/operator-framework/community-operators/blob/master/docs/packaging-operator.md#operator-icon) set?
13+
14+
### Updates to existing Operators
15+
* [x] Did you create a `ci.yaml` file according to the [update instructions](https://github.com/operator-framework/community-operators/blob/master/docs/operator-ci-yaml.md)?
16+
* [x] Is your new CSV pointing to the previous version with the `replaces` property if you chose `replaces-mode` via the `updateGraph` property in `ci.yaml`?
17+
* [x] Is your new CSV referenced in the [appropriate channel](https://github.com/operator-framework/community-operators/blob/master/docs/packaging-operator.md#channels) defined in the `package.yaml` or `annotations.yaml` ?
18+
* [x] Have you tested an update to your Operator when deployed via OLM?
19+
* [x] Is your submission [signed](https://github.com/operator-framework/community-operators/blob/master/docs/contributing-prerequisites.md#sign-your-work)?
20+
21+
### Your submission should not
22+
* [x] Modify more than one operator
23+
* [x] Modify an Operator you don't own
24+
* [x] Rename an operator - please remove and add with a different name instead
25+
* [x] Modify any files outside the above mentioned folders
26+
* [x] Contain more than one commit. **Please squash your commits.**
27+
28+
### Operator Description must contain (in order)
29+
1. [x] Description about the managed Application and where to find more information
30+
2. [x] Features and capabilities of your Operator and how to use it
31+
3. [x] Any manual steps about potential pre-requisites for using your Operator
32+
33+
### Operator Metadata should contain
34+
* [x] Human readable name and 1-liner description about your Operator
35+
* [x] Valid [category name](https://github.com/operator-framework/community-operators/blob/master/docs/packaging-operator.md#categories)1
36+
* [x] One of the pre-defined [capability levels](https://github.com/operator-framework/operator-courier/blob/4d1a25d2c8d52f7de6297ec18d8afd6521236aa2/operatorcourier/validate.py#L556)2
37+
* [x] Links to the maintainer, source code and documentation
38+
* [x] Example templates for all Custom Resource Definitions intended to be used
39+
* [x] A quadratic logo
40+
41+
Remember that you can preview your CSV [here](https://operatorhub.io/preview).
42+
43+
--
44+
45+
1 If you feel your Operator does not fit any of the pre-defined categories, file an issue against this repo and explain your need
46+
47+
2 For more information see [here](https://sdk.operatorframework.io/docs/overview/#operator-capability-level)

.github/workflows/bundle-release.yml

Lines changed: 286 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,286 @@
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

.github/workflows/olm-verify.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ jobs:
2727
- name: checkout
2828
uses: actions/checkout@v2
2929

30-
- name: Set up GO 1.18
30+
- name: Set up GO 1.20.4
3131
uses: actions/setup-go@v1
3232
with:
33-
go-version: 1.18
33+
go-version: 1.20.4
3434
id: go
3535

3636
- name: InstallKubebuilder

0 commit comments

Comments
 (0)