Automation: multiple Scripts per Container viable?

Hi folks, 

I currently struggle with setting up automation, which requires a bash script to run after some Gradle tasks.

Running the Gradle tasks itself is rather straight forward. But right after running `check`, I would like to publish the result to Codecov

 

job("CI") {
container("openjdk:11") {
kotlinScript {
it.gradlew("assemble", "--parallel")
it.gradlew("check", "--parallel")
}
}
}

I thought about handling the bash script using the same container. 

job("CI") {
container("openjdk:11") {
kotlinScript {
it.gradlew("assemble", "--parallel")
it.gradlew("check", "--parallel")
}
shellScript {
interpreter = "/bin/bash"
content = "bash <(curl -s https://codecov.io/bash) -t ${Secrets("codecov")}"
}
}
}

For some reason, only one of the scripts is then being executed (either the Gradle or the shell one)

I guess it's somehow pretty common to execute more than just one script per step. Else I wouldn't have access to the test results of the first task.

Any aid here?

 

Best

Timo

0
4 comments

Hi Timo, thanks for the question! May I ask if you considered sharing data between steps? In this case, the first step should put the results in a shared directory and the second one should get them from this directory and publish by executing a bash script.

0

Hi Pavel,

sure I would be able to do so, but unfortunately, it requires me to change my build scripts and cascades the CI into the actual Gradle script.

Usually, those scripts or working on the exact same working directory and using mounts just adds unnecessary complexity...

Is there anything on your roadmap for the app to bring such a feature in? (Btw. it's a pretty well-established feature in Travis.ci, GitHub Actions, and others.)

0

Hi Timo, thanks for clarifying! I just had a short discussion with the team and it seems there's a workaround for this case. Taking into account, it's a kotlinScript in the first step, you can use any Java HTTP client to execute

 bash <(curl -s https://codecov.io/bash) -t ${Secrets("codecov")}

May I ask if this solution works for you?

By the way, we're already working on supporting multiple actions within the step, so please stay tuned :)

0

Sounds good! 
For the time being, I create a Gradle task executing the bash script

Sounds great!  

Thank you for your help

0

Please sign in to leave a comment.