Add support for ScaledJob #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Image Substitution Integration Test | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: asia-south1-docker.pkg.dev | |
| PROJECT_ID: test-project | |
| REPOSITORY: test-repo | |
| jobs: | |
| test-current-version: | |
| runs-on: ubuntu-latest | |
| name: Test Current Version (Should Work) | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install dependencies and build | |
| run: | | |
| npm ci | |
| npm run build | |
| - name: Create fake kubeconfig | |
| run: | | |
| mkdir -p ~/.kube | |
| cat << EOF > ~/.kube/config | |
| apiVersion: v1 | |
| kind: Config | |
| clusters: | |
| - cluster: | |
| server: https://fake-cluster.example.com | |
| name: fake-cluster | |
| contexts: | |
| - context: | |
| cluster: fake-cluster | |
| user: fake-user | |
| name: fake-context | |
| current-context: fake-context | |
| users: | |
| - name: fake-user | |
| user: | |
| token: fake-token | |
| EOF | |
| - name: Deploy CronJob with current version | |
| id: cronjob-current | |
| continue-on-error: true | |
| uses: ./ | |
| with: | |
| action: deploy | |
| namespace: default | |
| manifests: | | |
| test/integration/manifests/test-cronjob.yaml | |
| images: | | |
| asia-south1-docker.pkg.dev/project/repo/image:${{ github.sha }} | |
| - name: Deploy ScaledJob with current version | |
| id: scaledjob-current | |
| continue-on-error: true | |
| uses: ./ | |
| with: | |
| action: deploy | |
| namespace: default | |
| manifests: | | |
| test/integration/manifests/test-scaledjob.yaml | |
| images: | | |
| asia-south1-docker.pkg.dev/project/repo/image:${{ github.sha }} | |
| - name: Verify current version results | |
| run: | | |
| echo "Current version test results:" | |
| echo "CronJob outcome: ${{ steps.cronjob-current.outcome }}" | |
| echo "ScaledJob outcome: ${{ steps.scaledjob-current.outcome }}" | |
| # Both should fail due to fake kubectl, but they should process the manifests | |
| if [[ "${{ steps.cronjob-current.outcome }}" == "failure" && "${{ steps.scaledjob-current.outcome }}" == "failure" ]]; then | |
| echo "✅ Current version processed both CronJob and ScaledJob (kubectl failures expected)" | |
| else | |
| echo "❌ Unexpected outcomes with current version" | |
| exit 1 | |
| fi | |
| test-old-version: | |
| runs-on: ubuntu-latest | |
| name: Test Old Version v5.0.3 (Should Fail on ScaledJob) | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Create fake kubeconfig | |
| run: | | |
| mkdir -p ~/.kube | |
| cat << EOF > ~/.kube/config | |
| apiVersion: v1 | |
| kind: Config | |
| clusters: | |
| - cluster: | |
| server: https://fake-cluster.example.com | |
| name: fake-cluster | |
| contexts: | |
| - context: | |
| cluster: fake-cluster | |
| user: fake-user | |
| name: fake-context | |
| current-context: fake-context | |
| users: | |
| - name: fake-user | |
| user: | |
| token: fake-token | |
| EOF | |
| - name: Deploy CronJob with old version v5.0.3 | |
| id: cronjob-old | |
| continue-on-error: true | |
| uses: azure/k8s-deploy@v5.0.3 | |
| with: | |
| action: deploy | |
| namespace: default | |
| manifests: | | |
| test/integration/manifests/test-cronjob.yaml | |
| images: | | |
| asia-south1-docker.pkg.dev/project/repo/image:${{ github.sha }} | |
| - name: Deploy ScaledJob with old version v5.0.3 | |
| id: scaledjob-old | |
| continue-on-error: true | |
| uses: azure/k8s-deploy@v5.0.3 | |
| with: | |
| action: deploy | |
| namespace: default | |
| manifests: | | |
| test/integration/manifests/test-scaledjob.yaml | |
| images: | | |
| asia-south1-docker.pkg.dev/project/repo/image:${{ github.sha }} | |
| - name: Verify old version results | |
| run: | | |
| echo "Old version test results:" | |
| echo "CronJob outcome: ${{ steps.cronjob-old.outcome }}" | |
| echo "ScaledJob outcome: ${{ steps.scaledjob-old.outcome }}" | |
| # CronJob should work (kubectl failure), ScaledJob should fail earlier due to unsupported type | |
| if [[ "${{ steps.cronjob-old.outcome }}" == "failure" ]]; then | |
| echo "✅ Old version processed CronJob (kubectl failure expected)" | |
| else | |
| echo "❌ Old version CronJob had unexpected outcome" | |
| fi | |
| if [[ "${{ steps.scaledjob-old.outcome }}" == "failure" ]]; then | |
| echo "✅ Old version failed on ScaledJob as expected (unsupported workload type)" | |
| else | |
| echo "❌ Old version should have failed on ScaledJob" | |
| exit 1 | |
| fi | |
| echo "🎉 Version comparison test completed successfully!" | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| echo "✅ Test completed - no cleanup needed" |