Skip to content

Commit 65c8104

Browse files
committed
Separate deployment for staging and main
1 parent ce9f20e commit 65c8104

4 files changed

Lines changed: 37 additions & 24 deletions

File tree

.github/workflows/release.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,28 @@ concurrency:
1717
env:
1818
REGISTRY: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s
1919
IMAGE: riscv-runner
20-
RELEASE_ENVIRONMENT: ${{ (github.ref == 'refs/heads/main' && 'prod') || (github.ref == 'refs/heads/staging' && 'staging') || '' }}
2120

2221
jobs:
23-
build-and-deploy:
22+
resolve:
2423
runs-on: ubuntu-latest
24+
outputs:
25+
environment: ${{ steps.env.outputs.result }}
26+
steps:
27+
- id: env
28+
run: |
29+
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
30+
echo "result=main" >> $GITHUB_OUTPUT
31+
elif [[ "${{ github.ref }}" == "refs/heads/staging" ]]; then
32+
echo "result=staging" >> $GITHUB_OUTPUT
33+
fi
34+
35+
deploy:
36+
if: github.repository_owner == 'riseproject-dev' && needs.resolve.outputs.environment != ''
37+
needs: [resolve]
38+
runs-on: ubuntu-latest
39+
environment: ${{ needs.resolve.outputs.environment }}
40+
env:
41+
TAG: ${{ (needs.resolve.outputs.environment == 'main' && 'latest') || 'staging' }}
2542
steps:
2643
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2744

Makefile

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
REGISTRY ?= rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s
22
IMAGE ?= riscv-runner
3+
TAG ?= staging
34
GOARCH ?= riscv64
45

6+
57
.PHONY: build
68
build: build-device-plugin build-node-labeller
79

@@ -18,31 +20,32 @@ container-build: container-build-device-plugin container-build-node-labeller
1820

1921
.PHONY: container-build-device-plugin
2022
container-build-device-plugin:
21-
docker build --platform linux/riscv64 -f Dockerfile -t $(REGISTRY)/$(IMAGE):device-plugin-latest .
23+
docker build --platform linux/riscv64 -f Dockerfile -t $(REGISTRY)/$(IMAGE):device-plugin-$(TAG) .
2224

2325
.PHONY: container-build-node-labeller
2426
container-build-node-labeller:
25-
docker build --platform linux/riscv64 -f labeller.Dockerfile -t $(REGISTRY)/$(IMAGE):node-labeller-latest .
27+
docker build --platform linux/riscv64 -f labeller.Dockerfile -t $(REGISTRY)/$(IMAGE):node-labeller-$(TAG) .
2628

2729
.PHONY: container-push
2830
container-push: container-push-device-plugin container-push-node-labeller
2931

3032
.PHONY: container-push-device-plugin
3133
container-push-device-plugin:
32-
docker build --platform linux/riscv64 -f Dockerfile -t $(REGISTRY)/$(IMAGE):device-plugin-latest .
33-
docker push $(REGISTRY)/$(IMAGE):device-plugin-latest
34+
docker build --platform linux/riscv64 -f Dockerfile -t $(REGISTRY)/$(IMAGE):device-plugin-$(TAG) .
35+
docker push $(REGISTRY)/$(IMAGE):device-plugin-$(TAG)
3436

3537
.PHONY: container-push-node-labeller
3638
container-push-node-labeller:
37-
docker build --platform linux/riscv64 -f labeller.Dockerfile -t $(REGISTRY)/$(IMAGE):node-labeller-latest .
38-
docker push $(REGISTRY)/$(IMAGE):node-labeller-latest
39+
docker build --platform linux/riscv64 -f labeller.Dockerfile -t $(REGISTRY)/$(IMAGE):node-labeller-$(TAG) .
40+
docker push $(REGISTRY)/$(IMAGE):node-labeller-$(TAG)
3941

4042
.PHONY: kubectl-apply
4143
kubectl-apply: kubectl-apply-device-plugin kubectl-apply-node-labeller
4244

4345
.PHONY: kubectl-apply-device-plugin
4446
kubectl-apply-device-plugin:
45-
kubectl apply -f k8s-ds-device-plugin.yaml
47+
test -n $(TAG) || echo "TAG must be defined"
48+
cat k8s-ds-device-plugin.yaml | env TAG="$(TAG)" envsubst | kubectl apply -f -
4649
kubectl rollout restart daemonset/rise-riscv-runner-device-plugin -n kube-system
4750

4851
.PHONY: kubectl-apply-and-wait-device-plugin
@@ -51,7 +54,8 @@ kubectl-apply-and-wait-device-plugin: kubectl-apply-device-plugin
5154

5255
.PHONY: kubectl-apply-node-labeller
5356
kubectl-apply-node-labeller:
54-
kubectl apply -f k8s-ds-node-labeller.yaml
57+
test -n $(TAG) || echo "TAG must be defined"
58+
cat k8s-ds-node-labeller.yaml | env TAG="$(TAG)" envsubst | kubectl apply -f -
5559
kubectl rollout restart daemonset/rise-riscv-runner-node-labeller -n kube-system
5660

5761
.PHONY: clean

k8s-ds-device-plugin.yaml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,17 @@ spec:
2525
kubernetes.io/arch: riscv64
2626
priorityClassName: system-node-critical
2727
initContainers:
28-
- name: ubuntu-2404-latest-image-cache
29-
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:ubuntu-24.04-latest
28+
- name: ubuntu-2404-image-cache
29+
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:ubuntu-24.04-${TAG}
3030
imagePullPolicy: Always
3131
command: ["true"]
32-
- name: ubuntu-2404-staging-image-cache
33-
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:ubuntu-24.04-staging
34-
imagePullPolicy: Always
35-
command: ["true"]
36-
- name: dind-latest-image-cache
37-
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:dind-latest
38-
imagePullPolicy: Always
39-
command: ["true"]
40-
- name: dind-staging-image-cache
41-
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:dind-staging
32+
- name: dind-image-cache
33+
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:dind-${TAG}
4234
imagePullPolicy: Always
4335
command: ["true"]
4436
containers:
4537
- name: device-plugin
46-
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:device-plugin-latest
38+
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:device-plugin-${TAG}
4739
imagePullPolicy: Always
4840
volumeMounts:
4941
- name: device-plugins

k8s-ds-node-labeller.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ spec:
5050
kubernetes.io/arch: riscv64
5151
containers:
5252
- name: node-labeller
53-
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:node-labeller-latest
53+
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:node-labeller-${TAG}
5454
imagePullPolicy: Always
5555
env:
5656
- name: NODE_NAME

0 commit comments

Comments
 (0)