Welcome to Contentful Community! It’s unfortunately not available at the moment, but that’s planned.
However, you can workaround this. In a build process you can often execute more than one shell command - we do respect the exit codes, so you could catch a failed migration (e.g. in most CIs nothing further gets executed if the prior process exited with something different than 0)
Also you can always spawn a shell within Node, which then does the migration and wrap that in a promise - combine it with https://github.com/sindresorhus/dargs and you basically can simulate the behaviour of extension-cli's programmatic usage.
I re-open this discussion because I’m trying to use contentful-migration-cli inside our build system.
We use Jenkins to generate artifacts. When Jenkins launch contentful-migration --space-id vdg1mwfhyz60 migrations/pictures/banner_full.js
the cli asks “Do you want to apply the migration?”.
HI there,
Unfortunately there is no argument to auto respond for now, but you can tell jenkins to answer yes when receiving that question from the migration-cli using shell script.
Something like this
expect -c "
spawn contentful-migration --space-id $SPACE_ID $MIGRATION_FILE
set timeout -1
expect \"Do you want to apply the migration (Y/n)\"
send \"y\r\"
expect eof
"