Is there any way I can "wait" for this? `const ima...
# aws
d
Is there any way I can "wait" for this?
const image = repository.buildAndPushImage(buildOptions)
(using
awsx/ecr
) I want helm to be run after it's built and pushed but I can't use it with
dependsOn
because it's just output
h
Does
image.apply(...)
do the trick?
l
Creating resources within apply can lead to problems. It breaks the Pulumi dependency graph.
Can you share code sample, I'd like to understand why dependsOn doesn't help here.
d
@lemon-agent-27707
Copy code
const buildOptions: docker.DockerBuild = {
  dockerfile: '../docker/Dockerfile.production',
  context: '../..',
  args: {
    run: process.env.GITHUB_RUN_NUMBER
  }
}

export const image = repository.buildAndPushImage(buildOptions)

export const runNumber = process.env.GITHUB_RUN_NUMBER

const helmChart = new k8s.helm.v2.Chart(
  'magneto2',
  {
    path: '../helm',
    values: {
      image,
    },
  },
  {
    provider: k8sProvider,
  },
);
Also, how can I get it to retrigger on
GIT_RUN_NUMBER
? I tried changing it and I can see
runNumber
changing but it doesn't retrigger the build
l
In order to establish a dependency on the image, you could replace one of your parameters with an apply that doesn't use the value:
Copy code
path : image.apply( v=> '../heml'),
🙏 1
d
Thanks!
Type 'Output<string>' is not assignable to type 'string'.ts(2322)
l
Ah, yes that value is a string. You might have to use that pattern on a different field that accepts inputs. cc @gorgeous-egg-16927 or @billowy-army-68599 (some of our kube experts).
d
I tried using it in in
values
but it didn't seem to help
Copy code
export const image = repository.buildAndPushImage(buildOptions)

export const tag = image.apply(i => i.split(':').reverse()[0])

const helmChart = new k8s.helm.v2.Chart(
  'magneto2',
  {
    path: '../helm',
    values: {
      image: {
        repository: repository.repository.repositoryUrl,
        tag
      },
    },
  },
  {
    provider: k8sProvider,
  },
);
Like this
Nevermind, that actually worked
It created the chart but waited with the deployment
Every day I use pulumi I'm just amazed how good it is
partypus 8bit 1
😍 1