Skip to content

Commit e840c84

Browse files
committed
add get-ingress function
Signed-off-by: Jean-Christophe Sirot <jcsirot@gmail.com>
1 parent 2a1d930 commit e840c84

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

.github/workflows/deploy-with-dagger.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,14 @@ jobs:
3232
verb: call
3333
args: deploy --image=${{ steps.publish.outputs.output }} --aws-access-key-id=env://AWS_ACCESS_KEY_ID --aws-secret-access-key=env://AWS_SECRET_ACCESS_KEY --cluster-name ${{ vars.CLUSTER_NAME }}
3434
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
35+
36+
- name: Get Public URL
37+
env:
38+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
39+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
40+
uses: dagger/dagger-for-github@v7
41+
with:
42+
version: "latest"
43+
verb: call
44+
args: get-ingress --image=${{ steps.publish.outputs.output }} --aws-access-key-id=env://AWS_ACCESS_KEY_ID --aws-secret-access-key=env://AWS_SECRET_ACCESS_KEY --cluster-name ${{ vars.CLUSTER_NAME }}
45+
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}

ci/src/main/java/io/dagger/modules/ci/Ci.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import io.dagger.client.AwsCli;
77
import io.dagger.client.CacheVolume;
8-
import io.dagger.client.Client.AwsCliArguments;
98
import io.dagger.client.Container;
109
import io.dagger.client.Container.PublishArguments;
1110
import io.dagger.client.DaggerQueryException;
@@ -114,8 +113,6 @@ public String deploy(@DefaultPath(".") Directory source, String image, String cl
114113
Secret awsAccessKeyId, Secret awsSecretAccessKey, @Default("eu-west-1") String region)
115114
throws ExecutionException, DaggerQueryException, InterruptedException {
116115
String appYaml = envsubst(source.file("src/main/kube/app.yaml").contents(), "IMAGE_TAG", image);
117-
/* String appYaml = source.file("src/main/kube/app.yaml").contents()
118-
.replace("${IMAGE_TAG}", image); */
119116
return kubectl(clusterName, region, awsAccessKeyId, awsSecretAccessKey)
120117
.withNewFile("/tmp/app.yaml", appYaml)
121118
.withExec(List.of("kubectl", "apply", "-f", "/tmp/app.yaml"))
@@ -130,9 +127,10 @@ public String deploy(@DefaultPath(".") Directory source, String image, String cl
130127
public String getIngress(String clusterName, Secret awsAccessKeyId, Secret awsSecretAccessKey,
131128
@Default("eu-west-1") String region)
132129
throws ExecutionException, DaggerQueryException, InterruptedException {
133-
return kubectl(clusterName, region, awsAccessKeyId, awsSecretAccessKey)
134-
.withExec(List.of("kubectl", "-n", "devoxxfr-dagger", "get", "ingress", "-o", "jsonpath='{.items[0].status.loadBalancer.ingress[0].hostname}'"))
130+
String host = kubectl(clusterName, region, awsAccessKeyId, awsSecretAccessKey)
131+
.withExec(List.of("kubectl", "-n", "devoxxfr-dagger", "get", "ingress", "-o", "jsonpath={.items[0].status.loadBalancer.ingress[0].hostname}"))
135132
.stdout();
133+
return "http://%s".formatted(host);
136134
}
137135

138136
/** Build a ready-to-use development environment */

0 commit comments

Comments
 (0)