1
0
mirror of https://github.com/rancher/os.git synced 2025-07-13 06:34:04 +00:00

Merge pull request #3064 from ibuildthecloud/v2-test

Add arm64
This commit is contained in:
Darren Shepherd 2021-10-13 16:00:56 -07:00 committed by GitHub
commit b4cc0014b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 113 additions and 31 deletions

View File

@ -47,6 +47,55 @@ volumes:
host: host:
path: /var/run/docker.sock path: /var/run/docker.sock
#---
#kind: pipeline
#name: arm64
#
#platform:
# os: linux
# arch: arm64
#
#steps:
#- name: build
# image: rancher/dapper:v0.4.1
# commands:
# - dapper ci
# environment:
# DOCKER_PASSWORD:
# from_secret: docker_password
# DOCKER_USERNAME:
# from_secret: docker_username
# ARCH: "arm64"
# volumes:
# - name: docker
# path: /var/run/docker.sock
#
#- name: github_binary_release
# image: plugins/github-release
# settings:
# api_key:
# from_secret: github_token
# prerelease: true
# checksum:
# - sha256
# checksum_file: CHECKSUMsum-arm64.txt
# checksum_flatten: true
# files:
# - "dist/artifacts/*"
# when:
# instance:
# - drone-publish.rancher.io
# ref:
# - refs/head/master
# - refs/tags/*
# event:
# - tag
#
#volumes:
#- name: docker
# host:
# path: /var/run/docker.sock
#
--- ---
kind: pipeline kind: pipeline
name: manifest name: manifest
@ -78,3 +127,4 @@ steps:
depends_on: depends_on:
- amd64 - amd64
#- arm64

View File

@ -1,5 +1,8 @@
FROM opensuse/leap:15.3 AS build FROM opensuse/leap:15.3 AS build
RUN zypper in -y squashfs xorriso go1.16 upx busybox-static RUN zypper ref
RUN zypper in -y squashfs xorriso go1.16 upx busybox-static curl
RUN curl -Lo /usr/bin/luet https://github.com/mudler/luet/releases/download/0.18.1/luet-0.18.1-linux-$(go env GOARCH) && \
chmod +x /usr/bin/luet
COPY go.mod go.sum /usr/src/ COPY go.mod go.sum /usr/src/
COPY cmd /usr/src/cmd COPY cmd /usr/src/cmd
COPY pkg /usr/src/pkg COPY pkg /usr/src/pkg
@ -9,7 +12,7 @@ RUN cd /usr/src && \
FROM scratch AS framework FROM scratch AS framework
COPY --from=build /usr/bin/busybox-static /usr/bin/busybox COPY --from=build /usr/bin/busybox-static /usr/bin/busybox
COPY --from=quay.io/luet/base:0.17.8 /usr/bin/luet /usr/bin/luet COPY --from=build /usr/bin/luet /usr/bin/luet
COPY framework/files/etc/luet/luet.yaml /etc/luet/luet.yaml COPY framework/files/etc/luet/luet.yaml /etc/luet/luet.yaml
COPY --from=build /etc/ssl/certs /etc/ssl/certs COPY --from=build /etc/ssl/certs /etc/ssl/certs
@ -19,23 +22,19 @@ RUN ["luet", \
"install", "--no-spinner", "-d", "-y", \ "install", "--no-spinner", "-d", "-y", \
"selinux/k3s", \ "selinux/k3s", \
"selinux/rancher", \ "selinux/rancher", \
"system/base-dracut-modules", \ "meta/cos-minimal", \
"system/cloud-config", \
"system/cos-setup", \
"system/grub2-config", \
"system/immutable-rootfs", \
"toolchain/yip", \
"utils/installer", \
"utils/k9s", \ "utils/k9s", \
"utils/rancherd", \ "utils/rancherd", \
"utils/nerdctl"] "utils/nerdctl"]
COPY --from=build /usr/sbin/ros-installer /usr/sbin/ros-installer COPY --from=build /usr/sbin/ros-installer /usr/sbin/ros-installer
COPY framework/files/ / COPY framework/files/ /
RUN ["/usr/bin/busybox", "sh", "-c", "if [ -e /etc/luet/luet.yaml.$(busybox uname -m) ]; then busybox mv -f /etc/luet/luet.yaml.$(busybox uname -m) /etc/luet/luet.yaml; fi && busybox rm -f /etc/luet/luet.yaml.*"]
RUN ["/usr/bin/busybox", "rm", "-rf", "/var", "/etc/ssl", "/usr/bin/busybox"] RUN ["/usr/bin/busybox", "rm", "-rf", "/var", "/etc/ssl", "/usr/bin/busybox"]
# Make OS image # Make OS image
FROM opensuse/leap:15.3 as os FROM opensuse/leap:15.3 as os
RUN zypper ref
RUN zypper in -y \ RUN zypper in -y \
apparmor-parser \ apparmor-parser \
avahi \ avahi \
@ -129,4 +128,7 @@ RUN echo "IMAGE_REPO=${IMAGE_REPO}" > /usr/lib/rancheros-release && \
COPY --from=framework / / COPY --from=framework / /
# Rebuild initrd to setup dracut with the boot configurations # Rebuild initrd to setup dracut with the boot configurations
RUN mkinitrd RUN mkinitrd && \
# aarch64 has an uncompressed kernel so we need to link it to vmlinuz
kernel=$(ls /boot/Image-* | head -n1) && \
if [ -e "$kernel" ]; then ln -sf "${kernel#/boot/}" /boot/vmlinuz; fi

View File

@ -1,9 +1,9 @@
FROM opensuse/leap FROM opensuse/leap
RUN zypper ref
ARG DAPPER_HOST_ARCH ARG DAPPER_HOST_ARCH
ENV ARCH $DAPPER_HOST_ARCH ENV ARCH $DAPPER_HOST_ARCH
RUN zypper ref
RUN zypper in -y bash git gcc docker vim less file curl wget ca-certificates make mkisofs go1.16 RUN zypper in -y bash git gcc docker vim less file curl wget ca-certificates make mkisofs go1.16
RUN go get golang.org/x/tools/cmd/goimports RUN go get golang.org/x/tools/cmd/goimports
RUN if [ "${ARCH}" == "amd64" ]; then \ RUN if [ "${ARCH}" == "amd64" ]; then \
@ -16,6 +16,7 @@ ENV DAPPER_ENV REPO TAG DRONE_TAG CROSS DOCKER_USERNAME DOCKER_PASSWORD AWS_ACCE
ENV DAPPER_SOURCE /go/src/github.com/rancher/os/ ENV DAPPER_SOURCE /go/src/github.com/rancher/os/
ENV DAPPER_OUTPUT ./bin ./dist ENV DAPPER_OUTPUT ./bin ./dist
ENV DAPPER_DOCKER_SOCKET true ENV DAPPER_DOCKER_SOCKET true
ENV DAPPER_RUN_ARGS "-v ros-go16-pkg-1:/go/pkg -v ros-go16-cache-1:/root/.cache/go-build"
WORKDIR ${DAPPER_SOURCE} WORKDIR ${DAPPER_SOURCE}
ENTRYPOINT ["./scripts/entry"] ENTRYPOINT ["./scripts/entry"]

View File

@ -1,4 +1,4 @@
.DEFAULT_GOAL := build .DEFAULT_GOAL := package
REPO?=rancher/os REPO?=rancher/os
TAG?=dev TAG?=dev
IMAGE=${REPO}:${TAG} IMAGE=${REPO}:${TAG}
@ -10,13 +10,17 @@ IMAGE=${REPO}:${TAG}
@./.dapper.tmp -v @./.dapper.tmp -v
@mv .dapper.tmp .dapper @mv .dapper.tmp .dapper
.PHONY: validate .PHONY: ci
ci: .dapper ci: .dapper
./.dapper ci ./.dapper ci
.PHONY: package
package: .dapper
./.dapper package
.PHONY: clean .PHONY: clean
clean: clean:
rm -rf build rm -rf build dist
.PHONY: build-framework .PHONY: build-framework
build-framework: build-framework:
@ -43,12 +47,12 @@ push-framework: build-framework
docker push ${REPO}-framework:${TAG} docker push ${REPO}-framework:${TAG}
.PHONY: iso .PHONY: iso
iso: build iso:
./ros-image-build ${IMAGE} iso ./ros-image-build ${IMAGE} iso
@echo "INFO: ISO available at build/output.iso" @echo "INFO: ISO available at build/output.iso"
.PHONY: qcow .PHONY: qcow
qcow: build qcow:
./ros-image-build ${IMAGE} qcow ./ros-image-build ${IMAGE} qcow
@echo "INFO: QCOW image available at build/output.qcow.gz" @echo "INFO: QCOW image available at build/output.qcow.gz"

View File

@ -0,0 +1,12 @@
logging:
color: false
enable_emoji: false
general:
debug: false
spinner_charset: 9
repositories:
- name: "cos-toolkit-green"
type: "docker"
enable: true
urls:
- "quay.io/costoolkit/releases-green-arm64"

View File

@ -14,19 +14,27 @@ ARG IMAGE=rancher/os:dev
FROM ${IMAGE} AS os FROM ${IMAGE} AS os
FROM opensuse/leap:15.3 AS tools FROM opensuse/leap:15.3 AS tools
RUN zypper ref
ENV LUET_NOLOCK=true ENV LUET_NOLOCK=true
# Copy luet from the official images # Copy luet from the official images
RUN zypper in -y squashfs xorriso curl unzip git qemu-kvm qemu-tools tar pigz RUN zypper in -y squashfs xorriso curl unzip git qemu-arm qemu-x86 qemu-tools tar pigz go1.16 qemu-uefi-aarch64
RUN cd /usr/sbin && \ RUN cd /usr/sbin && \
rm packer && \ rm packer && \
curl https://releases.hashicorp.com/packer/1.7.4/packer_1.7.4_linux_amd64.zip > tmp && \ SUFFIX=amd64 && \
if [ "$(uname -m)" = "aarch64" ]; then SUFFIX=arm64; fi && \
curl https://releases.hashicorp.com/packer/1.7.4/packer_1.7.4_linux_${SUFFIX}.zip > tmp && \
unzip tmp && \ unzip tmp && \
rm tmp rm tmp
RUN cd /usr/src && \ RUN cd /usr/src && \
git clone https://github.com/rancher-sandbox/cOS-toolkit git clone https://github.com/rancher-sandbox/cOS-toolkit
COPY --from=quay.io/luet/base:0.17.8 /usr/bin/luet /usr/bin/luet RUN curl -Lo /usr/bin/luet https://github.com/mudler/luet/releases/download/0.18.1/luet-0.18.1-linux-$(go env GOARCH) && \
chmod +x /usr/bin/luet
RUN mkdir -p /iso/iso-overlay/boot/grub2 /etc/luet RUN mkdir -p /iso/iso-overlay/boot/grub2 /etc/luet
RUN echo -e \ RUN export SUFFIX; \
if [ "$(uname -m)" == "aarch64" ]; then \
SUFFIX=-arm64 \
;fi && \
echo -e \
'logging:\n'\ 'logging:\n'\
' color: false\n'\ ' color: false\n'\
' enable_emoji: false\n'\ ' enable_emoji: false\n'\
@ -38,8 +46,8 @@ RUN echo -e \
' type: "docker"\n'\ ' type: "docker"\n'\
' enable: true\n'\ ' enable: true\n'\
' urls:\n'\ ' urls:\n'\
' - "quay.io/costoolkit/releases-green"\n' > /etc/luet/luet.yaml " - \"quay.io/costoolkit/releases-green${SUFFIX}\"\n" > /etc/luet/luet.yaml && \
RUN echo -e \ echo -e \
'packages:\n'\ 'packages:\n'\
' uefi:\n'\ ' uefi:\n'\
' - live/grub2-efi-image\n'\ ' - live/grub2-efi-image\n'\
@ -71,7 +79,7 @@ RUN echo -e \
' type: "docker"\n'\ ' type: "docker"\n'\
' enable: true\n'\ ' enable: true\n'\
' urls:\n'\ ' urls:\n'\
' - "quay.io/costoolkit/releases-green"\n' > /iso/iso.yaml " - \"quay.io/costoolkit/releases-green${SUFFIX}\"\n" > /iso/iso.yaml
RUN echo -e \ RUN echo -e \
'search --file --set=root /boot/kernel.xz\n'\ 'search --file --set=root /boot/kernel.xz\n'\
'set default=0\n'\ 'set default=0\n'\
@ -116,10 +124,15 @@ RUN cd /iso && \
luet-makeiso iso.yaml luet-makeiso iso.yaml
FROM iso-build AS qcow-build FROM iso-build AS qcow-build
RUN packer build \ RUN SUFFIX= && \
FIRMWARE= && \
if [ "$(uname -m)" = "aarch64" ]; then SUFFIX=-arm64; FIRMWARE=/usr/share/qemu/qemu-uefi-aarch64.bin; fi && \
PACKER_LOG=1 packer build \
-var "firmware=${FIRMWARE}" \
-var "memory=1024" \
-var "iso=/iso/output.iso" \ -var "iso=/iso/output.iso" \
-var "accelerator=tcg" \ -var "accelerator=tcg" \
-only qemu.cos . -only qemu.cos${SUFFIX} .
RUN mkdir /output && \ RUN mkdir /output && \
mv *.box /output/output.box && \ mv *.box /output/output.box && \
pigz -dc *.tar.gz | tar xvf - && \ pigz -dc *.tar.gz | tar xvf - && \

View File

@ -5,4 +5,4 @@ cd $(dirname $0)
./test ./test
./validate ./validate
./package IMAGE_TARGETS=${IMAGE_TARGETS:-qcow} ./package

View File

@ -6,8 +6,8 @@ source $(dirname $0)/version
cd $(dirname $0)/.. cd $(dirname $0)/..
export TAG export TAG
make build
make iso make iso
TARGETS="iso"
if [ -n "$DOCKER_PASSWORD" ]; then if [ -n "$DOCKER_PASSWORD" ]; then
docker login -u "$DOCKER_USERNAME" -p "${DOCKER_PASSWORD}" docker login -u "$DOCKER_USERNAME" -p "${DOCKER_PASSWORD}"
@ -19,14 +19,14 @@ if [ "$PUSH" = "true" ]; then
make push-framework make push-framework
fi fi
TARGETS=qcow
if [ "$PUSH" = "true" ] && [ -n "$AWS_SECRET_ACCESS_KEY" ]; then if [ "$PUSH" = "true" ] && [ -n "$AWS_SECRET_ACCESS_KEY" ]; then
TARGETS="${TARGETS} all-amis" IMAGE_TARGETS="${IMAGE_TARGETS} all-amis"
fi fi
export GIT_COMMIT=${COMMIT} export GIT_COMMIT=${COMMIT}
make -j8 ${TARGETS} if [ -n "${IMAGE_TARGETS}" ]; then
make -j8 ${IMAGE_TARGETS}
fi
isoinfo -x /rootfs.squashfs -R -i build/output.iso > build/output.squashfs isoinfo -x /rootfs.squashfs -R -i build/output.iso > build/output.squashfs
isoinfo -x /boot/kernel.xz -R -i build/output.iso > build/output-kernel isoinfo -x /boot/kernel.xz -R -i build/output.iso > build/output-kernel