Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Pipelines gradle build jar name

Ovadia Babayev May 2, 2019

I an trying to configure a pipeline that build a jar using Gradle and then deploy it to AWS elastic beanstalk, this is my pipeline yml:

image: openjdk:8

pipelines:
default:
- step:
name: "Build Jar"
caches:
- gradle
script:
- bash ./gradlew build
artifacts:
- build/libs/*.jar
- step:
name: "Deploy"
script:
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.2.9
variables:
AWS_ACCESS_KEY_ID: **
AWS_SECRET_ACCESS_KEY: **
AWS_DEFAULT_REGION: **
APPLICATION_NAME: **
ENVIRONMENT_NAME: **
ZIP_FILE: 'build/libs/*.jar'

My jar file always changing based on the version in the Gradle file, ex: service-1.2.1-RELEASE.jar, so I can't set static value in ZIP_FILE variable.


How can I upload the file without a specific name?

1 answer

0 votes
Steven Vaccarella
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 25, 2019

Hi Ovadia,

you can use an environment variable in the ZIP_FILE value, eg:

ZIP_FILE: 'build/libs/${MY_JAR_FILE_NAME}'

This environment variable gets expanded at the last moment before the pipe runs, so all you need to do is work out a command to run before your pipe to set the correct value:

script:
- 'export MY_JAR_FILE_NAME=`<command to determine the correct filename>`'
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.2.9
variables:
AWS_ACCESS_KEY_ID: **
AWS_SECRET_ACCESS_KEY: **
AWS_DEFAULT_REGION: **
APPLICATION_NAME: **
ENVIRONMENT_NAME: **
ZIP_FILE: 'build/libs/${MY_JAR_FILE_NAME}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events