Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Add index tools #145

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ jobs:
- name: Deploy and Scorecard
run: |
sh .github/workflows/scripts/retrieve_and_run_operator_sdk.sh \
"v1.29.0" "5m" "quay.io/sec-eng-special/tang-operator-bundle" \
"v1.31.0" "5m" "quay.io/sec-eng-special/tang-operator-bundle" \
"${GITHUB_HEAD_REF}"
11 changes: 11 additions & 0 deletions tools/index_tools/tang_catalog_source_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: tang-operator
namespace: openshift-operators
spec:
displayName: tang-operator
publisher: Red Hat
sourceType: grpc
image: quay.io/sec-eng-special/tang-operator-index:VERSION_HERE

53 changes: 53 additions & 0 deletions tools/index_tools/tang_index.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash
# Parameters:
# 1 - sync image to quay.io/<repository>/ or registry-proxy.engineering.redhat.com/rh-osbs/tang-operator-bundle@sha256:fceb6d82cea8fd14be1b0ebc0333d314ec5bd2c88199c0aa63377d12c6f4db6e
# 2 - two parameters, $1 is for bundle; $2 is for release, format like 0.0.25-1
# Example:
# $0 "registry-proxy.engineering.redhat.com/rh-osbs/tang-operator-bundle:0.2.0-6"
# ./tang_index.sh registry-proxy.engineering.redhat.com/rh-osbs/tang-operator-bundle@sha256:a69a44c15bb0ca40a382dcd551f2e7ed06fe8ae8007df55feeeb8a1c33de6e7d 0.2.0-6
#
#
CONTAINER_MGR='docker'

usage() {
### echo './tang_index.sh registry-proxy.engineering.redhat.com/rh-osbs/tang-operator-bundle@sha256:a69a44c15bb0ca40a382dcd551f2e7ed06fe8ae8007df55feeeb8a1c33de6e7d 0.2.0-6'
echo './tang_index.sh quay.io/sec-eng-special/tang-operator-bundle:v0.2.0-6 0.2.0-6'
exit "$2"
}

while getopts "h" arg
do
case "${arg}" in
h) usage "$0" 0
;;
*) usage "$0" 1
;;
esac
done

CO_image_with_digest=$1
version=$2

digest=$(echo "${CO_image_with_digest}" | awk -F: '{print $2}')
sub_digest="${digest:0:12}"

"${CONTAINER_MGR}" login quay.io -u sarroutb
echo "sub_digest:${sub_digest}"

#1. Mirror bundle container image
echo -e "step 1 \n\n"

oc image mirror --filter-by-os=".*" --keep-manifest-list "${CO_image_with_digest}" quay.io/sec-eng-special/tang-operator-bundle-container:"${sub_digest}"
oc image mirror --filter-by-os=".*" --keep-manifest-list "${CO_image_with_digest}" quay.io/sec-eng-special/tang-operator-bundle-container:latest

#2. Build index image
echo -e "step 2 \n\n"
opm index add --bundles "${CO_image_with_digest}" --tag quay.io/sec-eng-special/tang-operator-index:v"${version}" -c ${CONTAINER_MGR}

#3. Push image index to quay.io/sec-eng-special/
echo -e "step 3 \n\n"
echo -e "${CONTAINER_MGR} push quay.io/sec-eng-special/tang-operator-index:v$version \n"
${CONTAINER_MGR} push quay.io/sec-eng-special/tang-operator-index:v"${version}"

#4. Substitute version in catalog source
sed -e "s@VERSION_HERE@v${version}@g" < tang_catalog_source_template.yaml > tang_catalog_source.yaml
49 changes: 49 additions & 0 deletions tools/index_tools/tang_install_catalog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash
echo "-------------------------------------"
echo "oc status"
oc status
echo "-------------------------------------"
sleep 1
echo "oc create -f tang_catalog_source.yaml"
oc create -f tang_catalog_source.yaml
echo "-------------------------------------"
sleep 1
echo "oc get catsrc -nopenshift-marketplace"
oc get catsrc -nopenshift-marketplace
echo "-------------------------------------"
sleep 1
echo "oc get pods -nopenshift-marketplace"
oc get pods -nopenshift-marketplace
echo "-------------------------------------"
sleep 1
echo "oc create -f tang_subscription.yaml"
oc create -f tang_subscription.yaml
echo "-------------------------------------"
echo "oc project"
oc project
echo "-------------------------------------"
sleep 1
echo "oc get sub"
oc get sub
echo "-------------------------------------"
sleep 1
echo "oc get ip"
oc get ip
echo "-------------------------------------"
sleep 1
echo "oc get jobs -nopenshift-marketplace"
oc get jobs -nopenshift-marketplace
echo "-------------------------------------"
sleep 1
echo "oc get pods -nopenshift-marketplace"
oc get pods -nopenshift-marketplace
echo "-------------------------------------"
sleep 1
echo "oc get csv"
oc get csv
echo "-------------------------------------"
sleep 1
echo "oc get pods"
oc get pods
echo "-------------------------------------"
sleep 1
13 changes: 13 additions & 0 deletions tools/index_tools/tang_subscription.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
labels:
operators.coreos.com/tang-operator.openshift-operators: ""
name: tang-operator
namespace: openshift-operators
spec:
channel: "alpha"
installPlanApproval: Automatic
name: tang-operator
source: tang-operator
sourceNamespace: openshift-marketplace
3 changes: 3 additions & 0 deletions tools/index_tools/tang_uninstall_catalog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
oc delete -f tang_subscription.yaml
oc delete -f tang_catalog_source.yaml