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(docker-buildx): use correct buildx variable for cross-compilation #158

Merged
merged 2 commits into from
Jan 7, 2024

Conversation

jon-nfc
Copy link
Contributor

@jon-nfc jon-nfc commented Jan 2, 2024

The current makefile option docker-buildx was not correctly setup for cross-platform compilation.

var BUILDPLATFORM is the architecture for the machine building the image. This var is not for cross-compilation.

var TARGETPLATFORM is the correct variable to use for cross-compilation.

`BUILDPLATFORM` is the architecture for the machine building the image. this var is not for cross-compilation.

`TARGETPLATFORM` is the correct variable to use for cross-compilation.
@jon-nfc
Copy link
Contributor Author

jon-nfc commented Jan 2, 2024

don't know who to ping for this PR, however PR is ready for review

Makefile Outdated
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
docker-buildx: ## Build and push docker image for the manager for cross-platform support
# copy existing Dockerfile and insert --platform=${TARGETPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{TARGETPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{TARGETPLATFORM\}/' Dockerfile > Dockerfile.cross
Copy link
Member

Choose a reason for hiding this comment

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

@jon-nfc It looks like this is the most up to date version of this command, I haven't tested this out, but I think we should probably take the latest guidance from the ansible-operator-sdk folks:

If you agree, could you please update the PR to reflect what is shown there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see #158 (comment).

response wouldn't post to this thread

@jon-nfc
Copy link
Contributor Author

jon-nfc commented Jan 7, 2024

@jon-nfc It looks like this is the most up to date version of this command, I haven't tested this out, but I think we should probably take the latest guidance from the ansible-operator-sdk folks:

https://github.com/operator-framework/ansible-operator-plugins/blob/bbe095f316eda31423b18b8d5e6bafddd524f558/testdata/memcached-molecule-operator/Makefile#L40-L55
If you agree, could you please update the PR to reflect what is shown there?

the only response I have for this review is "what????" Just so I'm clear on your wishes. You wish for me to ensure that the docker-buildx section within the make file is the same as the one located at the link you posted? which reverts all changes this PR puts forward......

It looks like this is the most up to date version of this command

which part? what I've done or at the link posted?

I haven't tested this out

It appears no one has tested the command at all. I have, which confirmed my suspicions when i looked at the code, that it's wrong.

but

the word to denote everything before it is now irrelevant

I think we should probably take the latest guidance from the ansible-operator-sdk folks

Think? what's to think about, the code is wrong. What guidance? their implementation is wrong too. This is a clear cut case of monkey theory.

From my perspective I appear to have incorrectly assumed that the changes I did along with the comments in the commit and PR description were more obvious than not for the explanation of what's wrong and why it was corrected.

If you agree, could you please update the PR to reflect what is shown there?

no agreement here, what is in the codebase is wrong, that's why I raised the PR. If it wasn't wrong there would be no PR.

Justification

As there is no comments within commits, no PR's found specifically relating to the docker-buildx section of the makefile in either repo the following can be deduced from the code and comments:

  • That the user can build multi arch images

    # architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
    # To properly provided solutions that supports more than one platform you should use this option.

    This command has switch --platform which is used to specify the platforms to build for.

    - docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .

    The use of docker buildx build over the standard docker build is clearly implication enough that the intent is to provide support for building multi-arch images and independently of the architecture of the machine building the images. The x suffixed to build is for cross-platform,

  • the user can customize what architecture they wish to build, however if none specified, a default set of images will be built

    PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
  • Support for using plain docker build should be maintained

    sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{TARGETPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{TARGETPLATFORM\}/' Dockerfile > Dockerfile.cross

    Although the inverse could be done with the plain docker build

Prior to this PR - Feature set

Before the changes were made within this PR, cross platform support is as follows:

To build an image with the same architecture as the build machine

make docker-build

# to change the image name and tag,
IMG=image-name:image-tag makefile docker-build

Multi-arch image builds

make docker-buildx

This command fails as docker-buildx is declared docker-buildx: test. This command fails as there is no test section in the makefile. Removing the call to test the command succeeds, however without multi-arch build support.

the container having the same architecture as the machine that built the image.

# no specifying of platforms, uses default to build images for `PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le`
make docker-buildx
running command from commit 0e00851
sysadmin@laptop2:~/git/eda-server-operator$ git log -2
commit 3911fbab0c6153a4e3c3f54323c16a8ad113e78f (HEAD -> main, origin/main, origin/HEAD)
Author: Jon <[email protected]>
Date:   Tue Jan 2 21:49:31 2024 +0930

    fix(docker-buildx): use correct buidx variable for cross-compilation
    
    `BUILDPLATFORM` is the architecture for the machine building the image. this var is not for cross-compilation.
    
    `TARGETPLATFORM` is the correct variable to use for cross-compilation.

commit 0e00851ff42236c209b1253aab55c069714df411
Merge: db800aa b430e9b
Author: Christian Adams <[email protected]>
Date:   Fri Dec 15 14:28:16 2023 -0500

    Merge pull request #156 from rooftopcellist/remote-scheme-redirect
    
    Use $remote_scheme to correctly set the HTTP protocol the client is used
sysadmin@laptop2:~/git/eda-server-operator$ git reset 0e00851ff42236c209b1253aab55c069714df411 --hard
HEAD is now at 0e00851 Merge pull request #156 from rooftopcellist/remote-scheme-redirect
sysadmin@laptop2:~/git/eda-server-operator$ 
sysadmin@laptop2:~/git/eda-server-operator$ make docker-buildx
make: *** No rule to make target 'test', needed by 'docker-buildx'.  Stop.
sysadmin@laptop2:~/git/eda-server-operator$ 

to build ARM64 image you would use if test

PLATFORM=linux/arm64 make docker-buildx

however this doesn't work. why? the wrong variable is used in the dockerfile. this command only builds an image of the same architecture as the machine that built it.

Bottom line, prior to this PR multi-arch builds were not possible as the declaration was wrong. They only way one could create an image of a different architecture than at quay.io registry is to find a build machine with the desired architecture.

PR Changes - Feature Set

fix one

  • ensure the docker-buildx section of the make file runs.

remove test call from buildx declaration

fix one, remove `test` from declaration
sysadmin@laptop2:~/git/eda-server-operator$ git log -1
commit 0e00851ff42236c209b1253aab55c069714df411 (HEAD -> main)
Merge: db800aa b430e9b
Author: Christian Adams <[email protected]>
Date:   Fri Dec 15 14:28:16 2023 -0500

    Merge pull request #156 from rooftopcellist/remote-scheme-redirect
    
    Use $remote_scheme to correctly set the HTTP protocol the client is used



sysadmin@laptop2:~/git/eda-server-operator$ git diff
diff --git a/Makefile b/Makefile
index e89853d..b69cebe 100644
--- a/Makefile
+++ b/Makefile
@@ -92,7 +92,7 @@ docker-push: ## Push docker image with the manager.
 # To properly provided solutions that supports more than one platform you should use this option.
 PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
 .PHONY: docker-buildx
-docker-buildx: test ## Build and push docker image for the manager for cross-platform support
+docker-buildx: ## Build and push docker image for the manager for cross-platform support
        # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
        sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
        - docker buildx create --name project-v3-builder
sysadmin@laptop2:~/git/eda-server-operator$ 
  • now lets try and build
fix one, build output
sysadmin@laptop2:~/git/eda-server-operator$ 
sysadmin@laptop2:~/git/eda-server-operator$ make docker-buildx
# copy existing Dockerfile and insert --platform= into Dockerfile.cross, and preserve the original Dockerfile
sed -e '1 s/\(^FROM\)/FROM --platform=\$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
docker buildx create --name project-v3-builder
ERROR: existing instance for "project-v3-builder" but no append mode, specify --node to make changes for existing instances
make: [Makefile:98: docker-buildx] Error 1 (ignored)
docker buildx use project-v3-builder
docker buildx build --push --platform=linux/arm64,linux/amd64,linux/s390x,linux/ppc64le --tag quay.io/ansible/eda-server-operator:0.0.1 -f Dockerfile.cross .
[+] Building 59.5s (5/11)                                                                                       docker-container:project-v3-builder
 => [internal] booting buildkit                                                                                                                4.7s
 => => pulling image moby/buildkit:buildx-stable-1                                                                                             3.4s
 => => creating container buildx_buildkit_project-v3-builder0                                                                                  1.2s
 => [internal] load build definition from Dockerfile.cross                                                                                     0.2s
 => => transferring dockerfile: 598B                                                                                                           0.0s
 => [linux/amd64 internal] load metadata for quay.io/operator-framework/ansible-operator:v1.27.0                                               3.9s
 => [internal] load .dockerignore                                                                                                              0.1s
 => => transferring context: 171B                                                                                                              0.0s
 => [internal] load build context                                                                                                              0.2s
 => => transferring context: 137.99kB                                                                                                          0.1s
 => [linux/amd64 1/6] FROM quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660e  50.5s
 => => resolve quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b     0.1s
 => => sha256:a410cb638594e3774ca48c587754784c212d329f81b52a4a26ce2203a2b02d40 25.02MB / 25.02MB                                               9.8s
 => => sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 32B / 32B                                                       1.2s
 => => sha256:a162900bde72611bfe03489fa69f56edaad3c94aaca3e6e9c15ae1b75bddb995 581B / 581B                                                     1.9s
 => => sha256:86f5f62afd6ec97574bc09469a6604f44273cfb2af7b9c5ce879f1003e90791b 9.47kB / 9.47kB                                                 2.4s
 => => sha256:d19cab6e4eba8015a6d4ddff46c82c61c08bed40c058748e347463f4cfc58f27 63.96MB / 64.88MB                                              48.7s
 => => sha256:af3f0c395f7eb1853f50487d3c93853f4247e671c33362b4da71a23b351d5c54 262B / 262B                                                     1.4s
 => => sha256:e480d2ae103c3e5cdcd0b1159aa570815696ae5976448bb74b4bf50201e89d75 13.94kB / 13.94kB                                               1.3s
[+] Building 59.6s (5/11)                                                                                       docker-container:project-v3-builder
[+] Building 122.6s (12/12) FINISHED                                                                            docker-container:project-v3-builder 
 => [internal] booting buildkit                                                                                                                4.7s
 => => pulling image moby/buildkit:buildx-stable-1                                                                                             3.4s
 => => creating container buildx_buildkit_project-v3-builder0                                                                                  1.2s
 => [internal] load build definition from Dockerfile.cross                                                                                     0.2s
 => => transferring dockerfile: 598B                                                                                                           0.0s
 => [linux/amd64 internal] load metadata for quay.io/operator-framework/ansible-operator:v1.27.0                                               3.9s
 => [internal] load .dockerignore                                                                                                              0.1s
 => => transferring context: 171B                                                                                                              0.0s
 => [internal] load build context                                                                                                              0.2s
 => => transferring context: 137.99kB                                                                                                          0.1s
 => [linux/amd64 1/6] FROM quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660e  65.9s
 => => resolve quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b     0.1s
 => => sha256:a410cb638594e3774ca48c587754784c212d329f81b52a4a26ce2203a2b02d40 25.02MB / 25.02MB                                               9.8s
 => => sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 32B / 32B                                                       1.2s
 => => sha256:a162900bde72611bfe03489fa69f56edaad3c94aaca3e6e9c15ae1b75bddb995 581B / 581B                                                     1.9s
 => => sha256:86f5f62afd6ec97574bc09469a6604f44273cfb2af7b9c5ce879f1003e90791b 9.47kB / 9.47kB                                                 2.4s
 => => sha256:d19cab6e4eba8015a6d4ddff46c82c61c08bed40c058748e347463f4cfc58f27 64.88MB / 64.88MB                                              48.9s
 => => sha256:af3f0c395f7eb1853f50487d3c93853f4247e671c33362b4da71a23b351d5c54 262B / 262B                                                     1.4s
 => => sha256:e480d2ae103c3e5cdcd0b1159aa570815696ae5976448bb74b4bf50201e89d75 13.94kB / 13.94kB                                               1.3s
 => => sha256:649e5534d134eac0f942db1db2a7491173c90e40888923ebf261d0277c2ab73e 79.14MB / 79.14MB                                              54.9s
 => => extracting sha256:649e5534d134eac0f942db1db2a7491173c90e40888923ebf261d0277c2ab73e                                                      2.4s
 => => extracting sha256:af3f0c395f7eb1853f50487d3c93853f4247e671c33362b4da71a23b351d5c54                                                      0.1s
 => => extracting sha256:e480d2ae103c3e5cdcd0b1159aa570815696ae5976448bb74b4bf50201e89d75                                                      0.1s
 => => extracting sha256:d19cab6e4eba8015a6d4ddff46c82c61c08bed40c058748e347463f4cfc58f27                                                      4.0s
 => => extracting sha256:86f5f62afd6ec97574bc09469a6604f44273cfb2af7b9c5ce879f1003e90791b                                                      0.1s
 => => extracting sha256:a162900bde72611bfe03489fa69f56edaad3c94aaca3e6e9c15ae1b75bddb995                                                      0.0s
 => => extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1                                                      0.0s
 => => extracting sha256:a410cb638594e3774ca48c587754784c212d329f81b52a4a26ce2203a2b02d40                                                      0.3s
 => [linux/amd64 2/6] COPY requirements.yml /opt/ansible/requirements.yml                                                                      6.7s
 => [linux/amd64 3/6] RUN ansible-galaxy collection install -r /opt/ansible/requirements.yml  && chmod -R ug+rwx /opt/ansible/.ansible        24.6s
 => [linux/amd64 4/6] COPY watches.yaml /opt/ansible/watches.yaml                                                                              0.3s 
 => [linux/amd64 5/6] COPY roles/ /opt/ansible/roles/                                                                                          0.3s 
 => [linux/amd64 6/6] COPY playbooks/ /opt/ansible/playbooks/                                                                                  0.3s
 => ERROR exporting to image                                                                                                                  14.6s
 => => exporting layers                                                                                                                        1.0s
 => => exporting manifest sha256:4aad71e523bfa2571dfa178376ea3cfc76a747ff899c061c1d0e4155aaaa5984                                              0.0s
 => => exporting config sha256:118a7d1231bc5626ded1e85ed81448f12b4328ca1bdee218fe93b828aba4e774                                                0.0s
 => => exporting attestation manifest sha256:a72ac085ce1b60c8ff11f4a9507fdc58c036bbfab95b04af5bcc7563c268e34f                                  0.1s
 => => exporting manifest sha256:3d537b7ef953242d0fc41e4c67461ef32b949ac1012885b04f4efe0847e301ef                                              0.0s
 => => exporting config sha256:3557e749cf555f7ab1249bec939af9a039eeca8de03e2e3bad5cec9f32195446                                                0.1s
 => => exporting attestation manifest sha256:805724a762febfba3d372f36bba54e1ee0840633943c6e5a95ed84f912c28bd9                                  0.1s
 => => exporting manifest sha256:e41cf0b3d8b7323e3cde3929ab611939ebcae6730eabcb86752edc235787729e                                              0.1s
 => => exporting config sha256:4e50fafc4560a007c9ed1e6d722bc867096411f4ca120473feea629854cb10a6                                                0.1s
 => => exporting attestation manifest sha256:78401f4933ff6b55b475108eeee784922ea202449f2e525d2f0c5723949a4d4f                                  0.1s
 => => exporting manifest sha256:41e68f590ea6bd136f2c5b0972488c196e411c0c2a64a999d63a92172607a29f                                              0.0s
 => => exporting config sha256:3ab7e196371e79bc3062f65cbc34428fa8dac539bec1cbb8979d76bf453c058a                                                0.0s
 => => exporting attestation manifest sha256:52294ab7458972186c6836e75d43289b44dd3eae8691f68686306f9587c4c862                                  0.1s
 => => exporting manifest list sha256:01adae3d24bfea09abe09d8dbf0f80a67c89d37cef893dde129b0c3c2eae6a4d                                         0.1s
 => => pushing layers                                                                                                                         12.5s
------
 > exporting to image:
------
ERROR: failed to solve: failed to push quay.io/ansible/eda-server-operator:0.0.1: unexpected status from POST request to https://quay.io/v2/ansible/eda-server-operator/blobs/uploads/: 401 UNAUTHORIZED
make: [Makefile:100: docker-buildx] Error 1 (ignored)
docker buildx rm project-v3-builder
project-v3-builder removed
rm Dockerfile.cross
sysadmin@laptop2:~/git/eda-server-operator$ 
  • The command ran above was make docker-buildx which should have built images for linux/arm64,linux/amd64,linux/s390x,linux/ppc64le, the default; however it didn't. only AMD64 image was built. [linux/amd64 */6] denotes the arch built. of note, yes the command failed as i didn't specify a custom tag to push it to a registry i have acces to.

  • also notice the generated build command is correct docker buildx build --push --platform=linux/arm64,linux/amd64,linux/s390x,linux/ppc64le --tag quay.io/ansible/eda-server-operator:0.0.1 -f Dockerfile.cross . however, again only the architecture of the build machine was used as the arch to build.

Fix two - use correct variables for multi-arch support

I'm of the opinion that variables BUILDPLATFORM and TARGETPLATFORM are self evident of what they are. BUILDPLATFORM is automagic populated to match the architecture of the machine running the docker buildx build command where as TARGETPLATFORM variable is populated by the cli switch --platform and must be a valid architecture.

  • Update the variable so it uses the correct one. switch BUILDPLATFORM to TARGETPLATFORM
fix two, use correct variable
sysadmin@laptop2:~/git/eda-server-operator$ git log -1
commit 0e00851ff42236c209b1253aab55c069714df411 (HEAD -> main)
Merge: db800aa b430e9b
Author: Christian Adams <[email protected]>
Date:   Fri Dec 15 14:28:16 2023 -0500

    Merge pull request #156 from rooftopcellist/remote-scheme-redirect
    
    Use $remote_scheme to correctly set the HTTP protocol the client is used
sysadmin@laptop2:~/git/eda-server-operator$ 
sysadmin@laptop2:~/git/eda-server-operator$ 
sysadmin@laptop2:~/git/eda-server-operator$ git diff
diff --git a/Makefile b/Makefile
index e89853d..b9a7900 100644
--- a/Makefile
+++ b/Makefile
@@ -92,9 +92,9 @@ docker-push: ## Push docker image with the manager.
 # To properly provided solutions that supports more than one platform you should use this option.
 PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
 .PHONY: docker-buildx
-docker-buildx: test ## Build and push docker image for the manager for cross-platform support
-       # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
-       sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
+docker-buildx: ## Build and push docker image for the manager for cross-platform support
+       # copy existing Dockerfile and insert --platform=${TARGETPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
+       sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{TARGETPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{TARGETPLATFORM\}/' Dockerfile > Dockerfile.cross
        - docker buildx create --name project-v3-builder
        docker buildx use project-v3-builder
        - docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .
sysadmin@laptop2:~/git/eda-server-operator$ 

now lets build multi-arch images,

fix two, command output
sysadmin@laptop2:~/git/eda-server-operator$ make docker-buildx
# copy existing Dockerfile and insert --platform= into Dockerfile.cross, and preserve the original Dockerfile
sed -e '1 s/\(^FROM\)/FROM --platform=\$\{TARGETPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$\{TARGETPLATFORM\}/' Dockerfile > Dockerfile.cross
docker buildx create --name project-v3-builder
project-v3-builder
docker buildx use project-v3-builder
docker buildx build --push --platform=linux/arm64,linux/amd64,linux/s390x,linux/ppc64le --tag quay.io/ansible/eda-server-operator:0.0.1 -f Dockerfile.cross .
[+] Building 319.1s (33/33) FINISHED                                                                                                                                         docker-container:project-v3-builder
 => [internal] booting buildkit                                                                                                                                                                             4.0s
 => => pulling image moby/buildkit:buildx-stable-1                                                                                                                                                          2.8s
 => => creating container buildx_buildkit_project-v3-builder0                                                                                                                                               1.2s
 => [internal] load build definition from Dockerfile.cross                                                                                                                                                  0.4s
 => => transferring dockerfile: 599B                                                                                                                                                                        0.0s
 => [linux/amd64 internal] load metadata for quay.io/operator-framework/ansible-operator:v1.27.0                                                                                                            4.7s
 => [linux/s390x internal] load metadata for quay.io/operator-framework/ansible-operator:v1.27.0                                                                                                            6.4s
 => [linux/ppc64le internal] load metadata for quay.io/operator-framework/ansible-operator:v1.27.0                                                                                                          6.2s
 => [linux/arm64 internal] load metadata for quay.io/operator-framework/ansible-operator:v1.27.0                                                                                                            6.3s
 => [internal] load .dockerignore                                                                                                                                                                           0.2s
 => => transferring context: 171B                                                                                                                                                                           0.0s
 => [internal] load build context                                                                                                                                                                           0.5s
 => => transferring context: 137.99kB                                                                                                                                                                       0.0s
 => [linux/s390x 1/6] FROM quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                    190.4s
 => => resolve quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                                  0.6s
 => => sha256:98b78ab39fa7a7ce7683d3d924a937f5f887e9955e6b9c789ced00625f8ba1ba 24.70MB / 24.70MB                                                                                                           77.3s
 => => sha256:ba1279a54461b9e9f57571bae247b61978c771bfe48fc5c7ef9e70f7db815661 581B / 581B                                                                                                                  2.4s
 => => sha256:0949346439167993cbab3851e050f69388f94a7d2ed82602958c59496bed89c8 9.73kB / 9.73kB                                                                                                              2.6s
 => => sha256:be97cdf74f6401d15615bcb38b5bfb25446af8717efa08698360aa2d888b140d 60.13MB / 60.13MB                                                                                                           96.0s
 => => sha256:eadc43eb1208180c78aa0db936dac2e706d8c8ac66b2b0dadd15b4a241f58c8f 76.12MB / 76.12MB                                                                                                           92.1s
 => => extracting sha256:eadc43eb1208180c78aa0db936dac2e706d8c8ac66b2b0dadd15b4a241f58c8f                                                                                                                   2.4s
 => => extracting sha256:971ecb619bbf0444e31e128864adb0c50cd3e8bfb806b4b8120d0990553c97a4                                                                                                                   0.2s
 => => extracting sha256:e480d2ae103c3e5cdcd0b1159aa570815696ae5976448bb74b4bf50201e89d75                                                                                                                   0.1s
 => => extracting sha256:be97cdf74f6401d15615bcb38b5bfb25446af8717efa08698360aa2d888b140d                                                                                                                   4.4s
 => => extracting sha256:0949346439167993cbab3851e050f69388f94a7d2ed82602958c59496bed89c8                                                                                                                   1.7s
 => => extracting sha256:ba1279a54461b9e9f57571bae247b61978c771bfe48fc5c7ef9e70f7db815661                                                                                                                   1.3s
 => => extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1                                                                                                                   2.0s
 => => extracting sha256:98b78ab39fa7a7ce7683d3d924a937f5f887e9955e6b9c789ced00625f8ba1ba                                                                                                                   1.3s
 => [linux/arm64 1/6] FROM quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                    129.1s
 => => resolve quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                                  0.5s
 => => sha256:0617eed5fbc6af48b97c3e3c5c4bf22820e98f67294a493a95ac1c655c654258 23.36MB / 23.36MB                                                                                                           18.7s
 => => sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 32B / 32B                                                                                                                    0.5s
 => => sha256:460a2b58971a09387c73af91b06462e7d289da2d80ef6ef42a4cca6a62d75512 581B / 581B                                                                                                                  2.5s
 => => sha256:9d060052cff3125e346031e6e4a5ca2c51a48ab9ac9f3c4684d18a4b1ceaf3fc 9.04kB / 9.04kB                                                                                                              2.2s
 => => sha256:0e0b4f8ae73926163dd7c0fcf5c5bf42448be9b69ee0c8dba7ddc21c16f93663 64.55MB / 64.55MB                                                                                                          110.8s
 => => sha256:e480d2ae103c3e5cdcd0b1159aa570815696ae5976448bb74b4bf50201e89d75 13.94kB / 13.94kB                                                                                                            0.9s
 => => sha256:971ecb619bbf0444e31e128864adb0c50cd3e8bfb806b4b8120d0990553c97a4 263B / 263B                                                                                                                  2.4s
 => => sha256:02007dd5742cf0e02af80120d21c02e90f46c6137dccdd56e38333253ebf8386 76.75MB / 76.75MB                                                                                                          116.2s
 => => extracting sha256:02007dd5742cf0e02af80120d21c02e90f46c6137dccdd56e38333253ebf8386                                                                                                                   2.6s
 => => extracting sha256:971ecb619bbf0444e31e128864adb0c50cd3e8bfb806b4b8120d0990553c97a4                                                                                                                   0.1s
 => => extracting sha256:e480d2ae103c3e5cdcd0b1159aa570815696ae5976448bb74b4bf50201e89d75                                                                                                                   0.0s
 => => extracting sha256:0e0b4f8ae73926163dd7c0fcf5c5bf42448be9b69ee0c8dba7ddc21c16f93663                                                                                                                   4.0s
 => => extracting sha256:9d060052cff3125e346031e6e4a5ca2c51a48ab9ac9f3c4684d18a4b1ceaf3fc                                                                                                                   0.1s
 => => extracting sha256:460a2b58971a09387c73af91b06462e7d289da2d80ef6ef42a4cca6a62d75512                                                                                                                   0.1s
 => => extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1                                                                                                                   0.0s
 => => extracting sha256:0617eed5fbc6af48b97c3e3c5c4bf22820e98f67294a493a95ac1c655c654258                                                                                                                   0.3s
 => [linux/amd64 1/6] FROM quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                    255.6s
 => => resolve quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                                  0.5s
 => => sha256:a410cb638594e3774ca48c587754784c212d329f81b52a4a26ce2203a2b02d40 25.02MB / 25.02MB                                                                                                           47.2s
 => => sha256:a162900bde72611bfe03489fa69f56edaad3c94aaca3e6e9c15ae1b75bddb995 581B / 581B                                                                                                                  0.5s
 => => sha256:86f5f62afd6ec97574bc09469a6604f44273cfb2af7b9c5ce879f1003e90791b 9.47kB / 9.47kB                                                                                                              0.5s
 => => sha256:d19cab6e4eba8015a6d4ddff46c82c61c08bed40c058748e347463f4cfc58f27 64.88MB / 64.88MB                                                                                                           67.0s
 => => sha256:af3f0c395f7eb1853f50487d3c93853f4247e671c33362b4da71a23b351d5c54 262B / 262B                                                                                                                  1.5s
 => => sha256:649e5534d134eac0f942db1db2a7491173c90e40888923ebf261d0277c2ab73e 79.14MB / 79.14MB                                                                                                           50.8s
 => => extracting sha256:649e5534d134eac0f942db1db2a7491173c90e40888923ebf261d0277c2ab73e                                                                                                                   2.3s
 => => extracting sha256:af3f0c395f7eb1853f50487d3c93853f4247e671c33362b4da71a23b351d5c54                                                                                                                   1.2s
 => => extracting sha256:e480d2ae103c3e5cdcd0b1159aa570815696ae5976448bb74b4bf50201e89d75                                                                                                                   0.9s
 => => extracting sha256:d19cab6e4eba8015a6d4ddff46c82c61c08bed40c058748e347463f4cfc58f27                                                                                                                   5.2s
 => => extracting sha256:86f5f62afd6ec97574bc09469a6604f44273cfb2af7b9c5ce879f1003e90791b                                                                                                                   1.0s
 => => extracting sha256:a162900bde72611bfe03489fa69f56edaad3c94aaca3e6e9c15ae1b75bddb995                                                                                                                   1.3s
 => => extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1                                                                                                                   1.5s
 => => extracting sha256:a410cb638594e3774ca48c587754784c212d329f81b52a4a26ce2203a2b02d40                                                                                                                   1.3s
 => [linux/ppc64le 1/6] FROM quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                  241.0s
 => => resolve quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                                  0.5s
 => => sha256:b867f87590b8f0017ea6c633ebb66808a0e188d5f97b75e0b39930a1540582a7 23.07MB / 23.07MB                                                                                                           36.0s
 => => sha256:1c08c84a47af5e825c04fd537ab7decd04906a1c1a5a34ee181ce00489149fb7 582B / 582B                                                                                                                  1.8s
 => => sha256:9817a6f828801933d0dc746dd105d3378bac07789a680aef7dd8269f3e7160c8 9.60kB / 9.60kB                                                                                                              1.9s
 => => sha256:ba64f8b2f828edb6013769c954664bb3d5eb961b006f13c8a57bf31c6a398dad 60.28MB / 60.28MB                                                                                                           63.3s
 => => sha256:ffccdb4e3c404cc1cc140915ca062919bfaedea8462b50f2b54696124f0e29b7 85.75MB / 85.75MB                                                                                                          109.5s
 => => extracting sha256:ffccdb4e3c404cc1cc140915ca062919bfaedea8462b50f2b54696124f0e29b7                                                                                                                   2.7s
 => => extracting sha256:971ecb619bbf0444e31e128864adb0c50cd3e8bfb806b4b8120d0990553c97a4                                                                                                                   0.1s
 => => extracting sha256:e480d2ae103c3e5cdcd0b1159aa570815696ae5976448bb74b4bf50201e89d75                                                                                                                   0.1s
 => => extracting sha256:ba64f8b2f828edb6013769c954664bb3d5eb961b006f13c8a57bf31c6a398dad                                                                                                                   3.8s
 => => extracting sha256:9817a6f828801933d0dc746dd105d3378bac07789a680aef7dd8269f3e7160c8                                                                                                                   0.1s
 => => extracting sha256:1c08c84a47af5e825c04fd537ab7decd04906a1c1a5a34ee181ce00489149fb7                                                                                                                   0.1s
 => => extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1                                                                                                                   0.1s
 => => extracting sha256:b867f87590b8f0017ea6c633ebb66808a0e188d5f97b75e0b39930a1540582a7                                                                                                                   0.3s
 => [linux/arm64 2/6] COPY requirements.yml /opt/ansible/requirements.yml                                                                                                                                  10.8s
 => [linux/arm64 3/6] RUN ansible-galaxy collection install -r /opt/ansible/requirements.yml  && chmod -R ug+rwx /opt/ansible/.ansible                                                                     49.1s
 => [linux/arm64 4/6] COPY watches.yaml /opt/ansible/watches.yaml                                                                                                                                           1.7s
 => [linux/s390x 2/6] COPY requirements.yml /opt/ansible/requirements.yml                                                                                                                                   0.4s
 => [linux/arm64 5/6] COPY roles/ /opt/ansible/roles/                                                                                                                                                       0.5s
 => [linux/s390x 3/6] RUN ansible-galaxy collection install -r /opt/ansible/requirements.yml  && chmod -R ug+rwx /opt/ansible/.ansible                                                                     38.4s
 => [linux/arm64 6/6] COPY playbooks/ /opt/ansible/playbooks/                                                                                                                                               0.4s
 => [linux/s390x 4/6] COPY watches.yaml /opt/ansible/watches.yaml                                                                                                                                           0.2s
 => [linux/s390x 5/6] COPY roles/ /opt/ansible/roles/                                                                                                                                                       0.3s
 => [linux/s390x 6/6] COPY playbooks/ /opt/ansible/playbooks/                                                                                                                                               0.4s
 => [linux/ppc64le 2/6] COPY requirements.yml /opt/ansible/requirements.yml                                                                                                                                19.2s
 => [linux/amd64 2/6] COPY requirements.yml /opt/ansible/requirements.yml                                                                                                                                   4.2s
 => [linux/ppc64le 3/6] RUN ansible-galaxy collection install -r /opt/ansible/requirements.yml  && chmod -R ug+rwx /opt/ansible/.ansible                                                                   30.2s
 => [linux/amd64 3/6] RUN ansible-galaxy collection install -r /opt/ansible/requirements.yml  && chmod -R ug+rwx /opt/ansible/.ansible                                                                     17.5s
 => [linux/amd64 4/6] COPY watches.yaml /opt/ansible/watches.yaml                                                                                                                                           0.2s
 => [linux/amd64 5/6] COPY roles/ /opt/ansible/roles/                                                                                                                                                       0.2s
 => [linux/amd64 6/6] COPY playbooks/ /opt/ansible/playbooks/                                                                                                                                               0.3s
 => [linux/ppc64le 4/6] COPY watches.yaml /opt/ansible/watches.yaml                                                                                                                                         0.2s
 => [linux/ppc64le 5/6] COPY roles/ /opt/ansible/roles/                                                                                                                                                     0.2s
 => [linux/ppc64le 6/6] COPY playbooks/ /opt/ansible/playbooks/                                                                                                                                             0.2s
 => ERROR exporting to image                                                                                                                                                                               15.6s
 => => exporting layers                                                                                                                                                                                     3.8s
 => => exporting manifest sha256:cf6d90d20cc4a6db1e38104dcffdc52e218adb2db69a5d309038e1398ca3cdc4                                                                                                           0.1s
 => => exporting config sha256:5efa88dca4c4f78a8aa2c2cf5d643dc4d9449318482510c4677794116f21e3d9                                                                                                             0.0s
 => => exporting attestation manifest sha256:13970e0ac35553964e82e7a64db505888fa556b268664fef5caf2646207fcd73                                                                                               0.1s
 => => exporting manifest sha256:3efe03da6f792ec9403db94254139cbeccea6dcde00b5074b70772d6669472b0                                                                                                           0.1s
 => => exporting config sha256:f0483da4e0c6da423ade273b4f0cb86978e17ae307809ee0d7cbfa00dec41efc                                                                                                             0.0s
 => => exporting attestation manifest sha256:f75ee811488ee690068c5bb6cf55aba4d0d858379457b97481fc7d4c267cf59d                                                                                               0.1s
 => => exporting manifest sha256:55e8577548fe11b1ca395efaaf2fc1b068cf639d5483f02f55577a165e29bcc6                                                                                                           0.1s
 => => exporting config sha256:69c1898e794f953d22f8b80c045a8abb2754b4e2e61fd4b68aab5aa5c1eded72                                                                                                             0.0s
 => => exporting attestation manifest sha256:e5778031818c0206ad96e2714f4a0df9691126bae5aa00f35e1e50053aca6edf                                                                                               0.1s
 => => exporting manifest sha256:d1a841e2cec40fbcc06903fe8ff5111b2b41ab1b4a3a58fd76c9eb6caea25b72                                                                                                           0.1s
 => => exporting config sha256:da0c68d365abda2852b71b4669c31c5babbfa34ce0fbfec566814a33b5141d46                                                                                                             0.1s
 => => exporting attestation manifest sha256:efea20f5e49350da5da3cbf2835a3e4ca2b8bd597991c32e6a96b3c4a057bb3b                                                                                               0.2s
 => => exporting manifest list sha256:b6f21ac052af572035bcae57849ae99ad1ba64294ff3bf9c3d53a9f7ccce0ebc                                                                                                      0.1s
 => => pushing layers                                                                                                                                                                                      10.4s
------
 > exporting to image:
------
ERROR: failed to solve: failed to push quay.io/ansible/eda-server-operator:0.0.1: unexpected status from POST request to https://quay.io/v2/ansible/eda-server-operator/blobs/uploads/: 401 UNAUTHORIZED
make: [Makefile:100: docker-buildx] Error 1 (ignored)
docker buildx rm project-v3-builder
project-v3-builder removed
rm Dockerfile.cross
sysadmin@laptop2:~/git/eda-server-operator$
  • presto, now the multi-arch build support worked and the default set of images defined PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le were built and not of the architecture of the build machine (AMD64 - AMD Ryzen7). alias the command failed, again as per before, I didn't change the registry to push to. This is evidenced by the notations of => [{arch here} */6] i.e. [linux/arm64 */6] for arm64
Demonstration of building images that are different to the build machines architecture `linux/arm64,linux/s390x`
sysadmin@laptop2:~/git/eda-server-operator$ git log -2
commit 3911fbab0c6153a4e3c3f54323c16a8ad113e78f (HEAD -> main, origin/main, origin/HEAD)
Author: Jon <[email protected]>
Date:   Tue Jan 2 21:49:31 2024 +0930

    fix(docker-buildx): use correct buidx variable for cross-compilation
    
    `BUILDPLATFORM` is the architecture for the machine building the image. this var is not for cross-compilation.
    
    `TARGETPLATFORM` is the correct variable to use for cross-compilation.

commit 0e00851ff42236c209b1253aab55c069714df411
Merge: db800aa b430e9b
Author: Christian Adams <[email protected]>
Date:   Fri Dec 15 14:28:16 2023 -0500

    Merge pull request #156 from rooftopcellist/remote-scheme-redirect
    
    Use $remote_scheme to correctly set the HTTP protocol the client is used
sysadmin@laptop2:~/git/eda-server-operator$ 
sysadmin@laptop2:~/git/eda-server-operator$ 
sysadmin@laptop2:~/git/eda-server-operator$ 
sysadmin@laptop2:~/git/eda-server-operator$ git diff
sysadmin@laptop2:~/git/eda-server-operator$ 
sysadmin@laptop2:~/git/eda-server-operator$ PLATFORMS='linux/arm64,linux/s390x' make docker-buildx
# copy existing Dockerfile and insert --platform= into Dockerfile.cross, and preserve the original Dockerfile
sed -e '1 s/\(^FROM\)/FROM --platform=\$\{TARGETPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$\{TARGETPLATFORM\}/' Dockerfile > Dockerfile.cross
docker buildx create --name project-v3-builder
project-v3-builder
docker buildx use project-v3-builder
docker buildx build --push --platform=linux/arm64,linux/s390x --tag quay.io/ansible/eda-server-operator:0.0.1 -f Dockerfile.cross .
[+] Building 190.6s (19/19) FINISHED                                                                                                                                         docker-container:project-v3-builder
 => [internal] booting buildkit                                                                                                                                                                             3.4s
 => => pulling image moby/buildkit:buildx-stable-1                                                                                                                                                          2.5s
 => => creating container buildx_buildkit_project-v3-builder0                                                                                                                                               0.9s
 => [internal] load build definition from Dockerfile.cross                                                                                                                                                  0.2s
 => => transferring dockerfile: 599B                                                                                                                                                                        0.0s
 => [linux/s390x internal] load metadata for quay.io/operator-framework/ansible-operator:v1.27.0                                                                                                            3.5s
 => [linux/arm64 internal] load metadata for quay.io/operator-framework/ansible-operator:v1.27.0                                                                                                            3.5s
 => [internal] load .dockerignore                                                                                                                                                                           0.1s
 => => transferring context: 171B                                                                                                                                                                           0.0s
 => [internal] load build context                                                                                                                                                                           0.2s
 => => transferring context: 137.99kB                                                                                                                                                                       0.0s
 => [linux/s390x 1/6] FROM quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                    121.7s
 => => resolve quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                                  0.2s
 => => sha256:98b78ab39fa7a7ce7683d3d924a937f5f887e9955e6b9c789ced00625f8ba1ba 24.70MB / 24.70MB                                                                                                           17.2s
 => => sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 32B / 32B                                                                                                                    0.6s
 => => sha256:ba1279a54461b9e9f57571bae247b61978c771bfe48fc5c7ef9e70f7db815661 581B / 581B                                                                                                                  0.9s
 => => sha256:0949346439167993cbab3851e050f69388f94a7d2ed82602958c59496bed89c8 9.73kB / 9.73kB                                                                                                              1.0s
 => => sha256:be97cdf74f6401d15615bcb38b5bfb25446af8717efa08698360aa2d888b140d 60.13MB / 60.13MB                                                                                                          115.2s
 => => sha256:e480d2ae103c3e5cdcd0b1159aa570815696ae5976448bb74b4bf50201e89d75 13.94kB / 13.94kB                                                                                                            1.4s
 => => sha256:eadc43eb1208180c78aa0db936dac2e706d8c8ac66b2b0dadd15b4a241f58c8f 76.12MB / 76.12MB                                                                                                          109.5s
 => => sha256:971ecb619bbf0444e31e128864adb0c50cd3e8bfb806b4b8120d0990553c97a4 263B / 263B                                                                                                                  0.9s
 => => extracting sha256:eadc43eb1208180c78aa0db936dac2e706d8c8ac66b2b0dadd15b4a241f58c8f                                                                                                                   2.4s
 => => extracting sha256:971ecb619bbf0444e31e128864adb0c50cd3e8bfb806b4b8120d0990553c97a4                                                                                                                   0.1s
 => => extracting sha256:e480d2ae103c3e5cdcd0b1159aa570815696ae5976448bb74b4bf50201e89d75                                                                                                                   0.1s
 => => extracting sha256:be97cdf74f6401d15615bcb38b5bfb25446af8717efa08698360aa2d888b140d                                                                                                                   4.0s
 => => extracting sha256:0949346439167993cbab3851e050f69388f94a7d2ed82602958c59496bed89c8                                                                                                                   0.1s
 => => extracting sha256:ba1279a54461b9e9f57571bae247b61978c771bfe48fc5c7ef9e70f7db815661                                                                                                                   0.1s
 => => extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1                                                                                                                   0.0s
 => => extracting sha256:98b78ab39fa7a7ce7683d3d924a937f5f887e9955e6b9c789ced00625f8ba1ba                                                                                                                   0.3s
 => [linux/arm64 1/6] FROM quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                    140.3s
 => => resolve quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                                  0.2s
 => => sha256:0617eed5fbc6af48b97c3e3c5c4bf22820e98f67294a493a95ac1c655c654258 23.36MB / 23.36MB                                                                                                           84.4s
 => => sha256:460a2b58971a09387c73af91b06462e7d289da2d80ef6ef42a4cca6a62d75512 581B / 581B                                                                                                                  0.8s
 => => sha256:9d060052cff3125e346031e6e4a5ca2c51a48ab9ac9f3c4684d18a4b1ceaf3fc 9.04kB / 9.04kB                                                                                                              0.5s
 => => sha256:0e0b4f8ae73926163dd7c0fcf5c5bf42448be9b69ee0c8dba7ddc21c16f93663 64.55MB / 64.55MB                                                                                                           68.7s
 => => sha256:02007dd5742cf0e02af80120d21c02e90f46c6137dccdd56e38333253ebf8386 76.75MB / 76.75MB                                                                                                           44.7s
 => => extracting sha256:02007dd5742cf0e02af80120d21c02e90f46c6137dccdd56e38333253ebf8386                                                                                                                   2.4s
 => => extracting sha256:971ecb619bbf0444e31e128864adb0c50cd3e8bfb806b4b8120d0990553c97a4                                                                                                                   0.1s
 => => extracting sha256:e480d2ae103c3e5cdcd0b1159aa570815696ae5976448bb74b4bf50201e89d75                                                                                                                   0.1s
 => => extracting sha256:0e0b4f8ae73926163dd7c0fcf5c5bf42448be9b69ee0c8dba7ddc21c16f93663                                                                                                                   3.9s
 => => extracting sha256:9d060052cff3125e346031e6e4a5ca2c51a48ab9ac9f3c4684d18a4b1ceaf3fc                                                                                                                   0.1s
 => => extracting sha256:460a2b58971a09387c73af91b06462e7d289da2d80ef6ef42a4cca6a62d75512                                                                                                                   0.1s
 => => extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1                                                                                                                   0.1s
 => => extracting sha256:0617eed5fbc6af48b97c3e3c5c4bf22820e98f67294a493a95ac1c655c654258                                                                                                                   0.4s
 => [linux/s390x 2/6] COPY requirements.yml /opt/ansible/requirements.yml                                                                                                                                   7.6s
 => [linux/s390x 3/6] RUN ansible-galaxy collection install -r /opt/ansible/requirements.yml  && chmod -R ug+rwx /opt/ansible/.ansible                                                                     24.9s
 => [linux/arm64 2/6] COPY requirements.yml /opt/ansible/requirements.yml                                                                                                                                   8.0s
 => [linux/arm64 3/6] RUN ansible-galaxy collection install -r /opt/ansible/requirements.yml  && chmod -R ug+rwx /opt/ansible/.ansible                                                                     23.8s
 => [linux/s390x 4/6] COPY watches.yaml /opt/ansible/watches.yaml                                                                                                                                           0.2s
 => [linux/s390x 5/6] COPY roles/ /opt/ansible/roles/                                                                                                                                                       0.2s
 => [linux/s390x 6/6] COPY playbooks/ /opt/ansible/playbooks/                                                                                                                                               0.2s
 => [linux/arm64 4/6] COPY watches.yaml /opt/ansible/watches.yaml                                                                                                                                           0.2s
 => [linux/arm64 5/6] COPY roles/ /opt/ansible/roles/                                                                                                                                                       0.2s
 => [linux/arm64 6/6] COPY playbooks/ /opt/ansible/playbooks/                                                                                                                                               0.2s
 => ERROR exporting to image                                                                                                                                                                                9.9s
 => => exporting layers                                                                                                                                                                                     1.8s
 => => exporting manifest sha256:ef0ab43b98a7ac5a495a1a3a18ca876a5bba26430dc7e4a28c230288b91016eb                                                                                                           0.1s
 => => exporting config sha256:3b1ef05f0695bbd412016bc80d614869ddab5ace1ee1a7395ecd944d77d514eb                                                                                                             0.0s
 => => exporting attestation manifest sha256:38619c6bdcf15e88e353eef6ee5c75d09e3131d1358f5a0dba592fab85becd7a                                                                                               0.1s
 => => exporting manifest sha256:8b51e56382cf5d21563925a38d496b22401f1b4f48dba44a2b1c153a83183da3                                                                                                           0.0s
 => => exporting config sha256:d6051cc41a3167842c31a1bdbf41ff9cfbce74704fda18f3d09b7f7459063544                                                                                                             0.0s
 => => exporting attestation manifest sha256:ffeb6d399cf102882b447ff70adf198733e7db024e1e3fe123b9e97388f7bbbd                                                                                               0.1s
 => => exporting manifest list sha256:d75e1a158fb055d016aa3e95dbd6353c640256458f9535974a86360f320b1ec4                                                                                                      0.1s
 => => pushing layers                                                                                                                                                                                       7.4s
------
 > exporting to image:
------
ERROR: failed to solve: failed to push quay.io/ansible/eda-server-operator:0.0.1: unexpected status from POST request to https://quay.io/v2/ansible/eda-server-operator/blobs/uploads/: 401 UNAUTHORIZED
make: [Makefile:100: docker-buildx] Error 1 (ignored)
docker buildx rm project-v3-builder
project-v3-builder removed
rm Dockerfile.cross
sysadmin@laptop2:~/git/eda-server-operator$ 

FYI, the machine I ran these commands from is AMD64 - AMD Ryzen 7.

sysadmin@laptop2:~$ uname -a
Linux laptop2 6.1.0-14-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.64-1 (2023-11-30) x86_64 GNU/Linux
sysadmin@laptop2:~$

What My fixes bring feature wise is the following:

  • command make docker-buildx that runs

  • True Cross-Platform builds. You don't need an arm64 build machine to build an arm image. you just tell the docker buildx what you want.

  • easily migrate github action to automagic build cross-platform images. it's only one command make docker-buildx

    file: github/workflows/build-operator-image.yaml

    ---
    
    name: Build Operator Image
    
    on:
    push:
        branches: [main]
    
    jobs:
    release:
        runs-on: ubuntu-latest
        name: Push main image
        steps:
        - uses: actions/checkout@v2
    
        - name: Build Image
            run: |
    -          IMG=eda-server-operator:main make docker-build
    +          IMG=eda-server-operator:main make docker-buildx
    
        - name: Push To Quay
            uses: redhat-actions/[email protected]
            with:
            image: eda-server-operator
            tags: main
            registry: quay.io/ansible/
            username: ${{ secrets.QUAY_USER }}
            password: ${{ secrets.QUAY_TOKEN }}

To summarize. this is most definitely a long winded reply, which unfortunately from your review demonstrated is required. I do not make a habit of wasting time, for example raising a pull request for something that the review alluded to was "not the way we do it". Simple fact is that I'm intending on using this product and require arm64 support and it's currently broken. Thanks to the open source nature of this project, I can fix it, so I did. I know it was broken by looking at the code which was also confirmed when I tested it.

At the end of the day, it is not my place to determine a requirement that forms part of the "projects" direction. Fact is what's the current code base is wrong for cross-platform image builds and this PR corrects it. I'm happy to discuss further these changes I have made; for which the explanation above should demonstrate quite clearly on why they were needed. If however the approach is to follow another monkey, who I will add has also got it wrong. Then please save us both the time and close this PR. Eagerly awaiting your response.

@kurokobo
Copy link
Contributor

kurokobo commented Jan 7, 2024

@rooftopcellist
The Makefile in ansible-operator-plugins also seems that the definition for docker-buildx has not been updated for a long time (including before moving from operator-sdk repo).
If my understanding is correct I'm sure that indeed the docker-buildx does not work as expected, so we should modify both this repository and ansible-operator-plugins, and maybe the same file for Helm-based operator.

My understanding is that inserting --platform=${BUILDPLATFORM} is correct for Go-based Operator; the Go-based Operator's Dockerfile is designed for multi-stage build and the first FROM is for the builder. Cross-compilation should run on the native platform, not the target platform, so --platform=${BUILDPLATFORM} is valid. In later stages, the cross-compiled binaries are copied to a image for target platform.

In contrast, the Dockerfile for the Ansible-based Operator is not a multi-stage build, so the platform specified in the first FROM must be for the target platform.

@jon-nfc
I think we can simply remove whole sed and use Dockerfile as-is since --platform=${TARGETPLATFORM} is default behavior.

--- a/Makefile
+++ b/Makefile
@@ -92,14 +92,11 @@ docker-push: ## Push docker image with the manager.
 # To properly provided solutions that supports more than one platform you should use this option.
 PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
 .PHONY: docker-buildx
-docker-buildx: test ## Build and push docker image for the manager for cross-platform support
-       # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
-       sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
+docker-buildx: ## Build and push docker image for the manager for cross-platform support
        - docker buildx create --name project-v3-builder
        docker buildx use project-v3-builder
-       - docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .
+       - docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile .
        - docker buildx rm project-v3-builder
-       rm Dockerfile.cross

…sted in the first place

The editing of the dockerfile is not required as specifying the platform in the `FROM` statement is already done by default.

These lines of code are useless
@jon-nfc
Copy link
Contributor Author

jon-nfc commented Jan 7, 2024

@kurokobo, cheers for the review.

I think we can simply remove whole sed and use Dockerfile as-is since --platform=${TARGETPLATFORM} is default behavior.

I did not know this and now that I do and after testing, the patch you have makes more sense. why have extra code that achieves the same thing as it not being there in the first place.

@rooftopcellist
Copy link
Member

@jon-nfc Sorry, I was saying that I didn't get to test your PR's changes out yet because I am still on vacation and didn't have my laptop with me. From just looking at the code, my logical conclusion was that we should update our operator's code to do whatever the latest ansible-operator-sdk guidance was, as that is commonly what resolves issues like this. I generally default to trying to do things the way they are done in the ansible-operator-sdk where possible for consistency and to reduce the maintenance burden.

From your comments, I can see now that the ansible-operators-plugins repo's Makefile is currently broken. I should have waited until I could test this out myself before commenting. Thank you for the information

Now that I have read up on this some more, @kurokobo 's suggestions look to be the best approach. Thank you for updating the PR with those changes. When I get back I'll test out the build and make sure it works and provide another review. I'll make sure to let the ansible-operator-plugins folks know on Monday.

@jon-nfc
Copy link
Contributor Author

jon-nfc commented Jan 7, 2024

@jon-nfc Sorry, I was saying that I didn't get to test your PR's changes out yet because I am still on vacation and didn't have my laptop with me. From just looking at the code, my logical conclusion was that we should update our operator's code to do whatever the latest ansible-operator-sdk guidance was, as that is commonly what resolves issues like this. I generally default to trying to do things the way they are done in the ansible-operator-sdk where possible for consistency and to reduce the maintenance burden.

From your comments, I can see now that the ansible-operators-plugins repo's Makefile is currently broken. I should have waited until I could test this out myself before commenting. Thank you for the information

Now that I have read up on this some more, @kurokobo 's suggestions look to be the best approach. Thank you for updating the PR with those changes. When I get back I'll test out the build and make sure it works and provide another review. I'll make sure to let the ansible-operator-plugins folks know on Monday.

Righto, makes sense. oh and don't forget holidays are not a time for work!!! it'll still be there when you return.

Copy link
Member

@rooftopcellist rooftopcellist left a comment

Choose a reason for hiding this comment

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

This works with the current changes to remove the sed command and generation of the custom Dockerfile.cross from the docker-buildx target. This is not needed for ansible-operators as @kurokobo mentioned. This should be changed in the ansible-operator-plugins repo as well, and this make target should be added to the awx-operator repo imo.

Running the following results in only an amd64 build of the eda-server-operator:

$ PLATFORMS=linux/arm64 make docker-buildx

image

Running the following results in all 4 default arches

make docker-buildx

image

Buildx Logs
[chadams@awx eda-server-operator]$ PLATFORM=linux/arm64 make docker-buildx
docker buildx create --name project-v3-builder
project-v3-builder
docker buildx use project-v3-builder
docker buildx build --push --platform=linux/arm64,linux/amd64,linux/s390x,linux/ppc64le --tag quay.io/ansible/eda-server-operator:0.0.1 -f Dockerfile .
[+] Building 206.3s (35/35) FINISHED                                                                                                                                                                                                                                                       docker-container:project-v3-builder
 => [internal] booting buildkit                                                                                                                                                                                                                                                                                           1.1s
 => => pulling image moby/buildkit:buildx-stable-1                                                                                                                                                                                                                                                                        0.5s
 => => creating container buildx_buildkit_project-v3-builder0                                                                                                                                                                                                                                                             0.6s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                                      0.2s
 => => transferring dockerfile: 623B                                                                                                                                                                                                                                                                                      0.0s
 => [linux/ppc64le internal] load metadata for quay.io/operator-framework/ansible-operator:v1.27.0                                                                                                                                                                                                                        3.4s
 => [linux/arm64 internal] load metadata for quay.io/operator-framework/ansible-operator:v1.27.0                                                                                                                                                                                                                          3.8s
 => [linux/s390x internal] load metadata for quay.io/operator-framework/ansible-operator:v1.27.0                                                                                                                                                                                                                          3.4s
 => [linux/amd64 internal] load metadata for quay.io/operator-framework/ansible-operator:v1.27.0                                                                                                                                                                                                                          4.2s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                         0.2s
 => => transferring context: 230B                                                                                                                                                                                                                                                                                         0.0s
 => [internal] load build context                                                                                                                                                                                                                                                                                         0.3s
 => => transferring context: 148.90kB                                                                                                                                                                                                                                                                                     0.0s
 => [linux/s390x 1/6] FROM quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                                                                                                                                   64.4s
 => => resolve quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                                                                                                                                                0.5s
 => => sha256:98b78ab39fa7a7ce7683d3d924a937f5f887e9955e6b9c789ced00625f8ba1ba 24.70MB / 24.70MB                                                                                                                                                                                                                          5.4s
 => => sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 32B / 32B                                                                                                                                                                                                                                  0.2s
 => => sha256:ba1279a54461b9e9f57571bae247b61978c771bfe48fc5c7ef9e70f7db815661 581B / 581B                                                                                                                                                                                                                                0.5s
 => => sha256:0949346439167993cbab3851e050f69388f94a7d2ed82602958c59496bed89c8 9.73kB / 9.73kB                                                                                                                                                                                                                            0.5s
 => => sha256:be97cdf74f6401d15615bcb38b5bfb25446af8717efa08698360aa2d888b140d 60.13MB / 60.13MB                                                                                                                                                                                                                         17.5s
 => => sha256:e480d2ae103c3e5cdcd0b1159aa570815696ae5976448bb74b4bf50201e89d75 13.94kB / 13.94kB                                                                                                                                                                                                                          0.3s
 => => sha256:971ecb619bbf0444e31e128864adb0c50cd3e8bfb806b4b8120d0990553c97a4 263B / 263B                                                                                                                                                                                                                                0.8s
 => => sha256:eadc43eb1208180c78aa0db936dac2e706d8c8ac66b2b0dadd15b4a241f58c8f 76.12MB / 76.12MB                                                                                                                                                                                                                         56.0s
 => => extracting sha256:eadc43eb1208180c78aa0db936dac2e706d8c8ac66b2b0dadd15b4a241f58c8f                                                                                                                                                                                                                                 1.4s
 => => extracting sha256:971ecb619bbf0444e31e128864adb0c50cd3e8bfb806b4b8120d0990553c97a4                                                                                                                                                                                                                                 0.1s
 => => extracting sha256:e480d2ae103c3e5cdcd0b1159aa570815696ae5976448bb74b4bf50201e89d75                                                                                                                                                                                                                                 0.1s
 => => extracting sha256:be97cdf74f6401d15615bcb38b5bfb25446af8717efa08698360aa2d888b140d                                                                                                                                                                                                                                 2.0s
 => => extracting sha256:0949346439167993cbab3851e050f69388f94a7d2ed82602958c59496bed89c8                                                                                                                                                                                                                                 0.1s
 => => extracting sha256:ba1279a54461b9e9f57571bae247b61978c771bfe48fc5c7ef9e70f7db815661                                                                                                                                                                                                                                 0.1s
 => => extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1                                                                                                                                                                                                                                 0.1s
 => => extracting sha256:98b78ab39fa7a7ce7683d3d924a937f5f887e9955e6b9c789ced00625f8ba1ba                                                                                                                                                                                                                                 0.3s
 => [linux/arm64 1/6] FROM quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                                                                                                                                  118.9s
 => => resolve quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                                                                                                                                                0.4s
 => => sha256:0617eed5fbc6af48b97c3e3c5c4bf22820e98f67294a493a95ac1c655c654258 23.36MB / 23.36MB                                                                                                                                                                                                                         12.9s
 => => sha256:9d060052cff3125e346031e6e4a5ca2c51a48ab9ac9f3c4684d18a4b1ceaf3fc 9.04kB / 9.04kB                                                                                                                                                                                                                            0.8s
 => => sha256:460a2b58971a09387c73af91b06462e7d289da2d80ef6ef42a4cca6a62d75512 581B / 581B                                                                                                                                                                                                                                0.9s
 => => sha256:0e0b4f8ae73926163dd7c0fcf5c5bf42448be9b69ee0c8dba7ddc21c16f93663 64.55MB / 64.55MB                                                                                                                                                                                                                         40.9s
 => => sha256:02007dd5742cf0e02af80120d21c02e90f46c6137dccdd56e38333253ebf8386 76.75MB / 76.75MB                                                                                                                                                                                                                         39.4s
 => => extracting sha256:02007dd5742cf0e02af80120d21c02e90f46c6137dccdd56e38333253ebf8386                                                                                                                                                                                                                                 1.5s
 => => extracting sha256:971ecb619bbf0444e31e128864adb0c50cd3e8bfb806b4b8120d0990553c97a4                                                                                                                                                                                                                                 0.2s
 => => extracting sha256:e480d2ae103c3e5cdcd0b1159aa570815696ae5976448bb74b4bf50201e89d75                                                                                                                                                                                                                                 0.1s
 => => extracting sha256:0e0b4f8ae73926163dd7c0fcf5c5bf42448be9b69ee0c8dba7ddc21c16f93663                                                                                                                                                                                                                                 2.1s
 => => extracting sha256:9d060052cff3125e346031e6e4a5ca2c51a48ab9ac9f3c4684d18a4b1ceaf3fc                                                                                                                                                                                                                                 0.1s
 => => extracting sha256:460a2b58971a09387c73af91b06462e7d289da2d80ef6ef42a4cca6a62d75512                                                                                                                                                                                                                                 0.1s
 => => extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1                                                                                                                                                                                                                                 0.1s
 => => extracting sha256:0617eed5fbc6af48b97c3e3c5c4bf22820e98f67294a493a95ac1c655c654258                                                                                                                                                                                                                                 0.3s
 => [linux/amd64 1/6] FROM quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                                                                                                                                  113.8s
 => => resolve quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                                                                                                                                                0.4s
 => => sha256:a410cb638594e3774ca48c587754784c212d329f81b52a4a26ce2203a2b02d40 25.02MB / 25.02MB                                                                                                                                                                                                                         14.4s
 => => sha256:a162900bde72611bfe03489fa69f56edaad3c94aaca3e6e9c15ae1b75bddb995 581B / 581B                                                                                                                                                                                                                                0.2s
 => => sha256:86f5f62afd6ec97574bc09469a6604f44273cfb2af7b9c5ce879f1003e90791b 9.47kB / 9.47kB                                                                                                                                                                                                                            0.2s
 => => sha256:d19cab6e4eba8015a6d4ddff46c82c61c08bed40c058748e347463f4cfc58f27 64.88MB / 64.88MB                                                                                                                                                                                                                         41.5s
 => => sha256:af3f0c395f7eb1853f50487d3c93853f4247e671c33362b4da71a23b351d5c54 262B / 262B                                                                                                                                                                                                                                0.4s
 => => sha256:649e5534d134eac0f942db1db2a7491173c90e40888923ebf261d0277c2ab73e 79.14MB / 79.14MB                                                                                                                                                                                                                         65.4s
 => => extracting sha256:649e5534d134eac0f942db1db2a7491173c90e40888923ebf261d0277c2ab73e                                                                                                                                                                                                                                 1.4s
 => => extracting sha256:af3f0c395f7eb1853f50487d3c93853f4247e671c33362b4da71a23b351d5c54                                                                                                                                                                                                                                 0.1s
 => => extracting sha256:e480d2ae103c3e5cdcd0b1159aa570815696ae5976448bb74b4bf50201e89d75                                                                                                                                                                                                                                 0.1s
 => => extracting sha256:d19cab6e4eba8015a6d4ddff46c82c61c08bed40c058748e347463f4cfc58f27                                                                                                                                                                                                                                 2.2s
 => => extracting sha256:86f5f62afd6ec97574bc09469a6604f44273cfb2af7b9c5ce879f1003e90791b                                                                                                                                                                                                                                 0.1s
 => => extracting sha256:a162900bde72611bfe03489fa69f56edaad3c94aaca3e6e9c15ae1b75bddb995                                                                                                                                                                                                                                 0.1s 
 => => extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1                                                                                                                                                                                                                                 0.1s 
 => => extracting sha256:a410cb638594e3774ca48c587754784c212d329f81b52a4a26ce2203a2b02d40                                                                                                                                                                                                                                 0.3s 
 => [linux/ppc64le 1/6] FROM quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                                                                                                                                 84.3s 
 => => resolve quay.io/operator-framework/ansible-operator:v1.27.0@sha256:7d6cc680ab0f57f2e796411c170186d7d668e7ae8500f39ae0660edda08ce72b                                                                                                                                                                                0.4s 
 => => sha256:b867f87590b8f0017ea6c633ebb66808a0e188d5f97b75e0b39930a1540582a7 23.07MB / 23.07MB                                                                                                                                                                                                                         24.6s 
 => => sha256:9817a6f828801933d0dc746dd105d3378bac07789a680aef7dd8269f3e7160c8 9.60kB / 9.60kB                                                                                                                                                                                                                            1.4s
 => => sha256:1c08c84a47af5e825c04fd537ab7decd04906a1c1a5a34ee181ce00489149fb7 582B / 582B                                                                                                                                                                                                                                0.9s
 => => sha256:ba64f8b2f828edb6013769c954664bb3d5eb961b006f13c8a57bf31c6a398dad 60.28MB / 60.28MB                                                                                                                                                                                                                         21.3s
 => => sha256:ffccdb4e3c404cc1cc140915ca062919bfaedea8462b50f2b54696124f0e29b7 85.75MB / 85.75MB                                                                                                                                                                                                                         59.0s
 => => extracting sha256:ffccdb4e3c404cc1cc140915ca062919bfaedea8462b50f2b54696124f0e29b7                                                                                                                                                                                                                                 1.6s 
 => => extracting sha256:971ecb619bbf0444e31e128864adb0c50cd3e8bfb806b4b8120d0990553c97a4                                                                                                                                                                                                                                 0.1s 
 => => extracting sha256:e480d2ae103c3e5cdcd0b1159aa570815696ae5976448bb74b4bf50201e89d75                                                                                                                                                                                                                                 0.1s 
 => => extracting sha256:ba64f8b2f828edb6013769c954664bb3d5eb961b006f13c8a57bf31c6a398dad                                                                                                                                                                                                                                 2.2s 
 => => extracting sha256:9817a6f828801933d0dc746dd105d3378bac07789a680aef7dd8269f3e7160c8                                                                                                                                                                                                                                 0.1s 
 => => extracting sha256:1c08c84a47af5e825c04fd537ab7decd04906a1c1a5a34ee181ce00489149fb7                                                                                                                                                                                                                                 0.1s
 => => extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1                                                                                                                                                                                                                                 0.1s
 => => extracting sha256:b867f87590b8f0017ea6c633ebb66808a0e188d5f97b75e0b39930a1540582a7                                                                                                                                                                                                                                 0.3s
 => [linux/s390x 2/6] COPY requirements.yml /opt/ansible/requirements.yml                                                                                                                                                                                                                                                 1.7s
 => [linux/s390x 3/6] RUN ansible-galaxy collection install -r /opt/ansible/requirements.yml  && chmod -R ug+rwx /opt/ansible/.ansible                                                                                                                                                                                   16.0s
 => [linux/s390x 4/6] COPY watches.yaml /opt/ansible/watches.yaml                                                                                                                                                                                                                                                         0.7s
 => [linux/s390x 5/6] COPY roles/ /opt/ansible/roles/                                                                                                                                                                                                                                                                     0.7s
 => [linux/s390x 6/6] COPY playbooks/ /opt/ansible/playbooks/                                                                                                                                                                                                                                                             0.5s
 => [linux/ppc64le 2/6] COPY requirements.yml /opt/ansible/requirements.yml                                                                                                                                                                                                                                               0.2s
 => [linux/ppc64le 3/6] RUN ansible-galaxy collection install -r /opt/ansible/requirements.yml  && chmod -R ug+rwx /opt/ansible/.ansible                                                                                                                                                                                 18.1s
 => [linux/ppc64le 4/6] COPY watches.yaml /opt/ansible/watches.yaml                                                                                                                                                                                                                                                       0.2s
 => [linux/ppc64le 5/6] COPY roles/ /opt/ansible/roles/                                                                                                                                                                                                                                                                   0.2s
 => [linux/ppc64le 6/6] COPY playbooks/ /opt/ansible/playbooks/                                                                                                                                                                                                                                                           0.2s
 => [linux/amd64 2/6] COPY requirements.yml /opt/ansible/requirements.yml                                                                                                                                                                                                                                                 1.9s
 => [linux/amd64 3/6] RUN ansible-galaxy collection install -r /opt/ansible/requirements.yml  && chmod -R ug+rwx /opt/ansible/.ansible                                                                                                                                                                                    7.7s
 => [linux/arm64 2/6] COPY requirements.yml /opt/ansible/requirements.yml                                                                                                                                                                                                                                                 1.9s
 => [linux/arm64 3/6] RUN ansible-galaxy collection install -r /opt/ansible/requirements.yml  && chmod -R ug+rwx /opt/ansible/.ansible                                                                                                                                                                                    7.9s
 => [linux/amd64 4/6] COPY watches.yaml /opt/ansible/watches.yaml                                                                                                                                                                                                                                                         0.2s
 => [linux/amd64 5/6] COPY roles/ /opt/ansible/roles/                                                                                                                                                                                                                                                                     0.2s
 => [linux/amd64 6/6] COPY playbooks/ /opt/ansible/playbooks/                                                                                                                                                                                                                                                             0.2s
 => [linux/arm64 4/6] COPY watches.yaml /opt/ansible/watches.yaml                                                                                                                                                                                                                                                         0.2s
 => [linux/arm64 5/6] COPY roles/ /opt/ansible/roles/                                                                                                                                                                                                                                                                     0.2s
 => [linux/arm64 6/6] COPY playbooks/ /opt/ansible/playbooks/                                                                                                                                                                                                                                                             0.3s
 => exporting to image                                                                                                                                                                                                                                                                                                   69.3s
 => => exporting layers                                                                                                                                                                                                                                                                                                   4.4s
 => => exporting manifest sha256:c7400bfa6138c87b8335d24d372b6bb48055d366fb06242809b555e491a8cd9f                                                                                                                                                                                                                         0.0s
 => => exporting config sha256:e391400e3434ba834bea80660b8c0270c859d8b2bdadc51ad9097944fceeb4e9                                                                                                                                                                                                                           0.0s
 => => exporting attestation manifest sha256:468d5d443572dd40a17c8077639c678a08850a77436d60eb88af0e2a452f9e81                                                                                                                                                                                                             0.1s
 => => exporting manifest sha256:01c21decf6dc951258501f9be2b9d40a3b1ac30e613e2a1370d92eb007483692                                                                                                                                                                                                                         0.0s
 => => exporting config sha256:b4d0bc13b60a73db10355ca8c8ae99552abb89c477ddcb9057389621f1aa267c                                                                                                                                                                                                                           0.0s
 => => exporting attestation manifest sha256:deaaeb42a4bb6103dfc36c632010becbccffb2bbb8b58ac02a6298c5518ada89                                                                                                                                                                                                             0.1s
 => => exporting manifest sha256:56c234c38c848d0d0009f8df1b7251f6eec0845ffb9cd19738a25bb7b27c8be3                                                                                                                                                                                                                         0.0s
 => => exporting config sha256:5cd4f0d77a0cf1e106deed57fb7f322e99d0954f07d148253924316d565d63cf                                                                                                                                                                                                                           0.0s
 => => exporting attestation manifest sha256:3b2feb2582042476359a89d93f92fe5e5d7b01b824bf1b9d385361a7e01eb964                                                                                                                                                                                                             0.1s
 => => exporting manifest sha256:6df3db0224708cce6c16b83daaf6a364bf55d7f5bba77b0b72361440533da779                                                                                                                                                                                                                         0.0s
 => => exporting config sha256:2d7ca392413f5e7b5bfd98f30a264f970aee62e6acc8b8ad52ed21c591def595                                                                                                                                                                                                                           0.0s
 => => exporting attestation manifest sha256:92cb482d399b75f50991fc6070976d19dec114ddd516e9ae360e65f140e30e57                                                                                                                                                                                                             0.1s
 => => exporting manifest list sha256:df7020eb80d9b3e601d47e67399f57f40224dc3df4750cac75fb0fb7756add17                                                                                                                                                                                                                    0.0s
 => => pushing layers                                                                                                                                                                                                                                                                                                    60.3s
 => => pushing manifest for quay.io/ansible/eda-server-operator:0.0.1@sha256:df7020eb80d9b3e601d47e67399f57f40224dc3df4750cac75fb0fb7756add17                                                                                                                                                                             3.7s
 => [auth] ansible/eda-server-operator:pull,push token for quay.io                                                                                                                                                                                                                                                        0.0s
 => [auth] ansible/eda-server-operator:pull,push token for quay.io                                                                                                                                                                                                                                                        0.0s
docker buildx rm project-v3-builder
project-v3-builder removed

@jon-nfc @kurokobo thanks for putting up a fix for this and for your collaboration.

I opened an issue in the ansible-operator-plugins repo. Please add a comment there if you spot anything I missed.

@jon-nfc
Copy link
Contributor Author

jon-nfc commented Jan 7, 2024

@rooftopcellist, top notch!! the issue you opened looks good.

@rooftopcellist rooftopcellist merged commit 7268063 into ansible:main Jan 7, 2024
@kurokobo
Copy link
Contributor

kurokobo commented Jan 7, 2024

Thanks for working on this, I found terrible mistyping in my comment:

My understanding is that inserting --platform=${TARGETPLATFORM} is correct for Go-based Operator; the Go-based Operator's Dockerfile is designed for multi-stage build and the first FROM is for the builder. Cross-compilation should run on the native platform, not the target platform, so --platform=${TARGETPLATFORM} is valid. In later stages, the cross-compiled binaries are copied to a image for target platform.

This is for BUILDPLATFORM instead of TARGETPLATFORM. I've edited my comment above.

Corrected:

My understanding is that inserting --platform=${BUILDPLATFORM} is correct for Go-based Operator; the Go-based Operator's Dockerfile is designed for multi-stage build and the first FROM is for the builder. Cross-compilation should run on the native platform, not the target platform, so --platform=${BUILDPLATFORM} is valid. In later stages, the cross-compiled binaries are copied to a image for target platform.

@rooftopcellist
Copy link
Member

Looks like I've made the same mistake, I just fixed it in the other issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants