https://pulumi.com logo
#aws
Title
d

dazzling-sundown-39670

07/01/2020, 3:52 PM
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

hundreds-musician-51496

07/01/2020, 4:14 PM
Does
image.apply(...)
do the trick?
l

lemon-agent-27707

07/01/2020, 5:37 PM
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

dazzling-sundown-39670

07/01/2020, 7:42 PM
@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

lemon-agent-27707

07/01/2020, 7:49 PM
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

dazzling-sundown-39670

07/02/2020, 6:16 AM
Thanks!
Type 'Output<string>' is not assignable to type 'string'.ts(2322)
l

lemon-agent-27707

07/02/2020, 6:36 AM
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

dazzling-sundown-39670

07/02/2020, 7:53 AM
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