By using AWS re:Post, you agree to the Terms of Use

Setting up Beanstalk with Gitlab CI/CD fails when executing .sh scripts for gitlab registry user authentication


I am trying to get Gitlab pipelines to work with Beanstalk, but I am stuck with errors

ERROR] An error occurred during execution of command [app-deploy] - [RunAppDeployPreBuildHooks]. Stop running the command. Error: Command .platform/hooks/prebuild/ failed with error exit status 1. Stderr:.platform/hooks/prebuild/ line 2: environment: command not found
.platform/hooks/prebuild/ line 3: environment: command not found

I have followed this documentation:, I have setup chmod (btw, using Apple M1 computers there is a problem when you create .sh scripts locally, because beanstalk throws exec error, I created these files directly in Gitlab repository and changed chmod locally afterwards..) .

I have also created System manager variables USER and PASSWD. For deployment, I use docker-compose.yml where I have dockerfile with build instructions. Unfortunately, I cannot get to the point to get it build and run, since it fails in steps before this. Any ideas what may be wrong?

asked 9 months ago120 views
1 Answer

That output looks like it's coming from your Beanstalk environment, so the good news is that your CI/CD pipeline appears to be working correctly.

It looks like you have a prebuild hook in your application bundle which is failing. Check for .platform/hooks/prebuild/ in your repo, it appears that lines 2 and 3 of this script are trying to run an environment command, but there is no such command on the Beanstalk instance. Is it possible that this script should instead be using the env command (1)?


answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions