-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #290 from dprince/related_images
Support disconnected network environments
- Loading branch information
Showing
6 changed files
with
7 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,13 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
CLUSTER_BUNDLE_FILE="bundle/manifests/glance-operator.clusterserviceversion.yaml" | ||
|
||
echo "Creating glance operator bundle" | ||
cd .. | ||
echo "${GITHUB_SHA}" | ||
echo "${BASE_IMAGE}" | ||
skopeo --version | ||
|
||
echo "Calculating image digest for docker://${REGISTRY}/${BASE_IMAGE}:${GITHUB_SHA}" | ||
DIGEST=$(skopeo inspect docker://${REGISTRY}/${BASE_IMAGE}:${GITHUB_SHA} | jq '.Digest' -r) | ||
# Output: | ||
# Calculating image digest for docker://quay.io/openstack-k8s-operators/glance-operator:d03f2c1c362c04fc5ef819f92a218f9ea59bbd0c | ||
# Digest: sha256:1d5b578fd212f8dbd03c0235f1913ef738721766f8c94236af5efecc6d8d8cb1 | ||
echo "Digest: ${DIGEST}" | ||
|
||
RELEASE_VERSION=$(grep "^VERSION" Makefile | awk -F'?= ' '{ print $2 }') | ||
OPERATOR_IMG_WITH_DIGEST="${REGISTRY}/${BASE_IMAGE}@${DIGEST}" | ||
|
||
echo "New Operator Image with Digest: $OPERATOR_IMG_WITH_DIGEST" | ||
echo "Release Version: $RELEASE_VERSION" | ||
|
||
echo "Creating bundle image..." | ||
VERSION=$RELEASE_VERSION IMG=$OPERATOR_IMG_WITH_DIGEST make bundle | ||
|
||
echo "Bundle file images:" | ||
cat "${CLUSTER_BUNDLE_FILE}" | grep "image:" | ||
# FIXME: display any ENV variables once we have offline support implemented | ||
#grep -A1 IMAGE_URL_DEFAULT "${CLUSTER_BUNDLE_FILE}" | ||
|
||
# We do not want to exit here. Some images are in different registries, so | ||
# error will be reported to the console. | ||
set +e | ||
for csv_image in $(cat "${CLUSTER_BUNDLE_FILE}" | grep "image:" | sed -e "s|.*image:||" | sort -u); do | ||
digest_image="" | ||
echo "CSV line: ${csv_image}" | ||
|
||
# case where @ is in the csv_image image | ||
if [[ "$csv_image" =~ .*"@".* ]]; then | ||
delimeter='@' | ||
else | ||
delimeter=':' | ||
fi | ||
|
||
base_image=$(echo $csv_image | cut -f 1 -d${delimeter}) | ||
tag_image=$(echo $csv_image | cut -f 2 -d${delimeter}) | ||
digest_image=$(skopeo inspect docker://${base_image}${delimeter}${tag_image} | jq '.Digest' -r) | ||
echo "Base image: $base_image" | ||
if [ -n "$digest_image" ]; then | ||
echo "$base_image${delimeter}$tag_image becomes $base_image@$digest_image" | ||
sed -i "s|$base_image$delimeter$tag_image|$base_image@$digest_image|g" "${CLUSTER_BUNDLE_FILE}" | ||
else | ||
echo "$base_image${delimeter}$tag_image not changed" | ||
fi | ||
done | ||
|
||
echo "Resulting bundle file images:" | ||
cat "${CLUSTER_BUNDLE_FILE}" | grep "image:" | ||
|
||
# FIXME: display any ENV variables once we have offline support implemented | ||
#grep -A1 IMAGE_URL_DEFAULT "${CLUSTER_BUNDLE_FILE}" | ||
USE_IMAGE_DIGESTS=true VERSION=$RELEASE_VERSION IMG=${REGISTRY}/${BASE_IMAGE}:${GITHUB_SHA} make bundle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export USE_IMAGE_DIGESTS=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters