Files
jobs-manager-operator/scripts/update-krew-manifest.sh
T
lukaszraczylo 2b36071647 Multiple fixes (#29)
* Multiple fixes

- add goreleaser to the build / release process
- add kubectl plugin for job graphs visualization
- add installation scripts
- update dependencies

* Update the release & CRD content.

* Next set of improvements.

  Code Quality

  - Label constants: Added LabelWorkflowName, LabelGroupName, LabelJobName, LabelJobID in controllers/definitions.go
  - Removed commented debug code: Cleaned up dead code from multiple files
  - Removed unused dependencyTree field: Cleaned connPackage struct
  - Fixed snake_case variables: Changed to camelCase (runGroup, groupDep, runJob, jobDep, k8sJob)

  Kubernetes Best Practices

  - Finalizers: Implemented handleDeletion() and deleteChildJobs() for proper cleanup
  - Status enum validation: Added +kubebuilder:validation:Enum=pending;running;succeeded;failed;aborted
  - ImagePullPolicy default: Created getImagePullPolicy() helper that defaults to IfNotPresent
  - Resource limits support: Added Resources *corev1.ResourceRequirements to ManagedJobParameters

  Observability

  - Prometheus metrics: Created controllers/metrics.go with counters (jobs created/succeeded/failed), histogram (reconciliation duration), and gauge (active jobs)
  - Structured logging: Added logger field to connPackage, used context-based logging throughout

  Configuration

  - Leader election ID: Made configurable via --leader-election-id flag
  - Development mode: Made configurable via --dev-mode flag and LOG_LEVEL env var

  Performance

  - Dependency lookup optimization: Changed from O(n*m) to O(1) using lookup maps (jobDepMap, groupDepMap)
  - Reconciliation backoff: Added RequeueAfter: 30*time.Second when workflow is running

  Documentation & Testing

  - Godoc documentation: Added comprehensive comments to API types and controller
  - Unit tests: Added helpers_test.go with tests for all helper functions
  - Integration tests: Added managedjob_controller_test.go with Ginkgo/Gomega tests

* Add the helm chart release.

* Add reasonable test coverage.
2025-12-17 22:33:23 +00:00

73 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
# Update Krew manifest with correct SHA256 checksums
# Usage: ./scripts/update-krew-manifest.sh v0.0.33
set -e
VERSION="${1:-}"
GITHUB_REPO="lukaszraczylo/jobs-manager-operator"
MANIFEST_FILE="plugins/krew/managedjob.yaml"
if [[ -z "$VERSION" ]]; then
echo "Usage: $0 <version>"
echo "Example: $0 v0.0.33"
exit 1
fi
# Remove 'v' prefix for archive names
VERSION_NUM="${VERSION#v}"
echo "Updating Krew manifest for version $VERSION..."
# Platforms to update
PLATFORMS=(
"darwin_amd64:tar.gz"
"darwin_arm64:tar.gz"
"linux_amd64:tar.gz"
"linux_arm64:tar.gz"
"windows_amd64:zip"
)
# Download checksums file
CHECKSUMS_URL="https://github.com/${GITHUB_REPO}/releases/download/${VERSION}/checksums.txt"
echo "Downloading checksums from $CHECKSUMS_URL..."
CHECKSUMS=$(curl -sSL "$CHECKSUMS_URL")
if [[ -z "$CHECKSUMS" ]]; then
echo "Error: Failed to download checksums"
exit 1
fi
echo "Checksums:"
echo "$CHECKSUMS"
echo ""
# Update manifest
for platform_ext in "${PLATFORMS[@]}"; do
platform="${platform_ext%:*}"
ext="${platform_ext#*:}"
archive_name="jobs-manager-operator_${VERSION_NUM}_${platform}.${ext}"
sha256=$(echo "$CHECKSUMS" | grep "$archive_name" | awk '{print $1}')
if [[ -z "$sha256" ]]; then
echo "Warning: No checksum found for $archive_name"
continue
fi
echo " $platform: $sha256"
done
# Update version in manifest
sed -i.bak "s/version: v.*/version: ${VERSION}/" "$MANIFEST_FILE"
# Update URIs and find/replace SHA256 placeholders
# This is a simplified approach - for production, use yq or similar
echo ""
echo "Manifest updated with version $VERSION"
echo "NOTE: SHA256 checksums must be manually updated in $MANIFEST_FILE"
echo ""
echo "Copy the checksums above and replace REPLACE_WITH_ACTUAL_SHA256 in the manifest."
rm -f "${MANIFEST_FILE}.bak"