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

install docker-buildx-plugin on >= 22.06 (test channel only currently) #295

Merged
merged 1 commit into from
Jun 7, 2022
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
12 changes: 12 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,10 @@ do_install() {
# also install the latest version of the "docker scan" cli-plugin (only supported on x86 currently)
pkgs="$pkgs docker-scan-plugin"
fi
# TODO(thaJeztah) remove the $CHANNEL check once 22.06 and docker-buildx-plugin is published to the "stable" channel
if [ "$CHANNEL" = "test" ] && version_gte "22.06"; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Version wouldn't ever be greater than 22.06 in the stable channel yet anyhow, right? So this is probably safe to remove the CHANNEL test from and merge? 🙏

Copy link
Member Author

Choose a reason for hiding this comment

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

So.. lol, it was late when I originally wrote this patch, and I wasn't sure what version_gte did if no version was specified explicitly (as "no version" means "install latest"), so I wanted to safeguard against that (Then decided not to take the risk either way, and leave it in draft until later)

I should have a look at that, and if that's not the case, I can remove it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Did a quick try to see what happens if we remove the $CHANNEL check, but it's indeed written with the assumption that "if no version is specified, then version_gte is always true";

curl -fsSL https://raw.githubusercontent.com/thaJeztah/docker-install/add_buildx_package/install.sh -o get-docker.sh

sed -i 's/\[ "$CHANNEL" = "test" ] && //g' ./get-docker.sh 
sh ./get-docker.sh

# Executing docker install script, commit:
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
+ sh -c mkdir -p /etc/apt/keyrings && chmod -R 0755 /etc/apt/keyrings
+ sh -c curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg
+ sh -c chmod a+r /etc/apt/keyrings/docker.gpg
+ sh -c echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu jammy stable" > /etc/apt/sources.list.d/docker.list
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-scan-plugin docker-buildx-plugin >/dev/null
E: Unable to locate package docker-buildx-plugin

We could change that to have the script actually resolve the latest version, so get it from, e.g.;

apt-cache policy 'docker-ce' | grep 'Candidate:' | cut -d' ' -f4
5:20.10.17~3-0~ubuntu-jammy

But I guess that would make the script a bit too complicated, just for this purpose.

pkgs="$pkgs docker-buildx-plugin"
fi
if ! is_dry_run; then
set -x
fi
Expand Down Expand Up @@ -536,6 +540,10 @@ do_install() {
if version_gte "20.10"; then
pkgs="$pkgs docker-compose-plugin docker-ce-rootless-extras$pkg_version"
fi
# TODO(thaJeztah) remove the $CHANNEL check once 22.06 and docker-buildx-plugin is published to the "stable" channel
if [ "$CHANNEL" = "test" ] && version_gte "22.06"; then
pkgs="$pkgs docker-buildx-plugin"
fi
if ! is_dry_run; then
set -x
fi
Expand Down Expand Up @@ -616,6 +624,10 @@ do_install() {
if version_gte "20.10"; then
pkgs="$pkgs docker-compose-plugin docker-ce-rootless-extras$pkg_version"
fi
# TODO(thaJeztah) remove the $CHANNEL check once 22.06 and docker-buildx-plugin is published to the "stable" channel
if [ "$CHANNEL" = "test" ] && version_gte "22.06"; then
pkgs="$pkgs docker-buildx-plugin"
fi
if ! is_dry_run; then
set -x
fi
Expand Down
2 changes: 1 addition & 1 deletion rootless-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if [ -z "$CHANNEL" ]; then
fi
# The latest release is currently hard-coded.
STABLE_LATEST="20.10.17"
TEST_LATEST="20.10.17"
TEST_LATEST="22.06.0-beta.0"
STATIC_RELEASE_URL=
STATIC_RELEASE_ROOTLESS_URL=
case "$CHANNEL" in
Expand Down