Skip to content

Commit 3c3550d

Browse files
mtnbikencclaude
andcommitted
[hack] Add data source and logic summary to create-release-tag.py
Documents the two catalog sources (bundle image for commit SHA, operator image for published date), the local git operations, and the step-by-step logic for commit resolution, tag date resolution, tag creation, and the push instruction — matching the style used in verify-release.py. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent bbcf9a3 commit 3c3550d

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

hack/create-release-tag.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,75 @@
2020
Pushing tags to the upstream openshift/windows-machine-config-operator
2121
repository requires write access granted by the repository administrators.
2222
Contact the WMCO team to have your GitHub account added before pushing.
23+
24+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
25+
DATA SOURCES
26+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
27+
28+
Red Hat Container Catalog (catalog.redhat.com)
29+
Bundle image: openshift4-wincw/windows-machine-config-operator-bundle
30+
Provides: build commit SHA. Newer images carry the full 40-character SHA
31+
in the org.opencontainers.image.revision OCI label. Older images that
32+
predate the label are handled by falling back to the short (7-character)
33+
hex SHA that Konflux publishes as an image tag alongside the version tag.
34+
35+
Operator image: openshift4-wincw/windows-machine-config-rhel9-operator
36+
Provides: push_date — the UTC timestamp when the image was published to the
37+
catalog. This is used as the tag date so the annotated tag timestamp
38+
reflects the actual release date rather than the date the tag was created.
39+
40+
Local git repository
41+
Provides: existing tag detection (prevents accidental overwrites), full SHA
42+
expansion from short SHAs via git rev-parse, commit existence verification
43+
to catch catalog/repo mismatches before the tag is written, and upstream
44+
remote detection for the post-creation push instruction.
45+
46+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
47+
LOGIC
48+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
49+
50+
1. COMMIT RESOLUTION
51+
Source: Bundle image catalog
52+
Data: org.opencontainers.image.revision label (preferred) or short hex
53+
image tag (fallback for images that predate the OCI label).
54+
Logic:
55+
• Scans the bundle catalog for the image whose tags include vX.Y.Z.
56+
• Prefers the full SHA from the OCI label; falls back to the short SHA tag.
57+
• Any SHA (full or short) is expanded to a full 40-character commit via
58+
git rev-parse and verified to exist locally. This catches catalog/repo
59+
mismatches (e.g. if the local clone is stale) before writing anything.
60+
• --commit skips the catalog lookup entirely and uses the provided value.
61+
Required for backport releases that were never shipped as a container
62+
image and therefore have no bundle catalog entry.
63+
64+
2. TAG DATE RESOLUTION
65+
Source: Operator image catalog
66+
Data: push_date field from the repository entry for the matching version.
67+
Logic:
68+
• The push_date is the UTC timestamp when the operator image was published.
69+
• Only the date portion (YYYY-MM-DD) is used; the time is fixed to noon UTC
70+
(12:00:00+0000) to produce an unambiguous, timezone-neutral timestamp.
71+
• The fixed noon time is set via GIT_COMMITTER_DATE when git tag is invoked,
72+
so it appears as the tag's creation date in git log and GitHub.
73+
• --date skips the catalog lookup and uses the provided date instead.
74+
75+
3. TAG CREATION
76+
Logic:
77+
• Tag name: vX.Y.Z
78+
• Tag message: "Windows Machine Config Operator vX.Y.Z"
79+
• Tag type: annotated (git tag -a), never lightweight.
80+
• The user is shown all resolved details — tag, message, full commit SHA
81+
with its source, and date with its source — and must confirm before the
82+
tag is written. This surfaces any unexpected catalog values before they
83+
become permanent.
84+
85+
4. PUSH INSTRUCTION
86+
Logic:
87+
• After creation, scans git remote -v for a remote whose URL contains
88+
"openshift/windows-machine-config-operator" and uses its configured name
89+
(commonly "upstream") in the suggested push command.
90+
• Falls back to the canonical SSH URL if no matching remote is found, so
91+
the command is always complete and immediately usable.
2392
"""
2493

2594
import argparse

0 commit comments

Comments
 (0)