Skip to content

Commit

Permalink
ci: add support to build and deploy fluence-controller
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <[email protected]>
  • Loading branch information
vsoch committed Feb 17, 2024
1 parent 41b2ad2 commit 64d9f29
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 12 deletions.
43 changes: 40 additions & 3 deletions .github/workflows/build-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
name: build fluence
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: ^1.19

Expand All @@ -45,7 +45,44 @@ jobs:
- name: Deploy Container
if: (github.event_name != 'pull_request')
run: docker push ${{ env.container }} --all-tags


build-controller:
permissions:
packages: write
env:
container: ghcr.io/flux-framework/fluence-controller
runs-on: ubuntu-latest
name: build fluence-controller
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ^1.19

- name: Build Containers
run: |
make prepare
make build REGISTRY=ghcr.io/flux-framework CONTROLLER_IMAGE=fluence-controller
- name: Tag Release Image
if: (github.event_name == 'release')
run: |
tag=${GITHUB_REF#refs/tags/}
echo "Tagging and releasing ${{ env.container}}:${tag}"
docker tag ${{ env.container }}:latest ${{ env.container }}:${tag}
- name: GHCR Login
if: (github.event_name != 'pull_request')
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy Container
if: (github.event_name != 'pull_request')
run: docker push ${{ env.container }} --all-tags

build-sidecar:
permissions:
packages: write
Expand All @@ -55,7 +92,7 @@ jobs:
name: build sidecar
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: ^1.19

Expand Down
43 changes: 34 additions & 9 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,50 @@ on:

jobs:
build-fluence:

# The scheduler and controller are built together with the hack script
# in the upstream scheduler-plugins
env:
container: ghcr.io/flux-framework/fluence
controller: ghcr.io/flux-framework/fluence-controller
runs-on: ubuntu-latest
name: build fluence
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: ^1.19

- name: Build Containers
run: |
make prepare
make build REGISTRY=ghcr.io/flux-framework SCHEDULER_IMAGE=fluence
make build REGISTRY=ghcr.io/flux-framework SCHEDULER_IMAGE=fluence CONTROLLER_IMAGE=fluence-controller
- name: Save Container
run: docker save ${{ env.container }} | gzip > fluence_latest.tar.gz
- name: Save Containers
run: |
docker save ${{ env.container }} | gzip > fluence_latest.tar.gz
docker save ${{ env.controller }} | gzip > fluence_controller_latest.tar.gz
- name: Upload container artifact
uses: actions/upload-artifact@v4
with:
name: fluence
path: fluence_latest.tar.gz


- name: Upload container artifact
uses: actions/upload-artifact@v4
with:
name: fluence_controller
path: fluence_controller_latest.tar.gz

build-sidecar:
env:
container: ghcr.io/flux-framework/fluence-sidecar
runs-on: ubuntu-latest
name: build sidecar
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: ^1.19

Expand All @@ -59,22 +71,23 @@ jobs:
with:
name: fluence_sidecar
path: fluence_sidecar_latest.tar.gz

test-fluence:
needs: [build-fluence, build-sidecar]
permissions:
packages: write
env:
fluence_container: ghcr.io/flux-framework/fluence
sidecar_container: ghcr.io/flux-framework/fluence-sidecar
controller_container: ghcr.io/flux-framework/fluence-controller

runs-on: ubuntu-latest
name: build fluence
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: ^1.20
go-version: ^1.19

- name: Download fluence artifact
uses: actions/download-artifact@v4
Expand All @@ -88,11 +101,18 @@ jobs:
name: fluence_sidecar
path: /tmp

- name: Download fluence_controller artifact
uses: actions/download-artifact@v4
with:
name: fluence_controller
path: /tmp

- name: Load Docker images
run: |
ls /tmp/*.tar.gz
docker load --input /tmp/fluence_sidecar_latest.tar.gz
docker load --input /tmp/fluence_latest.tar.gz
docker load --input /tmp/fluence_controller_latest.tar.gz
docker image ls -a | grep fluence
- name: Create Kind Cluster
Expand All @@ -106,10 +126,12 @@ jobs:
env:
fluence: ${{ env.fluence_container }}
sidecar: ${{ env.sidecar_container }}
controller: ${{ env.controller_container }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
kind load docker-image ${fluence}
kind load docker-image ${sidecar}
kind load docker-image ${controller}
- name: Test Fluence
run: /bin/bash ./.github/test.sh
Expand All @@ -122,6 +144,8 @@ jobs:
docker tag ${{ env.fluence_container }}:latest ${{ env.fluence_container }}:${tag}
echo "Tagging and releasing ${{ env.sidecar_container}}:${tag}"
docker tag ${{ env.sidecar_container }}:latest ${{ env.sidecar_container }}:${tag}
echo "Tagging and releasing ${{ env.controller_container}}:${tag}"
docker tag ${{ env.controller_container }}:latest ${{ env.controller_container }}:${tag}
# If we get here, tests pass, and we can deploy
- name: GHCR Login
Expand All @@ -137,3 +161,4 @@ jobs:
run: |
docker push ${{ env.fluence_container }} --all-tags
docker push ${{ env.sidecar_container }} --all-tags
docker push ${{ env.controller_container }} --all-tags

0 comments on commit 64d9f29

Please sign in to comment.