Skip to content

Commit a380585

Browse files
committed
ci: create GHA for build
- Also, remove the redundant GHA Signed-off-by: Vicente Cheng <vicente.cheng@suse.com>
1 parent 7116fef commit a380585

File tree

11 files changed

+136
-237
lines changed

11 files changed

+136
-237
lines changed

.github/release-drafter.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

.github/workflows/dev.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Dev Build and Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build-for-dev:
10+
uses: ./.github/workflows/factory.yml
11+
with:
12+
tag: ${{ github.ref_name }}-head
13+
push: true
14+
secrets: inherit

.github/workflows/docker.yaml

Lines changed: 0 additions & 116 deletions
This file was deleted.

.github/workflows/factory.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
tag:
5+
required: true
6+
type: string
7+
push:
8+
required: true
9+
type: boolean
10+
11+
env:
12+
repo: "rancher"
13+
provisionerImageName: "harvester-lvm-provisioner"
14+
pluginImageName: "harvester-lvm-csi-plugin"
15+
16+
jobs:
17+
dapper-build:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
id-token: write
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Set up QEMU
27+
uses: docker/setup-qemu-action@v3
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Run dapper
33+
run: make ci
34+
35+
- name: Read some Secrets
36+
uses: rancher-eio/read-vault-secrets@main
37+
if: ${{ inputs.push == true }}
38+
with:
39+
secrets: |
40+
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials username | DOCKER_USERNAME ;
41+
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials password | DOCKER_PASSWORD
42+
- name: Login to Docker Hub
43+
uses: docker/login-action@v3
44+
if: ${{ inputs.push == true }}
45+
with:
46+
username: ${{ env.DOCKER_USERNAME }}
47+
password: ${{ env.DOCKER_PASSWORD }}
48+
49+
- name: Docker Build (CSI Plugin)
50+
uses: docker/build-push-action@v5
51+
with:
52+
provenance: false
53+
context: .
54+
platforms: linux/amd64,linux/arm64
55+
file: package/Dockerfile
56+
push: ${{ inputs.push }}
57+
tags: ${{ env.repo }}/${{ env.pluginImageName }}:${{ inputs.tag }}
58+
59+
- name: Docker Build (LVM Provisioner)
60+
uses: docker/build-push-action@v5
61+
with:
62+
provenance: false
63+
context: .
64+
platforms: linux/amd64,linux/arm64
65+
file: package/Dockerfile.provisioner
66+
push: ${{ inputs.push }}
67+
tags: ${{ env.repo }}/${{ env.provisionerImageName }}:${{ inputs.tag }}

.github/workflows/pr.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Pull Request Build
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
7+
jobs:
8+
build-for-PR:
9+
uses: ./.github/workflows/factory.yml
10+
with:
11+
tag: pr-${{ github.event.number }}
12+
push: false
13+
secrets: inherit

.github/workflows/release-drafter.yaml

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Release Build and Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- v**
7+
8+
jobs:
9+
build-for-release:
10+
uses: ./.github/workflows/factory.yml
11+
with:
12+
tag: ${{ github.ref_name }}
13+
push: true
14+
secrets: inherit

package/Dockerfile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1+
# syntax=docker/dockerfile:1.7.0
2+
13
FROM registry.suse.com/bci/bci-base:15.5
24

35
RUN zypper -n rm container-suseconnect && \
46
zypper -n install util-linux-systemd lvm2 e2fsprogs nvme-cli device-mapper xfsprogs && \
57
zypper -n clean -a && rm -rf /tmp/* /var/tmp/* /usr/share/doc/packages/*
68

7-
COPY bin/lvmplugin /usr/bin/
9+
ARG TARGETPLATFORM
10+
11+
RUN if [ "$TARGETPLATFORM" != "linux/amd64" ] && [ "$TARGETPLATFORM" != "linux/arm64" ]; then \
12+
echo "Error: Unsupported TARGETPLATFORM: $TARGETPLATFORM" && \
13+
exit 1; \
14+
fi
15+
16+
ENV ARCH=${TARGETPLATFORM#linux/}
17+
18+
COPY bin/lvmplugin-${ARCH} /usr/bin/
819
ENTRYPOINT ["lvmplugin"]

package/Dockerfile.provisioner

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1+
# syntax=docker/dockerfile:1.7.0
2+
13
FROM registry.suse.com/bci/bci-base:15.5
24

35
RUN zypper -n rm container-suseconnect && \
46
zypper -n install lvm2 e2fsprogs smartmontools nvme-cli device-mapper && \
57
zypper -n clean -a && rm -rf /tmp/* /var/tmp/* /usr/share/doc/packages/*
68

7-
COPY bin/csi-lvmplugin-provisioner /csi-lvmplugin-provisioner
9+
ARG TARGETPLATFORM
10+
11+
RUN if [ "$TARGETPLATFORM" != "linux/amd64" ] && [ "$TARGETPLATFORM" != "linux/arm64" ]; then \
12+
echo "Error: Unsupported TARGETPLATFORM: $TARGETPLATFORM" && \
13+
exit 1; \
14+
fi
15+
16+
ENV ARCH=${TARGETPLATFORM#linux/}
17+
COPY bin/csi-lvmplugin-provisioner-${ARCH} /csi-lvmplugin-provisioner
818
USER root
9-
ENTRYPOINT ["csi-lvmplugin-provisioner"]
19+
ENTRYPOINT ["csi-lvmplugin-provisioner"]

0 commit comments

Comments
 (0)