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

How can I pass --from-platforms using plain Jib CLI? #4201

Open
artemptushkin opened this issue Feb 26, 2024 · 4 comments
Open

How can I pass --from-platforms using plain Jib CLI? #4201

artemptushkin opened this issue Feb 26, 2024 · 4 comments

Comments

@artemptushkin
Copy link

In Gradle it's possible:

./gradlew -Djib.from.platforms="linux/amd64,linux/arm64"

But when I use CLI (I really use CLI in one of the projects):

jib ... --from-platforms="linux/amd64,linux/arm64"

this fails with

Unknown option: '--from-platforms=linux/amd64,linux/arm64'
Possible solutions: --from-credential-helper, --from-username, --from-password, --from
Usage: jib jar [-hV] [--allow-insecure-registries]
               [--send-credentials-over-http]
               [--base-image-cache=<cache-directory>] [--console=<type>]
               [--creation-time=<creation-time>] [--from=<base-image>]
               [--image-format=<image-format>]
               [--image-metadata-out=<path-to-json>] [--mode=<mode>]
               [--name=<image-reference>] [--project-cache=<cache-directory>]
               -t=<target-image> [-u=<user>] [--verbosity=<level>]
               [--additional-tags=<tag>[,<tag>...]]...
               [--entrypoint=<entrypoint>[\s+<entrypoint>...]]...
               [--environment-variables=<key>=<value>[,<key>=<value>...]]...
               [--expose=<port>[,<port>...]]... [--jvm-flags=<jvm-flag>[,
               <jvm-flag>...]]... [--labels=<key>=<value>[,
               <key>=<value>...]]... [--program-args=<program-argument>[,
               <program-argument>...]]... [--volumes=<volume>[,<volume>...]]...
               [--credential-helper=<credential-helper> |
               [--username=<username> --password[=<password>]] |
               [[--to-credential-helper=<credential-helper> |
               [--to-username=<username> --to-password[=<password>]]]
               [--from-credential-helper=<credential-helper> |
               [--from-username=<username> --from-password[=<password>]]]]]
               [@<filename>...] <jarFile>
@chanseokoh
Copy link
Member

Looking at CommonContainerConfigCliOptions, jib-cli doesn't seem to have a command-line parameter for it.

Unfortunately, the only workaround I can think of is to use the jib build command and specify platforms in jib.yaml.

from:
  image: "ubuntu"
  # set platforms for multi architecture builds, defaults to `linux/amd64`
  platforms:
    - architecture: "arm"
      os: "linux"
    - architecture: "amd64"
      os: "darwin"

@artemptushkin
Copy link
Author

@chanseokoh thank you for the quick response, I thought so according to the documentation, and I will try the yaml approach. I will close the issue with this resolution, but I have just a question maybe you know

Do you have any defaults in jib.yaml to set? Let's say I have my CLI command with N parameters, if I set all of them as yaml fields will it be enough, or should I default something else? I could reverse but frankly, I don't have time for this

@artemptushkin
Copy link
Author

I just realized that I use jar command and not build and the first doesn't support the jib.yaml file. So I have to either use build command or get back to the Gradle plugin here

@artemptushkin
Copy link
Author

@chanseokoh can we implement a feature in the scope of this issue to pass platforms from the CLI parameters? I see it's possible, we can replace here emptySet with a parameter

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

No branches or pull requests

3 participants