Skip to content

Commit

Permalink
Merge pull request #25 from alexzhc/main
Browse files Browse the repository at this point in the history
Fix arm64 docker build conflict with amd64 in github cicd
  • Loading branch information
alexzhc authored Oct 11, 2022
2 parents 7cf0497 + 5929725 commit 04c26ca
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 19 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/release-drbd9-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,24 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all

- name: Available platforms
run: echo ${{ steps.qemu.outputs.platforms }}

- name: Configure Docker
run: |
sudo cp -vf docker_daemon.json /etc/docker/daemon.json
sudo systemctl restart docker
- name: Build official DRBD9 images
run: make drbd9 CACHE=--no-cache REG=ghcr.io/$( echo ${{ github.repository_owner }} | tr 'A-Z' 'a-z' )
run: make drbd9 REG=ghcr.io/$( echo ${{ github.repository_owner }} | tr 'A-Z' 'a-z' )

- name: Login registry
run: |
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/release-shipper-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@ jobs:
with:
image: tonistiigi/binfmt:latest
platforms: all

- name: Available platforms
run: echo ${{ steps.qemu.outputs.platforms }}

- name: Configure Docker
run: |
sudo cp -vf docker_daemon.json /etc/docker/daemon.json
sudo systemctl restart docker
- name: Build shipper images
run: make shipper CACHE=--no-cache REG=ghcr.io/$( echo ${{ github.repository_owner }} | tr 'A-Z' 'a-z' )
run: make shipper REG=ghcr.io/$( echo ${{ github.repository_owner }} | tr 'A-Z' 'a-z' )

- name: Login registry
run: |
Expand Down
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ update_chart:

drbd9:
cd docker-drbd9 && \
./build.sh $(DRBD_VER) $(ARCH) $(REG) $(CACHE) $(IMG)
./build.sh $(DRBD_VER) $(ARCH) $(REG) $(IMG)

compiler-centos7:
for a in $(shell echo $(ARCH) | tr ',' ' '); do \
docker build docker-shipper/ -f docker-shipper/Dockerfile.shipper \
$(CACHE) \
--platform $$a \
--progress tty \
--target compiler-centos7 \
Expand All @@ -45,7 +44,6 @@ compiler-centos7:
compiler-centos8:
for a in $(shell echo $(ARCH) | tr ',' ' '); do \
docker build docker-shipper/ -f docker-shipper/Dockerfile.shipper \
$(CACHE) \
--platform $$a \
--progress tty \
--target compiler-centos8 \
Expand All @@ -56,7 +54,6 @@ compiler-centos8:
compiler-utils:
for a in $(shell echo $(ARCH) | tr ',' ' '); do \
docker build docker-shipper/ -f docker-shipper/Dockerfile.shipper \
$(CACHE) \
--platform $$a \
--progress tty \
--target compiler-utils \
Expand All @@ -69,7 +66,6 @@ compiler-utils:
shipper: update_chart
for a in $(shell echo $(ARCH) | tr ',' ' '); do \
docker build docker-shipper/ -f docker-shipper/Dockerfile.shipper \
$(CACHE) \
--platform $$a \
--progress tty \
--build-arg DRBD_VER=$(DRBD_VER) \
Expand Down
2 changes: 1 addition & 1 deletion docker-drbd9/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ Alex Zheng <[email protected]>

## LICENCE

GPL-2.0 <https://github.com/LINBIT/drbd/blob/drbd-9.1/COPYING>
GPL-2.0 <https://github.com/LINBIT/drbd/blob/drbd-9.1/COPYING>
6 changes: 1 addition & 5 deletions docker-drbd9/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
DRBD_VER=${1:-9.0.32-1}
ARCH=${2:-linux/amd64}
REG=${3:-daocloud.io/daocloud}
CACHE=${4:- }


[ -z "$DRBD_VER" ] && echo "Need a DRBD version !" && exit 1

Expand All @@ -18,17 +16,15 @@ cp -vf drbd-${DRBD_VER}.tar.gz drbd.tar.gz

echo $ARCH | sed "s#,# #g"

shift 4
shift 3
for i in $@; do
df="Dockerfile.${i}"
[ -f "$df" ] || continue
for a in ${ARCH//,/ }; do
sed "s/^ENV DRBD_VERSION.*/ENV DRBD_VERSION ${DRBD_VER}/" "$df" | \
docker build . -f - \
${CACHE} \
--platform $a \
--progress tty \
--build-arg ARCH=${ARCH} \
-t ${REG}/drbd9-${i##*.}:v${DRBD_VER}_${a/\//-} \
|| exit 1
done
Expand Down
3 changes: 1 addition & 2 deletions docker-shipper/kernel-devels.centos7
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ rhel7.0 3.10.0-123 https://vault.centos.org/7.0.1406/os/x86_64/Packages/kernel-
#
# aarch64
# rhel7.9 5.4.72-200 http://mirror.centos.org/altarch/7.9.2009/kernel/aarch64/Packages/kernel-devel-5.4.72-200.el7.aarch64.rpm
# rhel7.8 4.18.0-147.8.1 https://vault.centos.org/altarch/7.8.2003/os/aarch64/Packages/kernel-devel-4.18.0-147.8.1.el7.aarch64.rpm
#
# rhel7.8 4.18.0-147.8.1 https://vault.centos.org/altarch/7.8.2003/os/aarch64/Packages/kernel-devel-4.18.0-147.8.1.el7.aarch64.rpm
12 changes: 12 additions & 0 deletions docker_daemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"experimental": true,
"builder": {
"gc": {
"defaultKeepStorage": "20GB",
"enabled": true
}
},
"features": {
"buildkit": true
}
}
6 changes: 2 additions & 4 deletions helm/drbd-adapter/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ spec:
{{- range $index, $node := (lookup "v1" "Node" "" "").items }}
{{- $osImage := lower $node.status.nodeInfo.osImage }}
{{- with . -}}
{{- if regexMatch "(red hat enterprise|centos|almalinux|rocky linux) .*7" $osImage }}
{{- if regexMatch "(red hat enterprise|centos) .*7" $osImage }}
{{- $distros = append $distros "rhel7" }}
{{- else if regexMatch "(red hat enterprise|centos|almalinux|rocky linux) .*8" $osImage }}
{{- else if regexMatch "(red hat enterprise|centos) .*8" $osImage }}
{{- $distros = append $distros "rhel8" }}
{{- else if regexMatch "(red hat enterprise|centos|almalinux|rocky linux) .*9" $osImage }}
{{- $distros = append $distros "rhel9" }}
{{- else if regexMatch "ubuntu .*18" $osImage }}
{{- $distros = append $distros "bionic" }}
{{- else if regexMatch "ubuntu .*20" $osImage }}
Expand Down

0 comments on commit 04c26ca

Please sign in to comment.