Automation: Read property from file

I have an automation job that builds and pushes a docker image. I want the image to have a tag with the version read from a project config file (in my case, package.json). Is it possible to read such a value from a file with space automation?

1
6 comments
Hello!

Thank you for the feedback!

I've forwarded your feedback to the billing team to consider it.

Please let me know if you have additional questions.

Margarita Kolotilova
JetBrains
http://www.jetbrains.com
The Drive to Develop
0
Hi again!

I apologize for the previous response. I'll be back to you a bit later with information regarding your question.

Please stay tuned!

Margarita Kolotilova
JetBrains
http://www.jetbrains.com
The Drive to Develop
1

Hello,

just wanted to check in if you had time to consider my question yet?

1

Hello again,

I am just wondering, has there been an update to my question yet?
I would appreciate an answer, whether my question is currently feasible with automation or not.

Looking forward to hearing back from you.

1

Daschi, sorry for the late reply. Sure, the job should look like this:

job("Build and push Docker") {
    kaniko {
        beforeBuildScript {
            content = """
              export VERSION=$(some bash operations with your package.json)
            """
        }

        build {
            dockerfile = "Dockerfile"
        }

      push("mycompany.registry.jetbrains.space/mydocker/myimage") {
            tags{
              +"${"$"}VERSION"
            }
        }
    }
}
0

It took me a while to get around to it, but I managed to make it work. Thanks!

0

Please sign in to leave a comment.