Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,28 @@ concurrency:
env:
REGISTRY: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s
IMAGE: riscv-runner
RELEASE_ENVIRONMENT: ${{ (github.ref == 'refs/heads/main' && 'prod') || (github.ref == 'refs/heads/staging' && 'staging') || '' }}

jobs:
build-and-deploy:
resolve:
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.env.outputs.result }}
steps:
- id: env
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "result=main" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref }}" == "refs/heads/staging" ]]; then
echo "result=staging" >> $GITHUB_OUTPUT
fi

deploy:
if: github.repository_owner == 'riseproject-dev' && needs.resolve.outputs.environment != ''
needs: [resolve]
runs-on: ubuntu-latest
environment: ${{ needs.resolve.outputs.environment }}
env:
TAG: ${{ (needs.resolve.outputs.environment == 'main' && 'latest') || 'staging' }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

Expand Down
20 changes: 12 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
REGISTRY ?= rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s
IMAGE ?= riscv-runner
TAG ?= staging
GOARCH ?= riscv64


.PHONY: build
build: build-device-plugin build-node-labeller

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

.PHONY: container-build-device-plugin
container-build-device-plugin:
docker build --platform linux/riscv64 -f Dockerfile -t $(REGISTRY)/$(IMAGE):device-plugin-latest .
docker build --platform linux/riscv64 -f Dockerfile -t $(REGISTRY)/$(IMAGE):device-plugin-$(TAG) .

.PHONY: container-build-node-labeller
container-build-node-labeller:
docker build --platform linux/riscv64 -f labeller.Dockerfile -t $(REGISTRY)/$(IMAGE):node-labeller-latest .
docker build --platform linux/riscv64 -f labeller.Dockerfile -t $(REGISTRY)/$(IMAGE):node-labeller-$(TAG) .

.PHONY: container-push
container-push: container-push-device-plugin container-push-node-labeller

.PHONY: container-push-device-plugin
container-push-device-plugin:
docker build --platform linux/riscv64 -f Dockerfile -t $(REGISTRY)/$(IMAGE):device-plugin-latest .
docker push $(REGISTRY)/$(IMAGE):device-plugin-latest
docker build --platform linux/riscv64 -f Dockerfile -t $(REGISTRY)/$(IMAGE):device-plugin-$(TAG) .
docker push $(REGISTRY)/$(IMAGE):device-plugin-$(TAG)

.PHONY: container-push-node-labeller
container-push-node-labeller:
docker build --platform linux/riscv64 -f labeller.Dockerfile -t $(REGISTRY)/$(IMAGE):node-labeller-latest .
docker push $(REGISTRY)/$(IMAGE):node-labeller-latest
docker build --platform linux/riscv64 -f labeller.Dockerfile -t $(REGISTRY)/$(IMAGE):node-labeller-$(TAG) .
docker push $(REGISTRY)/$(IMAGE):node-labeller-$(TAG)

.PHONY: kubectl-apply
kubectl-apply: kubectl-apply-device-plugin kubectl-apply-node-labeller

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

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

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

.PHONY: clean
Expand Down
18 changes: 5 additions & 13 deletions k8s-ds-device-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,17 @@ spec:
kubernetes.io/arch: riscv64
priorityClassName: system-node-critical
initContainers:
- name: ubuntu-2404-latest-image-cache
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:ubuntu-24.04-latest
- name: ubuntu-2404-image-cache
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:ubuntu-24.04-${TAG}
imagePullPolicy: Always
command: ["true"]
- name: ubuntu-2404-staging-image-cache
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:ubuntu-24.04-staging
imagePullPolicy: Always
command: ["true"]
- name: dind-latest-image-cache
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:dind-latest
imagePullPolicy: Always
command: ["true"]
- name: dind-staging-image-cache
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:dind-staging
- name: dind-image-cache
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:dind-${TAG}
imagePullPolicy: Always
command: ["true"]
containers:
- name: device-plugin
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:device-plugin-latest
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:device-plugin-${TAG}
imagePullPolicy: Always
volumeMounts:
- name: device-plugins
Expand Down
2 changes: 1 addition & 1 deletion k8s-ds-node-labeller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ spec:
kubernetes.io/arch: riscv64
containers:
- name: node-labeller
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:node-labeller-latest
image: rg.fr-par.scw.cloud/funcscwriseriscvrunnerappqdvknz9s/riscv-runner:node-labeller-${TAG}
imagePullPolicy: Always
env:
- name: NODE_NAME
Expand Down
2 changes: 1 addition & 1 deletion pkg/soc/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
var boardMap = map[string]string{
"scaleway,em-rv1-c4m16s128-a": "scw-em-rv1",
"sophgo,mango": "cloudv10x-pioneer",
"spacemit,k1-x": "cloudv10x-jupyter",
"spacemit,k1-x": "cloudv10x-jupiter",
}

// DetectBoard reads the device tree compatible property and maps it to a board name.
Expand Down