|
| 1 | +name: Container images |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + pull_request: |
| 7 | + branches: |
| 8 | + - main |
| 9 | + paths-ignore: |
| 10 | + - 'charts/**' |
| 11 | + push: |
| 12 | + branches: |
| 13 | + - main |
| 14 | + paths-ignore: |
| 15 | + - 'charts/**' |
| 16 | + |
| 17 | +defaults: |
| 18 | + run: |
| 19 | + shell: bash |
| 20 | + |
| 21 | +permissions: |
| 22 | + contents: read |
| 23 | + packages: write |
| 24 | + |
| 25 | +jobs: |
| 26 | + build: |
| 27 | + runs-on: ubuntu-latest |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v6 |
| 30 | + - uses: docker/setup-buildx-action@v4 |
| 31 | + - uses: docker/login-action@v4 |
| 32 | + with: |
| 33 | + registry: ghcr.io |
| 34 | + username: ${{ github.actor }} |
| 35 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + - name: Controller image metadata |
| 37 | + id: controller-meta |
| 38 | + uses: docker/metadata-action@v6 |
| 39 | + with: |
| 40 | + images: ghcr.io/kilnfi/carina |
| 41 | + tags: | |
| 42 | + type=semver,pattern=controller-{{version}} |
| 43 | + type=ref,event=pr,prefix=controller-pr- |
| 44 | + - name: Build and push controller image |
| 45 | + uses: docker/build-push-action@v6 |
| 46 | + with: |
| 47 | + context: . |
| 48 | + load: true |
| 49 | + push: ${{ github.event_name == 'release' }} |
| 50 | + tags: ${{ steps.controller-meta.outputs.tags }} |
| 51 | + labels: ${{ steps.controller-meta.outputs.labels }} |
| 52 | + cache-from: type=gha,scope=controller |
| 53 | + cache-to: type=gha,mode=max,scope=controller |
| 54 | + - name: Scheduler image metadata |
| 55 | + id: scheduler-meta |
| 56 | + uses: docker/metadata-action@v6 |
| 57 | + with: |
| 58 | + images: ghcr.io/kilnfi/carina |
| 59 | + tags: | |
| 60 | + type=semver,pattern=scheduler-{{version}} |
| 61 | + type=ref,event=pr,prefix=scheduler-pr- |
| 62 | + - name: Build and push scheduler image |
| 63 | + uses: docker/build-push-action@v6 |
| 64 | + with: |
| 65 | + context: ./scheduler |
| 66 | + load: true |
| 67 | + push: ${{ github.event_name == 'release' }} |
| 68 | + tags: ${{ steps.scheduler-meta.outputs.tags }} |
| 69 | + labels: ${{ steps.scheduler-meta.outputs.labels }} |
| 70 | + cache-from: type=gha,scope=scheduler |
| 71 | + cache-to: type=gha,mode=max,scope=scheduler |
| 72 | + - name: Create KinD cluster |
| 73 | + if: ${{ github.event_name == 'pull_request' }} |
| 74 | + uses: helm/kind-action@v1 |
| 75 | + with: |
| 76 | + cluster_name: kind |
| 77 | + # Interactive debug |
| 78 | + # - name: Setup tmate session |
| 79 | + # uses: mxschmitt/action-tmate@v3 |
| 80 | + # with: |
| 81 | + # detached: true |
| 82 | + - name: Test Kubernetes |
| 83 | + if: ${{ github.event_name == 'pull_request' }} |
| 84 | + run: | |
| 85 | + set -x |
| 86 | + controller_tag="${{ steps.controller-meta.outputs.version }}" |
| 87 | + scheduler_tag="${{ steps.scheduler-meta.outputs.version }}" |
| 88 | + kind load docker-image "ghcr.io/kilnfi/carina:${controller_tag}" "ghcr.io/kilnfi/carina:${scheduler_tag}" |
| 89 | +
|
| 90 | + helm install --create-namespace -n carina --set carina-scheduler.image.tag="${scheduler_tag}" --set image.carina.tag="${controller_tag}" --hide-notes --wait carina-csi-driver charts/ |
| 91 | +
|
| 92 | + # Create a 50G loopback device inside carina-node to simulate a disk |
| 93 | + kubectl wait pod -n carina -l app=csi-carina-node --for=condition=ready --timeout=120s |
| 94 | + kubectl exec -t -n carina -c csi-carina-node ds/csi-carina-node -- sh -c "truncate -s 50G /tmp/disk.device && losetup /dev/loop2 /tmp/disk.device && pvcreate /dev/loop2" |
| 95 | +
|
| 96 | + # Run the helm test — creates a PVC and a pod that uses carina storage. |
| 97 | + helm test -n carina --hide-notes carina-csi-driver |
0 commit comments