@@ -107,19 +107,17 @@ public String publish(@DefaultPath(".") Directory source, Secret awsAccessKeyId,
107107 public String deploy (@ DefaultPath ("." ) Directory source , String image , Secret awsAccessKeyId , Secret awsSecretAccessKey )
108108 throws ExecutionException , DaggerQueryException , InterruptedException {
109109 Container deployerCtr = dag .container ().from ("alpine" )
110- .withExec (List .of ("apk" , "add" , "envsubst" , " aws-cli" , "curl" ))
110+ .withExec (List .of ("apk" , "add" , "aws-cli" , "curl" ))
111111 .withExec (List .of ("curl" , "-L" , "-o" , "kubectl" , "https://dl.k8s.io/release/v1.31.0/bin/linux/arm64/kubectl" ))
112112 .withExec (List .of ("chmod" , "+x" , "kubectl" ))
113113 .withExec (List .of ("mv" , "kubectl" , "/usr/local/bin/" ));
114+ String appYaml = source .file ("src/main/kube/app.yaml" ).contents ().replace ("${IMAGE_TAG}" , image );
114115 return dag .awsCli (new AwsCliArguments ().withContainer (deployerCtr ))
115116 .withRegion ("eu-west-1" )
116117 .withStaticCredentials (awsAccessKeyId , awsSecretAccessKey )
117118 .exec (List .of ("eks" , "update-kubeconfig" , "--name" , "confused-classical-sheepdog" ))
118119 .withEnvVariable ("IMAGE_TAG" , image )
119- .withDirectory ("/src" , source )
120- .withExec (List .of ("envsubst" ), new WithExecArguments ()
121- .withStdin (source .file ("src/main/kube/app.yaml" ).contents ())
122- .withRedirectStdout ("/tmp/app.yaml" ))
120+ .withNewFile ("/tmp/app.yaml" , appYaml )
123121 .withExec (List .of ("kubectl" , "apply" , "-f" , "/tmp/app.yaml" ))
124122 .stdout ();
125123 }
0 commit comments