Skip to content

Commit

Permalink
Do not store username/password information in our Image resource. (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrusNajmabadi authored Oct 15, 2018
1 parent 8716afc commit a88ca69
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion docker/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class Image extends pulumi.ComponentResource {
public digest: pulumi.Output<string | undefined>;

constructor(name: string, args: ImageArgs, opts?: pulumi.ComponentResourceOptions) {
super("docker:image:Image", name, args, opts);
super("docker:image:Image", name, argsWithoutRegistry(args), opts);

const imageData = pulumi.output(args).apply(async (imageArgs) => {
let localImageName = imageArgs.localImageName;
Expand Down Expand Up @@ -123,3 +123,13 @@ export class Image extends pulumi.ComponentResource {
});
}
}

// Take out the registry information from the args. It is needed to build and push the image. But
// it's not an intrinsic part of this Image resource. We do not want to store it, otherwise a
// change to something like a registry password would cause this to be recreated. Instead, we only
// want to recreate if our actual digests change.
function argsWithoutRegistry(args: ImageArgs): ImageArgs {
const result = {...args};
delete result.registry;
return result;
}

0 comments on commit a88ca69

Please sign in to comment.