Skip to content

Commit

Permalink
Package arm64/arm/386 architectures too
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dekimsey committed Feb 7, 2024
1 parent 50226e2 commit 5f423a2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .changelog/3428.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:note
build: Releases will now also be available as Debian and RPM packages for ARM64, ARM, and 386.
```
28 changes: 15 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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" }
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.os == 'linux' && matrix.component == 'ci' && !matrix.skip_rpm
uses: hashicorp/actions-packaging-linux@v1
with:
name: consul-k8s${{ matrix.pkg_suffix }}
Expand All @@ -186,13 +188,13 @@ jobs:
rpm_depends: "openssl"

- name: Set package names
if: ${{ matrix.goos == 'linux' && matrix.component == 'cli' && matrix.goarch == 'amd64'}}
if: matrix.os == 'linux' && matrix.component == 'ci' && !matrix.skip_rpm
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.os == 'linux' && matrix.component == 'ci' && !matrix.skip_rpm
uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3
with:
image: registry.access.redhat.com/ubi9/ubi:latest
Expand All @@ -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.os == 'linux' && matrix.component == 'ci' && !matrix.skip_rpm
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.os == 'linux' && matrix.component == 'ci'
uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3
with:
image: ubuntu:latest
Expand All @@ -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.os == 'linux' && matrix.component == 'ci'
with:
name: ${{ env.DEB_PACKAGE }}
path: out/${{ env.DEB_PACKAGE }}
Expand Down

0 comments on commit 5f423a2

Please sign in to comment.