Skip to content

Instantly share code, notes, and snippets.

@rbo
Created November 20, 2019 16:10
Show Gist options
  • Save rbo/2671a8f704cef0c5192b520e371f1831 to your computer and use it in GitHub Desktop.
Save rbo/2671a8f704cef0c5192b520e371f1831 to your computer and use it in GitHub Desktop.
OLM air-gapped notes
#!/usr/bin/env bash
set -e
for REPO in redhat-operators community-operators certified-operators ; do
echo "# Fetch packages.${REPO}.json"
curl -s https://quay.io/cnr/api/v1/packages?namespace=$REPO > packages.${REPO}.json
rm -rf $REPO
mkdir $REPO
cat packages.${REPO}.json | jq -r '.[] | .name + "/" +.default' | while read line ; do
echo "# Fetch $line"
# $line=redhat-operators/amq-streams/4.0.0 to $PACKAGE=redhat-operators/amq-streams
PACKAGE=${line%/*}
echo "# ${line%/*}"
DIGEST=$(curl -s https://quay.io/cnr/api/v1/packages/$line | jq -r '.[0].content.digest' )
echo "# Download $PACKAGE.tar.gz"
curl -s https://quay.io/cnr/api/v1/packages/${PACKAGE}/blobs/sha256/${DIGEST} -o ${PACKAGE}.tar.gz
echo "# Unpack $PACKAGE.tar.gz -> $PACKAGE/"
mkdir -p $PACKAGE
tar -C $PACKAGE -xzf $PACKAGE.tar.gz
done
done
FROM registry.redhat.io/openshift4/ose-operator-registry:v4.2.0 as builder
ENV sdf=asdfsaa
COPY community-operators/openshift-pipelines-operator manifests
RUN /usr/bin/initializer -o /registry/bundles.db
#FROM scratch
FROM registry.redhat.io/openshift4/ose-operator-registry:v4.2.0
COPY --from=builder /registry/bundles.db /bundles.db
COPY --from=builder /usr/bin/registry-server /registry-server
COPY --from=builder /usr/bin/grpc_health_probe /bin/grpc_health_probe
EXPOSE 50051
ENTRYPOINT ["/registry-server"]
CMD ["--database", "/bundles.db"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment