From 57b11cc3d46b93de58193d50082e3e6eb14ead0c Mon Sep 17 00:00:00 2001 From: Joseph Date: Thu, 17 Jul 2025 12:38:10 -0400 Subject: [PATCH 1/7] Add release workflow for automated GitHub releases - Triggers on version tags (v*) - Builds all 6 architectures using existing make release-build - Creates proper tar.gz archives with LICENSE - Generates SHA256 checksums - Creates GitHub release with all artifacts --- .github/workflows/release.yml | 109 ++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..88f645ae --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,109 @@ +name: Release + +on: + push: + tags: + - 'v*' + +jobs: + release: + name: Create Release + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + cache: true + + - name: Build all architectures + run: | + set -e + echo "Building all architectures for release..." + if ! make release-build; then + echo "❌ Build failed" + exit 1 + fi + echo "✅ All builds completed" + + - name: Create release archives + run: | + set -e + echo "Creating release archives..." + + # Create archives for each binary + for binary in kubectl-oadp-*; do + if [[ -f "$binary" ]]; then + # Extract platform info from filename + platform=$(echo "$binary" | sed 's/kubectl-oadp-//') + echo "Creating archive for $platform..." + + # Create archive + if [[ "$platform" == *"windows"* ]]; then + # Windows binary should be .exe + cp "$binary" kubectl-oadp.exe + tar -czf "kubectl-oadp-${platform}.tar.gz" kubectl-oadp.exe LICENSE + rm kubectl-oadp.exe + else + # Unix binary + cp "$binary" kubectl-oadp + tar -czf "kubectl-oadp-${platform}.tar.gz" kubectl-oadp LICENSE + rm kubectl-oadp + fi + + echo "✅ Created kubectl-oadp-${platform}.tar.gz" + fi + done + + echo "" + echo "Release archives created:" + ls -la *.tar.gz + + - name: Generate SHA256 checksums + run: | + set -e + echo "Generating SHA256 checksums..." + sha256sum *.tar.gz > checksums.txt + echo "" + echo "Checksums:" + cat checksums.txt + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + with: + files: | + *.tar.gz + checksums.txt + body: | + ## OADP CLI ${{ github.ref_name }} + + Cross-platform kubectl plugin for managing OpenShift API for Data Protection (OADP) backup and restore operations. + + ### Installation + + #### Via krew (recommended) + ```bash + kubectl krew install oadp + ``` + + #### Manual installation + 1. Download the appropriate binary for your platform + 2. Extract the archive + 3. Add the binary to your PATH + 4. Verify installation: `kubectl oadp --help` + + ### Supported Platforms + - Linux (amd64, arm64) + - macOS (amd64, arm64) + - Windows (amd64, arm64) + + ### Checksums + SHA256 checksums are provided in `checksums.txt` for verification. + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From e6f0bb7f5d52bf8b83afdf7b76fe75739426a64a Mon Sep 17 00:00:00 2001 From: Joseph Date: Thu, 17 Jul 2025 12:57:51 -0400 Subject: [PATCH 2/7] Fix Go cache issues in release workflow - Disable Go cache to avoid tar restoration conflicts - Add explicit cache cleaning for fresh builds - Download and verify dependencies explicitly - Ensures clean build environment for releases --- .github/workflows/release.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 88f645ae..242c2975 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,20 @@ jobs: uses: actions/setup-go@v5 with: go-version-file: 'go.mod' - cache: true + cache: false + + - name: Clean Go environment + run: | + echo "Cleaning Go environment for fresh build..." + go clean -cache -modcache -i -r || true + echo "Go environment cleaned" + + - name: Download dependencies + run: | + echo "Downloading fresh dependencies..." + go mod download + go mod verify + echo "Dependencies ready" - name: Build all architectures run: | From b562fa0e27e5cef085f37cdff4944a088b918c24 Mon Sep 17 00:00:00 2001 From: Joseph Date: Thu, 17 Jul 2025 15:40:55 -0400 Subject: [PATCH 3/7] Add automated krew manifest generation with Python - Generate final kubectl-oadp.yaml with real SHA256 checksums - Use Python for readable and maintainable string processing - Include final manifest as release artifact - Update release notes with installation instructions - Ready for krew index submission automation --- .github/workflows/release.yml | 100 +++++++++++++++++++++++++++++++++- 1 file changed, 98 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 242c2975..b4ba352b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -85,12 +85,97 @@ jobs: echo "Checksums:" cat checksums.txt + - name: Generate final krew manifest + run: | + set -e + echo "Generating final krew manifest with version ${{ github.ref_name }}..." + + python3 << 'EOF' + import re + import sys + + # Read the template manifest + with open('oadp.yaml', 'r') as f: + manifest = f.read() + + # Read checksums + checksums = {} + with open('checksums.txt', 'r') as f: + for line in f: + sha, filename = line.strip().split(' ') + # Extract platform from filename (e.g., kubectl-oadp-linux-amd64.tar.gz -> linux-amd64) + platform = filename.replace('kubectl-oadp-', '').replace('.tar.gz', '') + checksums[platform] = sha + + # Get version from GitHub ref + version = "${{ github.ref_name }}" + print(f"Using version: {version}") + + # Update version field + manifest = re.sub(r'version: v\d+\.\d+\.\d+', f'version: {version}', manifest) + + # Update download URLs with correct version + manifest = re.sub( + r'/download/v\d+\.\d+\.\d+/', + f'/download/{version}/', + manifest + ) + + # Update SHA256 checksums for each platform + platform_map = { + 'linux-amd64': 'linux-amd64', + 'linux-arm64': 'linux-arm64', + 'darwin-amd64': 'darwin-amd64', + 'darwin-arm64': 'darwin-arm64', + 'windows-amd64': 'windows-amd64', + 'windows-arm64': 'windows-arm64' + } + + for platform, checksum_key in platform_map.items(): + if checksum_key in checksums: + sha = checksums[checksum_key] + print(f"Updating {platform}: {sha}") + + # Find the section for this platform and update its SHA256 + pattern = f'kubectl-oadp-{platform}\.tar\.gz.*?sha256: ""' + replacement = f'kubectl-oadp-{platform}.tar.gz\n sha256: "{sha}"' + manifest = re.sub(pattern, replacement, manifest, flags=re.DOTALL) + else: + print(f"❌ No checksum found for {platform}") + sys.exit(1) + + # Validate no empty SHA256 values remain + if 'sha256: ""' in manifest: + print("❌ Some SHA256 values are still empty!") + empty_lines = [line for line in manifest.split('\n') if 'sha256: ""' in line] + for line in empty_lines: + print(f" {line.strip()}") + sys.exit(1) + + # Write final manifest + with open('kubectl-oadp.yaml', 'w') as f: + f.write(manifest) + + print("✅ Final krew manifest generated successfully!") + + # Show summary + print(f"\nSummary:") + print(f"Version: {version}") + for platform, sha in checksums.items(): + print(f"{platform}: {sha[:16]}...") + EOF + + echo "" + echo "Final manifest preview:" + grep -E "(version:|sha256:)" kubectl-oadp.yaml + - name: Create GitHub Release uses: softprops/action-gh-release@v1 with: files: | *.tar.gz checksums.txt + kubectl-oadp.yaml body: | ## OADP CLI ${{ github.ref_name }} @@ -103,6 +188,12 @@ jobs: kubectl krew install oadp ``` + #### Via krew manifest (for testing or custom indexes) + ```bash + curl -LO https://github.com/migtools/oadp-cli/releases/download/${{ github.ref_name }}/kubectl-oadp.yaml + kubectl krew install --manifest=kubectl-oadp.yaml + ``` + #### Manual installation 1. Download the appropriate binary for your platform 2. Extract the archive @@ -114,8 +205,13 @@ jobs: - macOS (amd64, arm64) - Windows (amd64, arm64) - ### Checksums - SHA256 checksums are provided in `checksums.txt` for verification. + ### Files Included + - **Binary archives**: Platform-specific kubectl-oadp binaries with LICENSE + - **checksums.txt**: SHA256 checksums for all binaries + - **kubectl-oadp.yaml**: Final krew plugin manifest with populated SHA256 values + + ### For Krew Index Maintainers + The `kubectl-oadp.yaml` file contains the complete krew plugin manifest with all SHA256 checksums populated and can be used directly for krew index submissions. draft: false prerelease: false env: From a25dd2a314dcc7aa9706c323fbbada5f8d8784a6 Mon Sep 17 00:00:00 2001 From: Joseph Date: Thu, 17 Jul 2025 15:44:46 -0400 Subject: [PATCH 4/7] Convert oadp.yaml to proper template for automation - Use v0.0.0 as template version placeholder - All URLs now use consistent template version - Add missing windows-arm64 platform (matches workflow builds) - Ready for Python automation to populate real versions and SHA256s --- oadp.yaml | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/oadp.yaml b/oadp.yaml index 86069734..f103cd2e 100644 --- a/oadp.yaml +++ b/oadp.yaml @@ -3,7 +3,7 @@ kind: Plugin metadata: name: oadp spec: - version: v1.0.0 + version: v0.0.0 homepage: https://github.com/migtools/oadp-cli shortDescription: Manage OpenShift API for Data Protection (OADP) backup and restore operations description: | @@ -32,7 +32,7 @@ spec: matchLabels: os: linux arch: amd64 - uri: https://github.com/migtools/oadp-cli/releases/download/v1.0.0/kubectl-oadp-linux-amd64.tar.gz + uri: https://github.com/migtools/oadp-cli/releases/download/v0.0.0/kubectl-oadp-linux-amd64.tar.gz sha256: "" files: - from: kubectl-oadp @@ -44,7 +44,7 @@ spec: matchLabels: os: linux arch: arm64 - uri: https://github.com/migtools/oadp-cli/releases/download/v1.0.0/kubectl-oadp-linux-arm64.tar.gz + uri: https://github.com/migtools/oadp-cli/releases/download/v0.0.0/kubectl-oadp-linux-arm64.tar.gz sha256: "" files: - from: kubectl-oadp @@ -56,7 +56,7 @@ spec: matchLabels: os: darwin arch: amd64 - uri: https://github.com/migtools/oadp-cli/releases/download/v1.0.0/kubectl-oadp-darwin-amd64.tar.gz + uri: https://github.com/migtools/oadp-cli/releases/download/v0.0.0/kubectl-oadp-darwin-amd64.tar.gz sha256: "" files: - from: kubectl-oadp @@ -68,7 +68,7 @@ spec: matchLabels: os: darwin arch: arm64 - uri: https://github.com/migtools/oadp-cli/releases/download/v1.0.0/kubectl-oadp-darwin-arm64.tar.gz + uri: https://github.com/migtools/oadp-cli/releases/download/v0.0.0/kubectl-oadp-darwin-arm64.tar.gz sha256: "" files: - from: kubectl-oadp @@ -80,11 +80,23 @@ spec: matchLabels: os: windows arch: amd64 - uri: https://github.com/migtools/oadp-cli/releases/download/v1.0.0/kubectl-oadp-windows-amd64.tar.gz + uri: https://github.com/migtools/oadp-cli/releases/download/v0.0.0/kubectl-oadp-windows-amd64.tar.gz sha256: "" files: - from: kubectl-oadp.exe to: . - from: LICENSE to: . - bin: kubectl-oadp.exe \ No newline at end of file + bin: kubectl-oadp.exe + - selector: + matchLabels: + os: windows + arch: arm64 + uri: https://github.com/migtools/oadp-cli/releases/download/v0.0.0/kubectl-oadp-windows-arm64.tar.gz + sha256: "" + files: + - from: kubectl-oadp.exe + to: . + - from: LICENSE + to: . + bin: kubectl-oadp.exe \ No newline at end of file From 004439a5d6f3afaa05b2bde160eaf2919fa0db06 Mon Sep 17 00:00:00 2001 From: Joseph Date: Thu, 17 Jul 2025 15:51:24 -0400 Subject: [PATCH 5/7] Implement better templating with envsubst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✨ Major improvements: - Convert oadp.yaml to environment variable template - Replace complex Python regex with clean envsubst - Much more readable and maintainable approach - Robust error handling and validation - Template uses ${VERSION}, ${LINUX_AMD64_SHA}, etc. 🔧 Technical benefits: - No more fragile regex string replacement - Standard environment variable substitution - Easier to debug and modify - Less code, more reliable --- .github/workflows/release.yml | 98 ++++++++++------------------------- oadp.yaml | 26 +++++----- 2 files changed, 40 insertions(+), 84 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b4ba352b..ffd9d2df 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -90,80 +90,36 @@ jobs: set -e echo "Generating final krew manifest with version ${{ github.ref_name }}..." - python3 << 'EOF' - import re - import sys + # Set environment variables for template substitution + export VERSION="${{ github.ref_name }}" + export LINUX_AMD64_SHA=$(grep "kubectl-oadp-linux-amd64.tar.gz" checksums.txt | cut -d' ' -f1) + export LINUX_ARM64_SHA=$(grep "kubectl-oadp-linux-arm64.tar.gz" checksums.txt | cut -d' ' -f1) + export DARWIN_AMD64_SHA=$(grep "kubectl-oadp-darwin-amd64.tar.gz" checksums.txt | cut -d' ' -f1) + export DARWIN_ARM64_SHA=$(grep "kubectl-oadp-darwin-arm64.tar.gz" checksums.txt | cut -d' ' -f1) + export WINDOWS_AMD64_SHA=$(grep "kubectl-oadp-windows-amd64.tar.gz" checksums.txt | cut -d' ' -f1) + export WINDOWS_ARM64_SHA=$(grep "kubectl-oadp-windows-arm64.tar.gz" checksums.txt | cut -d' ' -f1) - # Read the template manifest - with open('oadp.yaml', 'r') as f: - manifest = f.read() - - # Read checksums - checksums = {} - with open('checksums.txt', 'r') as f: - for line in f: - sha, filename = line.strip().split(' ') - # Extract platform from filename (e.g., kubectl-oadp-linux-amd64.tar.gz -> linux-amd64) - platform = filename.replace('kubectl-oadp-', '').replace('.tar.gz', '') - checksums[platform] = sha - - # Get version from GitHub ref - version = "${{ github.ref_name }}" - print(f"Using version: {version}") - - # Update version field - manifest = re.sub(r'version: v\d+\.\d+\.\d+', f'version: {version}', manifest) - - # Update download URLs with correct version - manifest = re.sub( - r'/download/v\d+\.\d+\.\d+/', - f'/download/{version}/', - manifest - ) - - # Update SHA256 checksums for each platform - platform_map = { - 'linux-amd64': 'linux-amd64', - 'linux-arm64': 'linux-arm64', - 'darwin-amd64': 'darwin-amd64', - 'darwin-arm64': 'darwin-arm64', - 'windows-amd64': 'windows-amd64', - 'windows-arm64': 'windows-arm64' - } - - for platform, checksum_key in platform_map.items(): - if checksum_key in checksums: - sha = checksums[checksum_key] - print(f"Updating {platform}: {sha}") - - # Find the section for this platform and update its SHA256 - pattern = f'kubectl-oadp-{platform}\.tar\.gz.*?sha256: ""' - replacement = f'kubectl-oadp-{platform}.tar.gz\n sha256: "{sha}"' - manifest = re.sub(pattern, replacement, manifest, flags=re.DOTALL) - else: - print(f"❌ No checksum found for {platform}") - sys.exit(1) - - # Validate no empty SHA256 values remain - if 'sha256: ""' in manifest: - print("❌ Some SHA256 values are still empty!") - empty_lines = [line for line in manifest.split('\n') if 'sha256: ""' in line] - for line in empty_lines: - print(f" {line.strip()}") - sys.exit(1) - - # Write final manifest - with open('kubectl-oadp.yaml', 'w') as f: - f.write(manifest) + # Validate all checksums were found + if [[ -z "$LINUX_AMD64_SHA" || -z "$LINUX_ARM64_SHA" || -z "$DARWIN_AMD64_SHA" || -z "$DARWIN_ARM64_SHA" || -z "$WINDOWS_AMD64_SHA" || -z "$WINDOWS_ARM64_SHA" ]]; then + echo "❌ Some checksums are missing!" + echo "Available checksums:" + cat checksums.txt + exit 1 + fi - print("✅ Final krew manifest generated successfully!") + # Use envsubst to substitute environment variables in template + envsubst < oadp.yaml > kubectl-oadp.yaml - # Show summary - print(f"\nSummary:") - print(f"Version: {version}") - for platform, sha in checksums.items(): - print(f"{platform}: {sha[:16]}...") - EOF + echo "✅ Final krew manifest generated successfully!" + echo "" + echo "Summary:" + echo "Version: $VERSION" + echo "Linux amd64: ${LINUX_AMD64_SHA:0:16}..." + echo "Linux arm64: ${LINUX_ARM64_SHA:0:16}..." + echo "Darwin amd64: ${DARWIN_AMD64_SHA:0:16}..." + echo "Darwin arm64: ${DARWIN_ARM64_SHA:0:16}..." + echo "Windows amd64: ${WINDOWS_AMD64_SHA:0:16}..." + echo "Windows arm64: ${WINDOWS_ARM64_SHA:0:16}..." echo "" echo "Final manifest preview:" diff --git a/oadp.yaml b/oadp.yaml index f103cd2e..7bfa6981 100644 --- a/oadp.yaml +++ b/oadp.yaml @@ -3,7 +3,7 @@ kind: Plugin metadata: name: oadp spec: - version: v0.0.0 + version: ${VERSION} homepage: https://github.com/migtools/oadp-cli shortDescription: Manage OpenShift API for Data Protection (OADP) backup and restore operations description: | @@ -32,8 +32,8 @@ spec: matchLabels: os: linux arch: amd64 - uri: https://github.com/migtools/oadp-cli/releases/download/v0.0.0/kubectl-oadp-linux-amd64.tar.gz - sha256: "" + uri: https://github.com/migtools/oadp-cli/releases/download/${VERSION}/kubectl-oadp-linux-amd64.tar.gz + sha256: "${LINUX_AMD64_SHA}" files: - from: kubectl-oadp to: . @@ -44,8 +44,8 @@ spec: matchLabels: os: linux arch: arm64 - uri: https://github.com/migtools/oadp-cli/releases/download/v0.0.0/kubectl-oadp-linux-arm64.tar.gz - sha256: "" + uri: https://github.com/migtools/oadp-cli/releases/download/${VERSION}/kubectl-oadp-linux-arm64.tar.gz + sha256: "${LINUX_ARM64_SHA}" files: - from: kubectl-oadp to: . @@ -56,8 +56,8 @@ spec: matchLabels: os: darwin arch: amd64 - uri: https://github.com/migtools/oadp-cli/releases/download/v0.0.0/kubectl-oadp-darwin-amd64.tar.gz - sha256: "" + uri: https://github.com/migtools/oadp-cli/releases/download/${VERSION}/kubectl-oadp-darwin-amd64.tar.gz + sha256: "${DARWIN_AMD64_SHA}" files: - from: kubectl-oadp to: . @@ -68,8 +68,8 @@ spec: matchLabels: os: darwin arch: arm64 - uri: https://github.com/migtools/oadp-cli/releases/download/v0.0.0/kubectl-oadp-darwin-arm64.tar.gz - sha256: "" + uri: https://github.com/migtools/oadp-cli/releases/download/${VERSION}/kubectl-oadp-darwin-arm64.tar.gz + sha256: "${DARWIN_ARM64_SHA}" files: - from: kubectl-oadp to: . @@ -80,8 +80,8 @@ spec: matchLabels: os: windows arch: amd64 - uri: https://github.com/migtools/oadp-cli/releases/download/v0.0.0/kubectl-oadp-windows-amd64.tar.gz - sha256: "" + uri: https://github.com/migtools/oadp-cli/releases/download/${VERSION}/kubectl-oadp-windows-amd64.tar.gz + sha256: "${WINDOWS_AMD64_SHA}" files: - from: kubectl-oadp.exe to: . @@ -92,8 +92,8 @@ spec: matchLabels: os: windows arch: arm64 - uri: https://github.com/migtools/oadp-cli/releases/download/v0.0.0/kubectl-oadp-windows-arm64.tar.gz - sha256: "" + uri: https://github.com/migtools/oadp-cli/releases/download/${VERSION}/kubectl-oadp-windows-arm64.tar.gz + sha256: "${WINDOWS_ARM64_SHA}" files: - from: kubectl-oadp.exe to: . From 701d80afb2217ab65a0c11c48702b3ce7179111e Mon Sep 17 00:00:00 2001 From: Joseph Date: Thu, 17 Jul 2025 15:58:39 -0400 Subject: [PATCH 6/7] Simplify krew manifest naming to oadp.yaml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🎯 Perfect for krew index submission: - Generate oadp.yaml directly (not oadp-final.yaml) - Release artifact is ready to drop into krew index - No renaming needed - matches krew convention exactly - Clean workflow: template → envsubst → oadp.yaml --- .github/workflows/release.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ffd9d2df..9e43f435 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -108,7 +108,9 @@ jobs: fi # Use envsubst to substitute environment variables in template - envsubst < oadp.yaml > kubectl-oadp.yaml + # Save original template and generate final manifest + cp oadp.yaml oadp-template.yaml + envsubst < oadp-template.yaml > oadp.yaml echo "✅ Final krew manifest generated successfully!" echo "" @@ -123,7 +125,7 @@ jobs: echo "" echo "Final manifest preview:" - grep -E "(version:|sha256:)" kubectl-oadp.yaml + grep -E "(version:|sha256:)" oadp.yaml - name: Create GitHub Release uses: softprops/action-gh-release@v1 @@ -131,7 +133,7 @@ jobs: files: | *.tar.gz checksums.txt - kubectl-oadp.yaml + oadp.yaml body: | ## OADP CLI ${{ github.ref_name }} @@ -146,8 +148,8 @@ jobs: #### Via krew manifest (for testing or custom indexes) ```bash - curl -LO https://github.com/migtools/oadp-cli/releases/download/${{ github.ref_name }}/kubectl-oadp.yaml - kubectl krew install --manifest=kubectl-oadp.yaml + curl -LO https://github.com/migtools/oadp-cli/releases/download/${{ github.ref_name }}/oadp.yaml + kubectl krew install --manifest=oadp.yaml ``` #### Manual installation @@ -164,10 +166,10 @@ jobs: ### Files Included - **Binary archives**: Platform-specific kubectl-oadp binaries with LICENSE - **checksums.txt**: SHA256 checksums for all binaries - - **kubectl-oadp.yaml**: Final krew plugin manifest with populated SHA256 values + - **oadp.yaml**: Final krew plugin manifest with populated SHA256 values (ready for krew index) ### For Krew Index Maintainers - The `kubectl-oadp.yaml` file contains the complete krew plugin manifest with all SHA256 checksums populated and can be used directly for krew index submissions. + The `oadp.yaml` file contains the complete krew plugin manifest with all SHA256 checksums populated and can be used directly for krew index submissions. draft: false prerelease: false env: From 1b1110e50e1d62255ad5407aacd02345a3350945 Mon Sep 17 00:00:00 2001 From: Joseph Date: Thu, 17 Jul 2025 16:13:34 -0400 Subject: [PATCH 7/7] Fix archive creation for krew platform matching MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🐛 Fixes checksum validation errors: - Only create archives for the 6 krew platforms (not ppc64le/s390x) - Fix Windows naming: .exe binary → .tar.gz archive (no .exe in archive name) - Skip non-binary files (kubectl-oadp-design.md) - Explicit platform list ensures exact match with oadp.yaml - Better error handling if binaries missing ✅ Now checksums.txt will have exactly the files the workflow expects --- .github/workflows/release.yml | 43 ++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9e43f435..7634143b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,27 +48,44 @@ jobs: set -e echo "Creating release archives..." - # Create archives for each binary - for binary in kubectl-oadp-*; do - if [[ -f "$binary" ]]; then - # Extract platform info from filename - platform=$(echo "$binary" | sed 's/kubectl-oadp-//') - echo "Creating archive for $platform..." - - # Create archive - if [[ "$platform" == *"windows"* ]]; then - # Windows binary should be .exe + # Define the platforms we want for krew (must match oadp.yaml) + declare -a platforms=( + "linux-amd64" + "linux-arm64" + "darwin-amd64" + "darwin-arm64" + "windows-amd64" + "windows-arm64" + ) + + # Create archives only for krew platforms + for platform in "${platforms[@]}"; do + if [[ "$platform" == *"windows"* ]]; then + # Windows binaries have .exe extension + binary="kubectl-oadp-${platform}.exe" + if [[ -f "$binary" ]]; then + echo "Creating archive for $platform..." cp "$binary" kubectl-oadp.exe tar -czf "kubectl-oadp-${platform}.tar.gz" kubectl-oadp.exe LICENSE rm kubectl-oadp.exe + echo "✅ Created kubectl-oadp-${platform}.tar.gz" else - # Unix binary + echo "❌ Binary not found: $binary" + exit 1 + fi + else + # Unix binaries (no extension) + binary="kubectl-oadp-${platform}" + if [[ -f "$binary" ]]; then + echo "Creating archive for $platform..." cp "$binary" kubectl-oadp tar -czf "kubectl-oadp-${platform}.tar.gz" kubectl-oadp LICENSE rm kubectl-oadp + echo "✅ Created kubectl-oadp-${platform}.tar.gz" + else + echo "❌ Binary not found: $binary" + exit 1 fi - - echo "✅ Created kubectl-oadp-${platform}.tar.gz" fi done