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

Support downloading binaries from docker images #106

Merged
merged 2 commits into from
Oct 30, 2024

Conversation

vvoland
Copy link
Contributor

@vvoland vvoland commented Sep 9, 2024

This patch extends the version input parameter to also accept an CSV-style options allowing to specify a different installation source of the docker binaries:

  1. archive (old and still default) - fetches static binaries from download.docker.com
  • type - must be archive
  • version - a Docker version to install (example: v27.2.1) or latest (last stable release)
  • channel - a channel to install from (test or stable)
  1. image (new) - fetches binaries from the moby/moby-bin and dockereng/cli-bin repositories
  • type - must be image
  • tag - a tag of the image, can either use a tagged version like 27.2.1 or a branch name like master.

Some examples:

  version: latest                                      # install last stable released version
  version: 27.2.1                                      # install v27.2.1 from download.docker.com
  version: type=archive                          # same as above
  version: version=27.2.1                        # same as above
  version: type=archive,version=27.2.1  # same as above

  version: type=archive,version=27.3.0-rc.1,channel=test # install v27.3.0-rc.1 from test channel
 
  version: type=image                             # install last stable released version from bin images
  version: type=image,tag=latest           # same as above

  version: type=image,tag=master            # install a cutting-edge version from the `master` branch
  version: type=image,tag=27.2.1              # install v27.2.1

src/context.ts Outdated
Comment on lines 29 to 74
if (version.indexOf('=') !== -1) {
const csv = version.split(',');
for (const c of csv) {
const kv = c.split('=');
values.set(kv[0], kv[1]);
}
} else {
values.set('type', 'archive');
values.set('version', version);
}
Copy link
Member

@crazy-max crazy-max Sep 9, 2024

Choose a reason for hiding this comment

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

@vvoland vvoland marked this pull request as ready for review October 28, 2024 09:23
@crazy-max
Copy link
Member

@vvoland #122 just got merged, you can rebase

Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

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

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
@crazy-max
Copy link
Member

@vvoland Added extra commit to test type=image,tag=latest in GHA and seems we don't use the actual version neither when downloading systemd units: https://github.com/crazy-max/ghaction-setup-docker/actions/runs/11582762974/job/32246484640?pr=106#step:5:2171

[  298.001262] cloud-init[2118]: + wget https://raw.githubusercontent.com/moby/moby/latest/contrib/init/systemd/docker.service https://raw.githubusercontent.com/moby/moby/vlatest/contrib/init/systemd/docker.service -O /etc/systemd/system/docker.service
[  298.040071] cloud-init[2118]: --2024-10-29 21:52:40--  https://raw.githubusercontent.com/moby/moby/latest/contrib/init/systemd/docker.service
[  299.046101] cloud-init[2118]: Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.111.133, 185.199.108.133, ...
[  299.082724] cloud-init[2118]: Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected.
[  299.202189] cloud-init[2118]: HTTP request sent, awaiting response... 404 Not Found
[  299.216292] cloud-init[2118]: 2024-10-29 21:52:41 ERROR 404: Not Found.
[  299.226332] cloud-init[2118]: --2024-10-29 21:52:41--  https://raw.githubusercontent.com/moby/moby/vlatest/contrib/init/systemd/docker.service
[  299.244670] cloud-init[2118]: Reusing existing connection to raw.githubusercontent.com:443.
[  299.313128] cloud-init[2118]: HTTP request sent, awaiting response... 404 Not Found
[  299.328273] cloud-init[2118]: 2024-10-29 21:52:41 ERROR 404: Not Found.
[  299.345236] cloud-init[2118]: + true
[  299.354731] cloud-init[2118]: + wget https://raw.githubusercontent.com/moby/moby/latest/contrib/init/systemd/docker.socket https://raw.githubusercontent.com/moby/moby/vlatest/contrib/init/systemd/docker.socket -O /etc/systemd/system/docker.socket
[  299.386189] cloud-init[2118]: --2024-10-29 21:52:41--  https://raw.githubusercontent.com/moby/moby/latest/contrib/init/systemd/docker.socket
[  300.347605] cloud-init[2118]: Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.109.133, 185.199.108.133, 185.199.110.133, ...
[  300.373431] cloud-init[2118]: Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.109.133|:443... connected.
[  300.471471] cloud-init[2118]: HTTP request sent, awaiting response... 404 Not Found
[  300.487020] cloud-init[2118]: 2024-10-29 21:52:42 ERROR 404: Not Found.
[  300.500385] cloud-init[2118]: --2024-10-29 21:52:42--  https://raw.githubusercontent.com/moby/moby/vlatest/contrib/init/systemd/docker.socket
[  300.520196] cloud-init[2118]: Reusing existing connection to raw.githubusercontent.com:443.
[  300.576193] cloud-init[2118]: HTTP request sent, awaiting response... 404 Not Found
[  300.600016] cloud-init[2118]: 2024-10-29 21:52:42 ERROR 404: Not Found.

@crazy-max
Copy link
Member

crazy-max commented Oct 30, 2024

Added extra commit to test type=image,tag=latest in GHA and seems we don't use the actual version neither when downloading systemd units: https://github.com/crazy-max/ghaction-setup-docker/actions/runs/11582762974/job/32246484640?pr=106#step:5:2171

I guess we could use the commit sha from org.opencontainers.image.revision label or annotation: https://github.com/moby/moby/actions/runs/11584834496/job/32252730725#step:3:59

We could also use org.opencontainers.image.source: https://github.com/moby/moby/actions/runs/11584834496/job/32252730725#step:3:60 to make sure of repo origin.

We can look at this as follow-up.

crazy-max
crazy-max previously approved these changes Oct 30, 2024
@crazy-max crazy-max dismissed their stale review October 30, 2024 09:35

ci failure

@crazy-max
Copy link
Member

crazy-max commented Oct 30, 2024

Does not seem to work on macOS: https://github.com/crazy-max/ghaction-setup-docker/actions/runs/11588305245/job/32265459115?pr=106#step:5:11

image

  Downloading docker cli from dockereng/cli-bin:26.1.5
Error: Cannot find manifest for darwin/amd64/

@vvoland I'm taking a look to switch to undock but if you want to fix this issue, feel free to open a PR on actions-toolkit repo

@vvoland
Copy link
Contributor Author

vvoland commented Oct 30, 2024

The issue here is that 26.1.5 didn't have the darwin cli builds yet.

27.0.0 was the first version to have the darwin builds in the dockereng/cli-bin:
docker/cli#4996

@vvoland
Copy link
Contributor Author

vvoland commented Oct 30, 2024

@crazy-max - Opened a PR to get the git revision from org.opencontainers.image.revision:

docker/actions-toolkit#480

@crazy-max
Copy link
Member

The issue here is that 26.1.5 didn't had the darwin cli builds yet.

Ah right my bad! Let me change the ref here

Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

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

Ok let's get this one in so we can test this workflow on moby using crazy-max/ghaction-setup-docker@master.

@crazy-max crazy-max merged commit 8321f1d into docker:master Oct 30, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants