Forge CI/CD Pipeline to resolve the 1st installation or just delpoyment of new apps

I encounter a problem when writing cd pipeline yaml file with Forge Commands:
Scenario 1: 1st time to install the new app
forge install after forge deploy

Scenario 2:afterwards and the new app has been installed
we just need forge deploy but not forge install

And my question is: how to write a yaml file to consider the above 2 scenarios? I know the difficulty is to need a statement to decide if the app has been installed to the destination environment or not.

Could anyone have any ideas or suggestions? Thanks.

during scenario 1) you can install app on the appropriate Jira instance manually. During scenario 2) you can always call “forge install --upgrade” after each forge deploy.

1 Like

Thanks for your reply. In fact, I want to write a yml file to handle those two scenarios without any manual intervention.

Ok, so you will need to analyze output from "forge install list " and decide if call “forge install”

yeah, the logic should be as you suggest. Do you know if it’s feasible to implement this logic in the yaml file?

for multiple environments and multiple sites, we also need grep command to filter what we need.

  • forge install list | grep ‘development’ | grep ‘
  • if [ $? -ne 0 ]; then forge install --site --product jira --non-interactive -e development; fi

I can run them successfully in my mac command, but failed in the bitbucket pipeline.

I don’t know why.