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?
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}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.