Github Packages: Check/Download Docker image from Github Actions

Hi,

I want to “cache” builder/tester Docker images for building Debian packages in Github Actions workflow in Github Packages.

I need to check on every workflow run if the wanted Docker image currently is in Github Packages Docker registry or if the workflow has to build it.

I am able to get the manifest information from Docker registry V2 API for given tag, but I am not able to get the manifests list (or the so-called fat manifest).

Using the GraphQL API I am able to get:

query ($login: String!) {
  user(login: $login) {
    registryPackages(first: 5, packageType: DOCKER) {
      nodes {
        name
        packageType
        versions(first: 5) {
          edges {
            node {
              platform
              version
              summary
              readme
            }
          }
        }
      }
    }
  }
}

with response of (shortened):

{
  "user": {
    "registryPackages": {
      "nodes": [
        {
          "name": "docker-image",
          "packageType": "DOCKER",
          "versions": {
            "edges": [
              {
                "node": {
                  "platform": "docker",
                  "version": "first",
                  "summary": "",
                  "readme": null
                }
              },
              {
                "node": {
                  "platform": "docker",
                  "version": "second",
                  "summary": "",
                  "readme": null
                }
              },

Where the first, second etc represent Docker tags.

However, what I need is for what architecture the image was compiled for as I plan to use the images in ARM32 / ARM64 based workflows outside Github Actions. How I can get that information? (I was expecting the “platform” field to be it.)

BTW, it would be also great if you could delete Docker images from Github Packages for Open Source projects. These things are quite large and without clearly stated limits for storage, I have inclination this will cause problems in the future.

Thanks.

EDIT:

I also investigated (terrible) ideas like this:

docker pull hello-world00000:latest &
last_pid=$!
echo "$last_pid"
sleep 3
EXITCODE=$(ps -ef | grep " $last_pid " | grep -v grep | awk '{print $2}')
echo "$EXITCODE"
if ["$EXITCODE" == "$last_pid"]; then
    kill -KILL $last_pid
    echo "Package exists in the registry"

else
    echo "Package does not exist"
fi

However, as of now I have no idea if Docker CLI will cry foul if the only image is for aarch64 or if it will happily download it.

EDIT2:

BTW, I would think that this would be pretty important - given the new PackageType DEBIAN - for distro packages.

Looking at similar question on this site, I learned that Github Packages Docker registry doesn’t support multi-arch images. I honestly did not expect this and considered it automatic, done deal that Docker registry would support amd64/armhf/aarch64 images.

However, I would still like to somehow get the amd64 or x86_64 version information from Github Packages API.

Hi @cerna ,

Correct the current GPR Docker registry docker.pkg.github.com does not support multi-arch images.

I dont’ find related Github package API to get the amd64 or x89_64 version info, but get from command ‘docker manifest inspect’ with experimental feature enabled. Code as below:

job1:
    env:
      DOCKER_CLI_EXPERIMENTAL: enabled
    runs-on: [ubuntu-latest]
    steps:
      - name: Check
        run: |
          docker pull crazymax/ddns-route53:latest
      - name: check arch
        run: |
          docker manifest inspect --verbose crazymax/ddns-route53

Thanks.