Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of build: Create arm64 packages as well into release/1.3.x #3646

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changelog/3428.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note:note
build: Releases will now also be available as Debian and RPM packages for the arm64 architecture, refer to the
[Official Packaging Guide](https://www.hashicorp.com/official-packaging-guide) for more information.
```
48 changes: 27 additions & 21 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 packages for the linux 32-bit platforms)
- {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_packaging": "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_packaging": "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 @@ -141,7 +143,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 @@ -169,8 +171,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_packaging != 'true'
uses: hashicorp/actions-packaging-linux@v1
with:
name: consul-k8s${{ matrix.pkg_suffix }}
Expand All @@ -185,21 +187,26 @@ 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_packaging != '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: Enable docker runtime emulation for testing packages
if: matrix.goos == 'linux' && matrix.component == 'cli' && matrix.skip_packaging != 'true' && matrix.goarch != 'amd64'
run: |
docker run --privileged \
--rm \
docker.mirror.hashicorp.services/tonistiigi/binfmt@sha256:5540f38542290735d17da57d7084f684c62336105d018c605058daf03e4c8256 --install ${{ matrix.goarch }}

- name: Test rpm package on platforms on UBI
if: matrix.goos == 'linux' && matrix.component == 'cli' && matrix.skip_packaging != 'true'
uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3
with:
image: registry.access.redhat.com/ubi9/ubi:latest
options: -v ${{ github.workspace }}:/work
options: -v ${{ github.workspace }}:/work --platform linux/${{matrix.goarch}}
run: |
dnf install -qy openssl
cd /work
rpm -ivh out/${{ env.RPM_PACKAGE }}
dnf install -y /work/out/${{ env.RPM_PACKAGE }}
CONSUL_K8S_VERSION="$(consul-k8s version | awk '{print $2}')"
VERSION="v${{ needs.get-product-version.outputs.product-version }}${{ matrix.fips }}"
if [ "${VERSION}" != "${CONSUL_K8S_VERSION}" ]; then
Expand All @@ -210,21 +217,20 @@ 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_packaging != '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' && matrix.skip_packaging != 'true'
uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3
with:
image: ubuntu:latest
options: -v ${{ github.workspace }}:/work
options: -v ${{ github.workspace }}:/work --platform linux/${{matrix.goarch}}
run: |
apt update && apt install -y openssl
cd /work
apt install ./out/${{ env.DEB_PACKAGE }}
apt-get update -qq
apt-get install -y /work/out/${{ env.DEB_PACKAGE }}
CONSUL_K8S_VERSION="$(consul-k8s version | awk '{print $2}')"
VERSION="v${{ needs.get-product-version.outputs.product-version }}${{ matrix.fips }}"
if [ "${VERSION}" != "${CONSUL_K8S_VERSION}" ]; then
Expand All @@ -235,7 +241,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' && matrix.skip_packaging != 'true'
with:
name: ${{ env.DEB_PACKAGE }}
path: out/${{ env.DEB_PACKAGE }}
Expand Down
Loading