Skip to content

Commit 682f891

Browse files
v0.2.0 (#63)
Signed-off-by: Michael Valdron <[email protected]>
1 parent cb48fbd commit 682f891

34 files changed

+827
-473
lines changed

.ci/cache_version_tags.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
#
4+
# Copyright Red Hat
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
VERSION_PATTERN="v[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?"
19+
CONFIG_CSV='config/manifests/bases/registry-operator.clusterserviceversion.yaml'
20+
CONFIG_MANAGER_KUSTOMIZE='config/manager/kustomization.yaml'
21+
BUNDLE_CSV='bundle/manifests/registry-operator.clusterserviceversion.yaml'
22+
YQ_CLI=${YQ_CLI:-yq}
23+
24+
# error on unset variables
25+
set -u
26+
27+
${YQ_CLI} '.spec.version' ${CONFIG_CSV} > ${CACHED_CSV_VERSION} && \
28+
${YQ_CLI} '(.metadata.annotations.containerImage | split(":") | .[1])' ${CONFIG_CSV} > ${CACHED_CSV_CONTAINER_IMAGE_TAG} && \
29+
${YQ_CLI} "(.metadata.name | capture(\"(?P<tag>${VERSION_PATTERN})\") | .tag)" ${CONFIG_CSV} > ${CACHED_CSV_NAME_TAG} && \
30+
${YQ_CLI} '.spec.version' ${BUNDLE_CSV} > ${CACHED_BUNDLE_VERSION} && \
31+
${YQ_CLI} '(.metadata.annotations.containerImage | split(":") | .[1])' ${BUNDLE_CSV} > ${CACHED_BUNDLE_CONTAINER_IMAGE_TAG} && \
32+
${YQ_CLI} "(.metadata.name | capture(\"(?P<tag>${VERSION_PATTERN})\") | .tag)" ${BUNDLE_CSV} > ${CACHED_BUNDLE_NAME_TAG} && \
33+
${YQ_CLI} '.images[0].newTag' ${CONFIG_MANAGER_KUSTOMIZE} > ${CACHED_MANAGER_IMAGE_TAG}

.ci/minikube_integration.sh

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/bin/bash
2+
3+
#
4+
# Copyright Red Hat
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
# NOTE: This script assumes that minikube is installed and running, and using the docker driver on Linux
19+
# Due to networking issues with the docker driver and ingress on macOS/Windows, this script must be run on Linux
20+
21+
# Share docker env with Minikube
22+
eval $(minikube docker-env)
23+
24+
# error on unset variables
25+
set -u
26+
# print each command before executing it
27+
set -x
28+
29+
# Build the registry operator image
30+
export IMG=${REGISTRY_OPERATOR}
31+
make docker-build
32+
if [ $? -ne 0 ]; then
33+
echo "Error building registry operator image"
34+
exit 1;
35+
fi
36+
37+
# Install cert-manager
38+
make install-cert
39+
40+
# Wait for the cert-manager to become ready
41+
kubectl wait deploy/cert-manager --namespace cert-manager --for=condition=Available --timeout=600s
42+
kubectl wait deploy/cert-manager-cainjector --namespace cert-manager --for=condition=Available --timeout=600s
43+
kubectl wait deploy/cert-manager-webhook --namespace cert-manager --for=condition=Available --timeout=600s
44+
if [ $? -ne 0 ]; then
45+
echo "cert-manager-controller container logs:"
46+
kubectl logs -l app=cert-manager --namespace cert-manager --container cert-manager-controller
47+
echo "cert-manager-cainjector container logs:"
48+
kubectl logs -l app=cainjector --namespace cert-manager --container cert-manager-cainjector
49+
echo "cert-manager-webhook container logs:"
50+
kubectl logs -l app=webhook --namespace cert-manager --container cert-manager-webhook
51+
52+
# Return the description of every pod
53+
kubectl describe pods --namespace cert-manager
54+
exit 1
55+
fi
56+
57+
# Install CRDs & deploy registry operator
58+
make install && make deploy
59+
60+
# Wait for the registry operator to become ready
61+
kubectl wait deploy/registry-operator-controller-manager --namespace registry-operator-system --for=condition=Available --timeout=600s
62+
if [ $? -ne 0 ]; then
63+
echo "manager container logs:"
64+
kubectl logs -l app=devfileregistry-operator --namespace registry-operator-system --container manager
65+
echo "kube-rbac-proxy container logs:"
66+
kubectl logs -l app=devfileregistry-operator --namespace registry-operator-system --container kube-rbac-proxy
67+
68+
# Return the description of every pod
69+
kubectl describe pods --namespace registry-operator-system
70+
exit 1
71+
fi
72+
73+
# wait 15 seconds for registry operator to get set up
74+
sleep 15
75+
76+
# run integration test suite
77+
make test-integration

.ci/openshift_integration.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
#!/bin/bash
22

3-
#!/usr/bin/env bash
3+
#
4+
# Copyright Red Hat
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
418
# exit immediately when a command fails
519
set -e
620
# only exit with zero if all commands of the pipeline exit successfully

.codecov.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
#
2+
# Copyright Red Hat
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
116
# See http://docs.codecov.io/docs/coverage-configuration
217
coverage:
318
precision: 2 # 2 = xx.xx%, 0 = xx%

.github/workflows/ci.yaml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
#
2+
# Copyright Red Hat
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
115
name: Validate PRs
216

317
on:
@@ -9,18 +23,18 @@ jobs:
923
name: Check go sources
1024
runs-on: ubuntu-latest
1125
steps:
26+
-
27+
name: Check out code into the Go module directory
28+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
1229
-
1330
name: Set up Go 1.x
14-
uses: actions/setup-go@v2
31+
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
1532
with:
16-
go-version: 1.19
17-
-
18-
name: Check out code into the Go module directory
19-
uses: actions/checkout@v2
33+
go-version-file: 'go.mod'
2034
-
2135
name: Cache go modules
2236
id: cache-mod
23-
uses: actions/cache@v2
37+
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
2438
with:
2539
path: ~/go/pkg/mod
2640
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
@@ -72,7 +86,7 @@ jobs:
7286
run: make test
7387
-
7488
name: Upload coverage to Codecov
75-
uses: codecov/codecov-action@v2.1.0
89+
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
7690

7791
- name: Run Gosec Security Scanner
7892
run: |
@@ -85,7 +99,7 @@ jobs:
8599
fi
86100
87101
- name: Upload SARIF file
88-
uses: github/codeql-action/upload-sarif@v2
102+
uses: github/codeql-action/upload-sarif@74483a38d39275f33fcff5f35b679b5ca4a26a99 # 2.22.5
89103
with:
90104
# Path to SARIF file relative to the root of the repository
91105
sarif_file: gosec.sarif
@@ -96,7 +110,7 @@ jobs:
96110
steps:
97111
-
98112
name: Check out code into the Go module directory
99-
uses: actions/checkout@v2
113+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
100114
-
101115
name: Check if operator docker build is working
102116
run: docker build -f Dockerfile .
@@ -107,7 +121,7 @@ jobs:
107121
steps:
108122
-
109123
name: Check out code into the Go module directory
110-
uses: actions/checkout@v2
124+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
111125
-
112126
name: Build the operator's bundle image
113127
run: make bundle-build

.github/workflows/codecov.yaml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
#
2+
# Copyright Red Hat
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
115
name: Code Coverage Report
216
on:
317
push:
@@ -8,14 +22,14 @@ jobs:
822
runs-on: ubuntu-20.04
923
steps:
1024
- name: Checkout
11-
uses: actions/checkout@v2.3.1
25+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
1226
with:
1327
persist-credentials: false
1428
- name: Set up Go 1.x
15-
uses: actions/setup-go@v2
29+
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
1630
with:
17-
go-version: 1.19
31+
go-version-file: 'go.mod'
1832
- name: Run tests
1933
run: make test
2034
- name: Codecov
21-
uses: codecov/codecov-action@v2.1.0
35+
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4

.github/workflows/dockerimage-push.yaml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
#
2+
# Copyright Red Hat
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
115
name: Next Dockerimage
216

317
on:
@@ -10,9 +24,9 @@ jobs:
1024
runs-on: ubuntu-latest
1125
steps:
1226
- name: Checkout registry-operator source code
13-
uses: actions/checkout@v2
27+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
1428
- name: Docker Build & Push - Registry Operator Image
15-
uses: docker/[email protected].0
29+
uses: docker/build-push-action@3e7a4f6646880c6f63758d73ac32392d323eaf8f # v1.1.2
1630
with:
1731
username: ${{ secrets.QUAY_USERNAME }}
1832
password: ${{ secrets.QUAY_PASSWORD }}
@@ -26,9 +40,9 @@ jobs:
2640
runs-on: ubuntu-latest
2741
steps:
2842
- name: Checkout registry-operator source code
29-
uses: actions/checkout@v2
43+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
3044
- name: Build and push the Registry Operator Bundle to quay.io
31-
uses: docker/[email protected].0
45+
uses: docker/build-push-action@3e7a4f6646880c6f63758d73ac32392d323eaf8f # v1.1.2
3246
with:
3347
username: ${{ secrets.QUAY_USERNAME }}
3448
password: ${{ secrets.QUAY_PASSWORD }}

0 commit comments

Comments
 (0)