From 0906471d7b815385d03303c7ae320a845069b334 Mon Sep 17 00:00:00 2001 From: Daniel Kimsey <90741+dekimsey@users.noreply.github.com> Date: Wed, 3 Jan 2024 09:01:27 -0600 Subject: [PATCH] Package arm64/arm/386 architectures too During the CRT on-boarding, packaging for other Linux architectures (arm64, arm, and 386) was not enabled. This change adds packaging support for those architectures. See #1132. Related to hashicorp/releng-support#178. These packages have not been tested on their respective platforms. But given we are already shipping binaries and docker images for them, I have high confidence it'll Just Work. I still recommend testing them though :)! To make future support a bit easier, I've enabled the build workflow from releng prefixed branches. Note: RPM systems (RedHat, Fedora) only support amd64/arm64/ppc64le/390x, so I've limited the packaging steps to only amd64 and arm64. Debian systems still support 32-bit arm/386 so I've enabled those. --- .changelog/3428.txt | 3 +++ .github/workflows/build.yml | 28 +++++++++++++++------------- 2 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 .changelog/3428.txt diff --git a/.changelog/3428.txt b/.changelog/3428.txt new file mode 100644 index 0000000000..14fc81140b --- /dev/null +++ b/.changelog/3428.txt @@ -0,0 +1,3 @@ +```release-note:note +build: Releases will now also be available as Debian (arm64, arm, 386) and RPM (arm64) packages. +``` diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5506c017c6..032c8d606a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,8 @@ on: - main # Push events to branches matching refs/heads/release/** - "release/**" + # Build on releng branches for testing build pipelines + - "releng/**" env: PKG_NAME: "consul-k8s" @@ -68,12 +70,12 @@ jobs: strategy: matrix: include: - # cli + # cli (We aren't build RPM packages for systems that lack native support) - {go: "${{ needs.get-go-version.outputs.go-version }}", goos: "freebsd", goarch: "386", component: "cli", pkg_name: "consul-k8s", "bin_name": "consul-k8s" } - {go: "${{ needs.get-go-version.outputs.go-version }}", goos: "freebsd", goarch: "amd64", component: "cli", pkg_name: "consul-k8s", "bin_name": "consul-k8s" } - - {go: "${{ needs.get-go-version.outputs.go-version }}", goos: "linux", goarch: "386", component: "cli", pkg_name: "consul-k8s", "bin_name": "consul-k8s" } - - {go: "${{ needs.get-go-version.outputs.go-version }}", goos: "linux", goarch: "amd64", component: "cli", pkg_name: "consul-k8s", "bin_name": "consul-k8s" } - - {go: "${{ needs.get-go-version.outputs.go-version }}", goos: "linux", goarch: "arm", component: "cli", pkg_name: "consul-k8s", "bin_name": "consul-k8s" } + - {go: "${{ needs.get-go-version.outputs.go-version }}", goos: "linux", goarch: "386", component: "cli", pkg_name: "consul-k8s", "bin_name": "consul-k8s", "skip_rpm": true } + - {go: "${{ needs.get-go-version.outputs.go-version }}", goos: "linux", goarch: "amd64", component: "cli", pkg_name: "consul-k8s", "bin_name": "consul-k8s"} + - {go: "${{ needs.get-go-version.outputs.go-version }}", goos: "linux", goarch: "arm", component: "cli", pkg_name: "consul-k8s", "bin_name": "consul-k8s", "skip_rpm": true} - {go: "${{ needs.get-go-version.outputs.go-version }}", goos: "linux", goarch: "arm64", component: "cli", pkg_name: "consul-k8s", "bin_name": "consul-k8s" } - {go: "${{ needs.get-go-version.outputs.go-version }}", goos: "windows", goarch: "386", component: "cli", pkg_name: "consul-k8s", "bin_name": "consul-k8s.exe" } - {go: "${{ needs.get-go-version.outputs.go-version }}", goos: "windows", goarch: "amd64", component: "cli", pkg_name: "consul-k8s", "bin_name": "consul-k8s.exe" } @@ -142,7 +144,7 @@ jobs: exit 1 fi - - name: Install cross-compiler for FIPS on arm + - name: Install cross-compiler for FIPS on arm64 if: ${{ matrix.fips == '+fips1402' && matrix.goarch == 'arm64' }} run: | sudo apt-get update --allow-releaseinfo-change-suite --allow-releaseinfo-change-version && sudo apt-get install -y gcc-aarch64-linux-gnu @@ -170,8 +172,8 @@ jobs: name: ${{ matrix.pkg_name }}_${{ needs.get-product-version.outputs.product-version }}${{ matrix.fips }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip path: ${{ matrix.component}}/out/${{ matrix.pkg_name }}_${{ needs.get-product-version.outputs.product-version }}${{ matrix.fips }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip - - name: Package rpm and deb files - if: ${{ matrix.goos == 'linux' && matrix.component == 'cli' && matrix.goarch == 'amd64'}} + - name: Package rpm and deb files + if: matrix.goos == 'linux' && matrix.component == 'cli' && matrix.skip_rpm != 'true' uses: hashicorp/actions-packaging-linux@v1 with: name: consul-k8s${{ matrix.pkg_suffix }} @@ -186,13 +188,13 @@ jobs: rpm_depends: "openssl" - name: Set package names - if: ${{ matrix.goos == 'linux' && matrix.component == 'cli' && matrix.goarch == 'amd64'}} + if: matrix.goos == 'linux' && matrix.component == 'cli' && matrix.skip_rpm != 'true' run: | echo "RPM_PACKAGE=$(basename out/*.rpm)" >> $GITHUB_ENV echo "DEB_PACKAGE=$(basename out/*.deb)" >> $GITHUB_ENV - - name: Test rpm package - if: ${{ matrix.goos == 'linux' && matrix.component == 'cli' && matrix.goarch == 'amd64'}} + - name: Test rpm package on platforms supported by UBI + if: matrix.goos == 'linux' && matrix.component == 'ci' && matrix.skip_rpm != 'true' uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3 with: image: registry.access.redhat.com/ubi9/ubi:latest @@ -211,13 +213,13 @@ jobs: - name: Upload rpm package uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 - if: ${{ matrix.goos == 'linux' && matrix.component == 'cli' && matrix.goarch == 'amd64'}} + if: matrix.goos == 'linux' && matrix.component == 'cli' && matrix.skip_rpm != 'true' with: name: ${{ env.RPM_PACKAGE }} path: out/${{ env.RPM_PACKAGE }} - name: Test debian package - if: ${{ matrix.goos == 'linux' && matrix.component == 'cli' && matrix.goarch == 'amd64'}} + if: matrix.goos == 'linux' && matrix.component == 'cli' uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3 with: image: ubuntu:latest @@ -236,7 +238,7 @@ jobs: - name: Upload debian packages uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 - if: ${{ matrix.goos == 'linux' && matrix.component == 'cli' && matrix.goarch == 'amd64'}} + if: matrix.goos == 'linux' && matrix.component == 'cli' with: name: ${{ env.DEB_PACKAGE }} path: out/${{ env.DEB_PACKAGE }}