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

Version 4.x: Additional tags are not pushed remotely #549

Open
bbtx0 opened this issue Mar 15, 2023 · 6 comments
Open

Version 4.x: Additional tags are not pushed remotely #549

bbtx0 opened this issue Mar 15, 2023 · 6 comments
Labels
kind/enhancement Improvements or new features

Comments

@bbtx0
Copy link

bbtx0 commented Mar 15, 2023

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

When creating an Image that points to a remote host any additional tag is not pushed remotely as well

The following code:

  • pushes bar to the remote host
  • while foo is only created locally
const demoImage = new docker.Image("demo-image", {
    build: {
        context: ".",
        dockerfile: "Dockerfile",
    },
    imageName: "host/image:bar",
    registry: {...},
});

new docker.Tag("demo-tag", {
    sourceImage: demoImage.imageName,
    targetImage: "test/image:foo",
});

I am looking for a way to be able to push foo to host as well.

@jaxxstorm suggested the following improvement:

const demoImage = new docker.Image("demo-image", {
    build: {
        context: ".",
        dockerfile: "Dockerfile",
    },
    imageNames: [
       "host/image:bar",
       "host/image:foo"
    ],   
    registry: {...},
});
@bbtx0 bbtx0 added kind/enhancement Improvements or new features needs-triage Needs attention from the triage team labels Mar 15, 2023
@jaxxstorm
Copy link
Contributor

As a workaround, you can just define a second image

const demoImage = new docker.Image("demo-image", {
    build: {
        context: ".",
        dockerfile: "Dockerfile",
    },
    imageName: "test/image:bar",
    skipPush: true,
});

const demoImageTag = new docker.Image("demo-image-tag", {
        imageName: "test/image:foo",
        skipPush: true,
        build: {
            context: ".",
            dockerfile: "Dockerfile",
        }
})

@bbtx0
Copy link
Author

bbtx0 commented Mar 16, 2023

The workaround does the job. I also ensure that the tagged image depends on the original image

const demoImage = new docker.Image("demo-image", {
    build: {
        context: ".",
        dockerfile: "Dockerfile",
    },
    imageName: "test/image:bar"
});

const demoImageTag = new docker.Image("demo-image-tag", {
    build: {
        context: ".",
        dockerfile: "Dockerfile",
    },
    imageName: "test/image:foo"
}, {
    dependsOn: [
        demoImage
    ]
})

@AaronFriel
Copy link
Contributor

@bbtx0 Thanks for filing this! We appreciate the feature request to build & push multiple tags in Image. Declaring multiple Image resources should work & reuse the cache, so that should be a good solution for now.

I've also added this to #424 to track additional options for future releases.

@AaronFriel AaronFriel removed the needs-triage Needs attention from the triage team label Mar 16, 2023
@bbtx0 bbtx0 closed this as completed Mar 16, 2023
@guineveresaenger
Copy link
Contributor

As per #581, there does seem to be a desire for this to be a full enhancement!

Re- opening this for planning purposes.

@kmosher
Copy link

kmosher commented Apr 25, 2023

I've got a use case this might apply to, where I want to tag images with a timestamp of when they're created.

However, I still want to rely on the normal behavior of the provider to only trigger rebuilds on context changes. So I want the option to have that tag ignored when calculating diffs and triggering resource updates. (The ignoreChanges resource option sadly doesn't quite work for this purpose, as it's too powerful in its ignorance and won't use new buildstamp tags at all after the resource is created).

Unclear to me if this is best supported by use of additional tags with an option to ignore them in diffs, or by a tagFunction option that takes a function used to compute the tag at build time.

@blampe
Copy link
Contributor

blampe commented Dec 2, 2023

@kmosher is this for signing tags, similar to #775? How hard of a requirement is the timestamp in the tag?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

6 participants