Skip to content

Commit

Permalink
v0.2.0 (#63)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Valdron <mvaldron@redhat.com>
  • Loading branch information
michael-valdron committed Nov 20, 2023
1 parent cb48fbd commit 682f891
Show file tree
Hide file tree
Showing 34 changed files with 827 additions and 473 deletions.
33 changes: 33 additions & 0 deletions .ci/cache_version_tags.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

#
# Copyright Red Hat
#
# Licensed 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.

VERSION_PATTERN="v[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?"
CONFIG_CSV='config/manifests/bases/registry-operator.clusterserviceversion.yaml'
CONFIG_MANAGER_KUSTOMIZE='config/manager/kustomization.yaml'
BUNDLE_CSV='bundle/manifests/registry-operator.clusterserviceversion.yaml'
YQ_CLI=${YQ_CLI:-yq}

# error on unset variables
set -u

${YQ_CLI} '.spec.version' ${CONFIG_CSV} > ${CACHED_CSV_VERSION} && \
${YQ_CLI} '(.metadata.annotations.containerImage | split(":") | .[1])' ${CONFIG_CSV} > ${CACHED_CSV_CONTAINER_IMAGE_TAG} && \
${YQ_CLI} "(.metadata.name | capture(\"(?P<tag>${VERSION_PATTERN})\") | .tag)" ${CONFIG_CSV} > ${CACHED_CSV_NAME_TAG} && \
${YQ_CLI} '.spec.version' ${BUNDLE_CSV} > ${CACHED_BUNDLE_VERSION} && \
${YQ_CLI} '(.metadata.annotations.containerImage | split(":") | .[1])' ${BUNDLE_CSV} > ${CACHED_BUNDLE_CONTAINER_IMAGE_TAG} && \
${YQ_CLI} "(.metadata.name | capture(\"(?P<tag>${VERSION_PATTERN})\") | .tag)" ${BUNDLE_CSV} > ${CACHED_BUNDLE_NAME_TAG} && \
${YQ_CLI} '.images[0].newTag' ${CONFIG_MANAGER_KUSTOMIZE} > ${CACHED_MANAGER_IMAGE_TAG}
77 changes: 77 additions & 0 deletions .ci/minikube_integration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash

#
# Copyright Red Hat
#
# Licensed 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.

# NOTE: This script assumes that minikube is installed and running, and using the docker driver on Linux
# Due to networking issues with the docker driver and ingress on macOS/Windows, this script must be run on Linux

# Share docker env with Minikube
eval $(minikube docker-env)

# error on unset variables
set -u
# print each command before executing it
set -x

# Build the registry operator image
export IMG=${REGISTRY_OPERATOR}
make docker-build
if [ $? -ne 0 ]; then
echo "Error building registry operator image"
exit 1;
fi

# Install cert-manager
make install-cert

# Wait for the cert-manager to become ready
kubectl wait deploy/cert-manager --namespace cert-manager --for=condition=Available --timeout=600s
kubectl wait deploy/cert-manager-cainjector --namespace cert-manager --for=condition=Available --timeout=600s
kubectl wait deploy/cert-manager-webhook --namespace cert-manager --for=condition=Available --timeout=600s
if [ $? -ne 0 ]; then
echo "cert-manager-controller container logs:"
kubectl logs -l app=cert-manager --namespace cert-manager --container cert-manager-controller
echo "cert-manager-cainjector container logs:"
kubectl logs -l app=cainjector --namespace cert-manager --container cert-manager-cainjector
echo "cert-manager-webhook container logs:"
kubectl logs -l app=webhook --namespace cert-manager --container cert-manager-webhook

# Return the description of every pod
kubectl describe pods --namespace cert-manager
exit 1
fi

# Install CRDs & deploy registry operator
make install && make deploy

# Wait for the registry operator to become ready
kubectl wait deploy/registry-operator-controller-manager --namespace registry-operator-system --for=condition=Available --timeout=600s
if [ $? -ne 0 ]; then
echo "manager container logs:"
kubectl logs -l app=devfileregistry-operator --namespace registry-operator-system --container manager
echo "kube-rbac-proxy container logs:"
kubectl logs -l app=devfileregistry-operator --namespace registry-operator-system --container kube-rbac-proxy

# Return the description of every pod
kubectl describe pods --namespace registry-operator-system
exit 1
fi

# wait 15 seconds for registry operator to get set up
sleep 15

# run integration test suite
make test-integration
16 changes: 15 additions & 1 deletion .ci/openshift_integration.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
#!/bin/bash

#!/usr/bin/env bash
#
# Copyright Red Hat
#
# Licensed 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.

# exit immediately when a command fails
set -e
# only exit with zero if all commands of the pipeline exit successfully
Expand Down
15 changes: 15 additions & 0 deletions .codecov.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#
# Copyright Red Hat
#
# Licensed 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.

# See http://docs.codecov.io/docs/coverage-configuration
coverage:
precision: 2 # 2 = xx.xx%, 0 = xx%
Expand Down
34 changes: 24 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#
# Copyright Red Hat
#
# Licensed 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: Validate PRs

on:
Expand All @@ -9,18 +23,18 @@ jobs:
name: Check go sources
runs-on: ubuntu-latest
steps:
-
name: Check out code into the Go module directory
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
-
name: Set up Go 1.x
uses: actions/setup-go@v2
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: 1.19
-
name: Check out code into the Go module directory
uses: actions/checkout@v2
go-version-file: 'go.mod'
-
name: Cache go modules
id: cache-mod
uses: actions/cache@v2
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
Expand Down Expand Up @@ -72,7 +86,7 @@ jobs:
run: make test
-
name: Upload coverage to Codecov
uses: codecov/codecov-action@v2.1.0
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4

- name: Run Gosec Security Scanner
run: |
Expand All @@ -85,7 +99,7 @@ jobs:
fi
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@74483a38d39275f33fcff5f35b679b5ca4a26a99 # 2.22.5
with:
# Path to SARIF file relative to the root of the repository
sarif_file: gosec.sarif
Expand All @@ -96,7 +110,7 @@ jobs:
steps:
-
name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
-
name: Check if operator docker build is working
run: docker build -f Dockerfile .
Expand All @@ -107,7 +121,7 @@ jobs:
steps:
-
name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
-
name: Build the operator's bundle image
run: make bundle-build
22 changes: 18 additions & 4 deletions .github/workflows/codecov.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#
# Copyright Red Hat
#
# Licensed 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: Code Coverage Report
on:
push:
Expand All @@ -8,14 +22,14 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2.3.1
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
persist-credentials: false
- name: Set up Go 1.x
uses: actions/setup-go@v2
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: 1.19
go-version-file: 'go.mod'
- name: Run tests
run: make test
- name: Codecov
uses: codecov/codecov-action@v2.1.0
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
22 changes: 18 additions & 4 deletions .github/workflows/dockerimage-push.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#
# Copyright Red Hat
#
# Licensed 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: Next Dockerimage

on:
Expand All @@ -10,9 +24,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout registry-operator source code
uses: actions/checkout@v2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Docker Build & Push - Registry Operator Image
uses: docker/build-push-action@v1.1.0
uses: docker/build-push-action@3e7a4f6646880c6f63758d73ac32392d323eaf8f # v1.1.2
with:
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
Expand All @@ -26,9 +40,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout registry-operator source code
uses: actions/checkout@v2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Build and push the Registry Operator Bundle to quay.io
uses: docker/build-push-action@v1.1.0
uses: docker/build-push-action@3e7a4f6646880c6f63758d73ac32392d323eaf8f # v1.1.2
with:
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
Expand Down
Loading

0 comments on commit 682f891

Please sign in to comment.