Skip to content

Commit be3a3d3

Browse files
committed
Use oc adm release info --commits
This simplifies the command down into a single `oc` call. More importantly, it seems to work with the nightly releases as well (which don't work for me otherwise). E.g. this works just fine: $ ./oc-image-commit.sh registry.svc.ci.openshift.org/ocp/release:4.2.0-0.nightly-2019-09-01-224700 cluster-machine-approver But it doesn't with the previous version or the original `get-image-commit.sh` script.
1 parent 13c8168 commit be3a3d3

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Diff for: oc-image-commit.sh

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ else
1010
CLUSTER_IMAGE_NAME=$2
1111
fi
1212

13-
CLUSTER_IMAGE_REF="$(oc adm release info --image-for=$CLUSTER_IMAGE_NAME $RELEASE_IMAGE)"
14-
1513
echo
16-
echo "Cluster image: $CLUSTER_IMAGE_REF"
1714
echo "$CLUSTER_IMAGE_NAME commit in $RELEASE_IMAGE:"
18-
echo $(oc image info --output json "$CLUSTER_IMAGE_REF" | jq --raw-output '.config.config.Labels["vcs-url"] + "/commits/" + .config.config.Labels["vcs-ref"]')
15+
oc adm release info "$RELEASE_IMAGE" --commits -o json | jq --raw-output ".references.spec.tags[] | select(.name == \"$CLUSTER_IMAGE_NAME\") | .annotations.\"io.openshift.build.source-location\" + \"/commits/\" + .annotations.\"io.openshift.build.commit.id\""

0 commit comments

Comments
 (0)