9

Using EB CLI to deploy a prebuilt application package. The related config.yml section looks like this:

deploy:
  artifact: Website.zip

The CI build however creates a file that has the version added to it:

Website-1.5.44.zip

Is there any option to specify the deployment artifact via command like, something like this:

eb deploy --artifact "Website-1.5.44.zip"
#or
eb deploy --artifact "/path/to/Website-1.5.44.zip"

Are there any alternatives that EB CLI provides to deploy versioned build artifacts in CI pipelines? I could probably renamed the versioned zip file to just Website.zip and then run eb deploy but it would be nice to have the version be present in the artifact filename also.

neo112
  • 1,703
  • 2
  • 17
  • 39
  • 1
    I'm really surprised this isn't possible. I'm using Java Springboot and my project produces things like "app-web/build/libs/app-0.0.12.jar." What work arounds are there that means this is automatable? – Edd May 30 '17 at 11:58
  • 2
    At least under linux, you can trick the eb cli into picking a different file through a symbolic link. My build process now creates a symbolic link that is always the same and is referenced in my `config.yml`. The actual artifact name changes though! – Thomas Eizinger Dec 10 '17 at 23:13

4 Answers4

1

Currently there is no way to do what you are describing; there are no flags to direct the EB CLI to take from a custom artifact. For now you will have to name the artifact to whatever is in your config.yml

The comment that you added will save the artifact Website.zip and name the application version Website-1.5.44.zip. It will not deploy the artifact named Website-1.5.44.zip

nbalas
  • 1,243
  • 10
  • 16
1

This python script can help you

import os

print("creating website.zip  (see eb config.yml)")
os.system("cp target/"+"website-"+version+".zip target/website.zip")
print("done.")
print("Deploying Version : "+"website-"+version+" to EB.... (uploading website.zip)")
os.system("eb deploy)
Mechria Rafik
  • 87
  • 1
  • 3
1

It seems that in 2022 it is still not possible.

In my case I've decided to edit .elasticbeanstalk/config.yml before deployment.

This is what the configuration looks like in the file:

deploy:
  artifact: build/%PACKAGE_NAME%

Command I am using to replace %PACKAGE_NAME%:

sed -i "s/%PACKAGE_NAME%/$(find build/ -name '*.zip' -printf "%f")/1" .elasticbeanstalk/config.yml

sed -i is used to replace string %PACKAGE_NAME% in file .elasticbeanstalk/config.yml with the result of find command.

Mateusz
  • 71
  • 1
  • 4
-1

The label flag will rename the file uploaded to AWS:

eb deploy --label Website-1.5.44.zip
neo112
  • 1,703
  • 2
  • 17
  • 39