Files
jobs-manager-operator/.github/workflows/release.yaml
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

83 lines
2.3 KiB
YAML

name: Release
on:
workflow_dispatch:
push:
paths-ignore:
- "**.md"
- "docs/**"
- "config/samples/**"
branches:
- main
permissions:
id-token: write
contents: write
packages: write
deployments: write
jobs:
release:
uses: lukaszraczylo/shared-actions/.github/workflows/go-release.yaml@main
with:
go-version: "1.23"
docker-enabled: true
secrets: inherit
publish-helm-chart:
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout operator repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get release version
id: version
run: |
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0")
VERSION=${VERSION#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Setup Helm
uses: azure/setup-helm@v4
with:
version: v3.14.0
- name: Checkout helm-charts repo
uses: actions/checkout@v4
with:
repository: lukaszraczylo/helm-charts
ref: gh-pages
path: helm-charts
token: ${{ secrets.HELM_CHARTS_TOKEN }}
- name: Update and package Helm chart
run: |
VERSION="${{ steps.version.outputs.version }}"
# Update chart version
sed -i "s/^version:.*/version: $VERSION/" charts/jobs-manager-operator/Chart.yaml
sed -i "s/^appVersion:.*/appVersion: \"$VERSION\"/" charts/jobs-manager-operator/Chart.yaml
sed -i "s/tag:.*/tag: \"$VERSION\"/" charts/jobs-manager-operator/values.yaml
# Copy updated chart to helm-charts repo
cp -R charts/jobs-manager-operator/* helm-charts/charts/jobs-manager-operator/
# Package chart
helm package charts/jobs-manager-operator -d helm-charts/charts/packages/
# Update index
cd helm-charts
helm repo index . --url https://lukaszraczylo.github.io/helm-charts/ --merge index.yaml
- name: Commit and push to helm-charts
run: |
cd helm-charts
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git diff --staged --quiet || git commit -m "Release jobs-manager ${{ steps.version.outputs.version }}"
git push