neo112
neo112

Reputation: 1773

EB CLI parameterize deployment artifact name for CI deploys

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.

Upvotes: 9

Views: 1816

Answers (4)

Mateusz
Mateusz

Reputation: 71

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.

Upvotes: 1

Mechria Rafik
Mechria Rafik

Reputation: 87

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)

Upvotes: 1

nbalas
nbalas

Reputation: 1263

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

Upvotes: 1

neo112
neo112

Reputation: 1773

The label flag will rename the file uploaded to AWS:

eb deploy --label Website-1.5.44.zip

Upvotes: -1

Related Questions