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

fix: use host architecture to determine FreeBSD ABI #350

Merged
merged 4 commits into from
Jul 27, 2023
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
21 changes: 14 additions & 7 deletions scripts/packages/packager/local-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ set -e
set -x
set -euxo pipefail

case "$(uname -m)" in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have OSARCH variable in the root Makefile you can leverage. It should take from that value instead of adding more logic here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhm I don't see any relation between Makefile arg(s), which are not even being exported, and entrypoint scripts. Moreover, with multiarch containers (e.g. buildx) you'll get broken entrypoint for archs not matching host's arch if you will be relying on OSARCH obtained on host. Finally, OSARCH is being weirdly transformed from uname -m (introduced here - 24a158b#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52L36), so I wouldn't rely on that at all for the sake of simplicity.

amd64|x86_64) ABIARCH=amd64 ;;
arm64|aarch64) ABIARCH=aarch64 ;;
esac

cd /nginx-agent/

mkdir -p /staging/usr/local/bin
Expand All @@ -24,17 +29,19 @@ chmod +x /staging/usr/local/etc/rc.d/nginx-agent
git config --global --add safe.directory /nginx-agent
VERSION="$(git describe --match 'v[0-9]*' --abbrev=0 | tr -d 'v')-SNAPSHOT-$(git rev-parse --short HEAD)" envsubst < scripts/packages/manifest > /staging/+MANIFEST

pkg -o ABI="FreeBSD:13:amd64" create --format txz \
mkdir -p ./build

pkg -o ABI="FreeBSD:13:${ABIARCH}" create --format txz \
-m /staging \
-r /staging \
-p /staging/plist \
-o ./build/; \
-o ./build

# Creating symbolic link from txz to pkg. In older versions of pkg the extension would represent the format of the file
# but since version 1.17.0 pkg will now always create a file with the extesion pkg no matter what the format is.
# Creating symbolic link from txz to pkg. In older versions of pkg the extension would represent the format of the file
# but since version 1.17.0 pkg will now always create a file with the extesion pkg no matter what the format is.
# See 1.17.0 release notes for more info: https://cgit.freebsd.org/ports/commit/?id=e497a16a286972bfcab908209b11ee6a13d99dc9
cd build/
ln -s nginx-agent-"$(git describe --match 'v[0-9]*' --abbrev=0 | tr -d 'v')"-SNAPSHOT-"$(git rev-parse --short HEAD)".pkg nginx-agent-"$(git describe --match 'v[0-9]*' --abbrev=0 | tr -d 'v')"-SNAPSHOT-"$(git rev-parse --short HEAD)".txz
cd ..
cd build
ln -s nginx-agent-"$(git describe --match 'v[0-9]*' --abbrev=0 | tr -d 'v')"-SNAPSHOT-"$(git rev-parse --short HEAD)".pkg nginx-agent-"$(git describe --match 'v[0-9]*' --abbrev=0 | tr -d 'v')"-SNAPSHOT-"$(git rev-parse --short HEAD)".txz
cd ../

rm -rf /staging
4 changes: 2 additions & 2 deletions scripts/packages/packager/signed-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ for freebsd_abi in $FREEBSD_DISTROS; do \
-o ./build/packages/txz/"$freebsd_abi"; \
# create freebsd pkg repo layout
pkg repo ./build/packages/txz/"$freebsd_abi" .key.rsa; \
# Creating symbolic link from txz to pkg. In older versions of pkg the extension would represent the format of the file
# but since version 1.17.0 pkg will now always create a file with the extesion pkg no matter what the format is.
# Creating symbolic link from txz to pkg. In older versions of pkg the extension would represent the format of the file
# but since version 1.17.0 pkg will now always create a file with the extesion pkg no matter what the format is.
# See 1.17.0 release notes for more info: https://cgit.freebsd.org/ports/commit/?id=e497a16a286972bfcab908209b11ee6a13d99dc9
cd build/packages/txz/"$freebsd_abi"; \
ln -s nginx-agent-"$(git describe --match 'v[0-9]*' --abbrev=0 | tr -d 'v')".pkg nginx-agent-"$(git describe --match 'v[0-9]*' --abbrev=0 | tr -d 'v')".txz; \
Expand Down