Skip to content

Commit

Permalink
chore: update boilerplate
Browse files Browse the repository at this point in the history
Signed-off-by: ashish <asnaraya@redhat.com>
  • Loading branch information
ashishmax31 committed Jul 11, 2024
1 parent cb114d2 commit 42344e3
Show file tree
Hide file tree
Showing 21 changed files with 199 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .ci-operator.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
build_root_image:
name: boilerplate
namespace: openshift
tag: image-v5.0.0
tag: image-v5.0.1
10 changes: 0 additions & 10 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,3 @@ updates:
# don't upgrade boilerplate via these means
- dependency-name: "openshift4/ose-operator-registry"
# don't upgrade ose-operator-registry via these means
- package-ecosystem: gomod
directory: "/"
schedule:
interval: "weekly"
labels:
- "area/dependency"
- "ok-to-test"
commit-message:
prefix: fix
include: scope
33 changes: 18 additions & 15 deletions OWNERS_ALIASES
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@
aliases:
srep-functional-team-aurora:
- abyrne55
- bdematte
- boranx
- AlexVulaj
- dakotalongRH
- lnguyen1401
- luis-falcon
- rafael-azevedo
- reedcort
srep-functional-team-fedramp:
- tonytheleg
- theautoroboto
- rhdedgar
- katherinelc321
- robotmaxtron
- rojasreinold
- hbhushan3
- fsferraz-rh
srep-functional-team-hulk:
- a7vicky
- rendhalver
Expand All @@ -26,46 +28,42 @@ aliases:
- weherdh
- devppratik
srep-functional-team-orange:
- bergmannf
- bng0y
- typeid
- Makdaam
- mrWinston
- Nikokolas3270
- ninabauer
- RaphaelBut
- Tessg22
srep-functional-team-rocket:
- aliceh
- anispate
- bdmiller3
- clcollins
- mjlshen
- iamkirkbater
- Mhodesty
- nephomaniac
- tnierman
- yithian
srep-functional-team-security:
- gsleeman
- jaybeeunix
- sam-nguyen7
- wshearn
- dem4gus
- npecka
srep-functional-team-thor:
- bmeng
- MitaliBhalla
- hectorakemp
- feichashao
- Tafhim
- samanthajayasinghe
srep-functional-team-v1alpha1:
- iamkirkbater
- AlexVulaj
- T0MASD
- bergmannf
- dkeohane
- reedcort
- mrWinston
srep-functional-leads:
- rafael-azevedo
- iamkirkbater
- bng0y
- tonytheleg
- Nikokolas3270
- theautoroboto
- bmeng
- mjlshen
- sam-nguyen7
Expand All @@ -76,6 +74,11 @@ aliases:
- fahlmant
- dustman9000
- wanghaoran1988
- bng0y
sre-group-leads:
- apahim
- maorfr
- rogbas
srep-architects:
- jewzaam
- jharrington22
Expand Down
2 changes: 1 addition & 1 deletion boilerplate/_data/backing-image-tag
Original file line number Diff line number Diff line change
@@ -1 +1 @@
image-v5.0.0
image-v5.0.1
2 changes: 1 addition & 1 deletion boilerplate/_data/last-boilerplate-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
368331d7b41947c357275c024a610ae8652c1e53
f9278d902be2c77e2980ad785e9dc9c585a49828
4 changes: 2 additions & 2 deletions boilerplate/_lib/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ image_exists_in_repo() {
fi
echo "Image ${image_uri} exists with digest $digest."
return 0
elif [[ "$stderr" == *"manifest unknown"* ]]; then
elif [[ "$output" == *"manifest unknown"* || "$stderr" == *"manifest unknown"* ]]; then
# We were able to talk to the repository, but the tag doesn't exist.
# This is the normal "green field" case.
echo "Image ${image_uri} does not exist in the repository."
return 1
elif [[ "$stderr" == *"was deleted or has expired"* ]]; then
elif [[ "$output" == *"manifest unknown"* || "$stderr" == *"was deleted or has expired"* ]]; then
# This should be rare, but accounts for cases where we had to
# manually delete an image.
echo "Image ${image_uri} was deleted from the repository."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.redhat.io/openshift4/ose-operator-registry:v4.12 AS builder
FROM registry.redhat.io/openshift4/ose-operator-registry:v4.14 AS builder
ARG SAAS_OPERATOR_DIR
COPY ${SAAS_OPERATOR_DIR} manifests
RUN initializer --permissive
Expand All @@ -20,3 +20,6 @@ COPY --from=builder /registry /registry
EXPOSE 50051

CMD ["registry-server", "-t", "/tmp/terminate.log"]

# Set the DC specific label for the location of the DC database in the image
LABEL operators.operatorframework.io.index.database.v1=/registry/bundles.db
33 changes: 18 additions & 15 deletions boilerplate/openshift/golang-osd-operator/OWNERS_ALIASES
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@
aliases:
srep-functional-team-aurora:
- abyrne55
- bdematte
- boranx
- AlexVulaj
- dakotalongRH
- lnguyen1401
- luis-falcon
- rafael-azevedo
- reedcort
srep-functional-team-fedramp:
- tonytheleg
- theautoroboto
- rhdedgar
- katherinelc321
- robotmaxtron
- rojasreinold
- hbhushan3
- fsferraz-rh
srep-functional-team-hulk:
- a7vicky
- rendhalver
Expand All @@ -26,46 +28,42 @@ aliases:
- weherdh
- devppratik
srep-functional-team-orange:
- bergmannf
- bng0y
- typeid
- Makdaam
- mrWinston
- Nikokolas3270
- ninabauer
- RaphaelBut
- Tessg22
srep-functional-team-rocket:
- aliceh
- anispate
- bdmiller3
- clcollins
- mjlshen
- iamkirkbater
- Mhodesty
- nephomaniac
- tnierman
- yithian
srep-functional-team-security:
- gsleeman
- jaybeeunix
- sam-nguyen7
- wshearn
- dem4gus
- npecka
srep-functional-team-thor:
- bmeng
- MitaliBhalla
- hectorakemp
- feichashao
- Tafhim
- samanthajayasinghe
srep-functional-team-v1alpha1:
- iamkirkbater
- AlexVulaj
- T0MASD
- bergmannf
- dkeohane
- reedcort
- mrWinston
srep-functional-leads:
- rafael-azevedo
- iamkirkbater
- bng0y
- tonytheleg
- Nikokolas3270
- theautoroboto
- bmeng
- mjlshen
- sam-nguyen7
Expand All @@ -76,6 +74,11 @@ aliases:
- fahlmant
- dustman9000
- wanghaoran1988
- bng0y
sre-group-leads:
- apahim
- maorfr
- rogbas
srep-architects:
- jewzaam
- jharrington22
Expand Down
14 changes: 11 additions & 3 deletions boilerplate/openshift/golang-osd-operator/app-sre-build-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,18 @@ while read dockerfile_path image_uri junk; do
fi
done <<< "$3"

for channel in staging production; do
declare -A hash
if [[ "${RELEASE_BRANCHED_BUILDS}" ]]; then
hash[stable]=v${OPERATOR_VERSION}
else
hash[staging]=staging-${CURRENT_COMMIT}
hash[production]=production-${CURRENT_COMMIT}
fi
for channel in "${!hash[@]}"; do
tag=${hash[$channel]}
# If the catalog image already exists, short out
if image_exists_in_repo "${REGISTRY_IMAGE}:${channel}-${CURRENT_COMMIT}"; then
echo "Catalog image ${REGISTRY_IMAGE}:${channel}-${CURRENT_COMMIT} already "
if image_exists_in_repo "${REGISTRY_IMAGE}:${tag}"; then
echo "Catalog image ${REGISTRY_IMAGE}:${tag} already "
echo "exists. Assuming this means the saas bundle work has also been done "
echo "properly. Nothing to do!"
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ channels:
currentCSV: ${operator_name}.v${OPERATOR_NEW_VERSION}
EOF

${CONTAINER_ENGINE} build --pull -f "${DOCKERFILE_REGISTRY}" --build-arg "SAAS_OPERATOR_DIR=${SAAS_OPERATOR_DIR}" --tag "${registry_image}:${operator_channel}-latest" .
TAG="${operator_channel}-latest"
if [[ "${RELEASE_BRANCHED_BUILDS}" ]]; then
TAG="v${OPERATOR_NEW_VERSION}"
fi

${CONTAINER_ENGINE} build --pull -f "${DOCKERFILE_REGISTRY}" --build-arg "SAAS_OPERATOR_DIR=${SAAS_OPERATOR_DIR}" --tag "${registry_image}:${TAG}" .

if [ $? -ne 0 ] ; then
echo "docker build failed, exiting..."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ replaces ${OPERATOR_PREV_VERSION}
removed versions: ${REMOVED_VERSIONS}"

git commit -m "${MESSAGE}"
git push origin "${operator_channel}"
git push origin HEAD

if [ $? -ne 0 ] ; then
echo "git push failed, exiting..."
Expand All @@ -95,6 +95,19 @@ popd

if [ "$push_catalog" = true ] ; then
# push image
if [[ "${RELEASE_BRANCHED_BUILDS}" ]]; then
skopeo copy --dest-creds "${QUAY_USER}:${QUAY_TOKEN}" \
"${SRC_CONTAINER_TRANSPORT}:${registry_image}:v${OPERATOR_NEW_VERSION}" \
"docker://${registry_image}:v${OPERATOR_NEW_VERSION}"

if [ $? -ne 0 ] ; then
echo "skopeo push of ${registry_image}:v${OPERATOR_NEW_VERSION}-latest failed, exiting..."
exit 1
fi

exit 0
fi

skopeo copy --dest-creds "${QUAY_USER}:${QUAY_TOKEN}" \
"${SRC_CONTAINER_TRANSPORT}:${registry_image}:${operator_channel}-latest" \
"docker://${registry_image}:${operator_channel}-latest"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@

hasMultipleDeployments = False

# Verify that this is not creating a cycle.
if prev_version == full_version:
print(
"Previous version equals current version. "
"This would result in a cycle that can not be installed - aborting."
)
sys.exit(1)


class UnsupportedRegistryResourceKind(Exception):
def __init__(self, kind, path):
super().__init__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,25 @@ production-catalog-build-and-publish:
@$(MAKE) -s production-csv-build --no-print-directory
@$(MAKE) -s production-catalog-build --no-print-directory
@$(MAKE) -s production-catalog-publish --no-print-directory

.PHONY: stable-csv-build
stable-csv-build:
@${CONVENTION_DIR}/csv-generate/csv-generate.sh -o $(OPERATOR_NAME) -i $(OPERATOR_IMAGE) -V $(OPERATOR_VERSION) -c stable -H $(CURRENT_COMMIT) -n $(COMMIT_NUMBER) -s $(SUPPLEMENTARY_IMAGE) -e $(SKIP_RANGE_ENABLED)

.PHONY: stable-catalog-build
stable-catalog-build:
@${CONVENTION_DIR}/csv-generate/catalog-build.sh -o $(OPERATOR_NAME) -c stable -r ${REGISTRY_IMAGE}

.PHONY: stable-saas-bundle-push
stable-saas-bundle-push:
@${CONVENTION_DIR}/csv-generate/catalog-publish.sh -o $(OPERATOR_NAME) -c stable -H $(CURRENT_COMMIT) -n $(COMMIT_NUMBER) -r ${REGISTRY_IMAGE}

.PHONY: stable-catalog-publish
stable-catalog-publish:
@${CONVENTION_DIR}/csv-generate/catalog-publish.sh -o $(OPERATOR_NAME) -c stable -H $(CURRENT_COMMIT) -n $(COMMIT_NUMBER) -p -r ${REGISTRY_IMAGE}

.PHONY: stable-catalog-build-and-publish
stable-catalog-build-and-publish:
@$(MAKE) -s stable-csv-build --no-print-directory
@$(MAKE) -s stable-catalog-build --no-print-directory
@$(MAKE) -s stable-catalog-publish --no-print-directory
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,26 @@ SAAS_OPERATOR_DIR="saas-${operator_name}-bundle"
BUNDLE_DIR="$SAAS_OPERATOR_DIR/${operator_name}/"

rm -rf "$SAAS_OPERATOR_DIR"
git clone --branch "$operator_channel" ${GIT_PATH} "$SAAS_OPERATOR_DIR"
BRANCH="$operator_channel"
if [[ "${RELEASE_BRANCHED_BUILDS}" ]]; then
# operator version will be set to `X.Y.BUILD_NUMBER-commit sha`, this will
# be `release-X.Y`
BRANCH="release-${operator_version%.*}"
fi

if [[ "${RELEASE_BRANCHED_BUILDS}" ]]; then
git clone ${GIT_PATH} "$SAAS_OPERATOR_DIR"
pushd "${SAAS_OPERATOR_DIR}"
# if branch doesn't exist, checkout a new branch based on main/master
if git ls-remote --exit-code --heads "${GIT_PATH}" "${BRANCH}"; then
git checkout "${BRANCH}"
else
git checkout -b "${BRANCH}"
fi
popd
else
git clone --branch "$operator_channel" ${GIT_PATH} "$SAAS_OPERATOR_DIR"
fi

# If this is a brand new SaaS setup, then set up accordingly
if [[ ! -d "${BUNDLE_DIR}" ]]; then
Expand Down Expand Up @@ -165,6 +184,15 @@ OPERATOR_PREV_VERSION=$(ls "$BUNDLE_DIR" | sort -t . -k 3 -g | tail -n 1)
OPERATOR_NEW_VERSION="${operator_version}"
OUTPUT_DIR=${BUNDLE_DIR}

VERSION_DIR="${OUTPUT_DIR}/${OPERATOR_NEW_VERSION}"

# Check if the VERSION_DIR already exists and is not empty - if so skip building
# anything, as only timestamps would be changed.
if [[ -d "${VERSION_DIR}" && -n $(ls -A "${VERSION_DIR}") ]]; then
echo "Output directory for bundle already exists and is not empty: ${VERSION_DIR}. Skipping bundle creation."
exit 0
fi

# If setting up a new SaaS repo, there is no previous version when building a bundle
# Optionally pass it to the bundle generator in that case.
if [[ -z "${OPERATOR_PREV_VERSION}" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion boilerplate/openshift/golang-osd-operator/ensure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -eo pipefail
REPO_ROOT=$(git rev-parse --show-toplevel)
source $REPO_ROOT/boilerplate/_lib/common.sh

GOLANGCI_LINT_VERSION="1.54.2"
GOLANGCI_LINT_VERSION="1.59.1"
OPM_VERSION="v1.23.2"
GRPCURL_VERSION="1.7.0"
DEPENDENCY=${1:-}
Expand Down
Loading

0 comments on commit 42344e3

Please sign in to comment.