Skip to content

CodePipeline to Elastic Beanstalk Deploy stage fails with message "Job for build.service failed"

0

i use CodePipeline to deploy my springboot application to ElasticBeanstalk single instance environment on a t3micro instance. My codepipeline has 2 stages. Source , and Deploy. The source stage pulls from my Github repo ( connected with GithubApp). The Source stage works fine.

The problem is with Deploy stage. I dont have a build stage in Pipeline, as i use Procfile and Buildfile inside by repo root folder. so the build is done on the instance. So far over many 30 commits have worked fine and my aws eb application has worked fine. But recently it has begun failing the Build stage. Rollback also fails. I have verified it is not my source code problem , as even an empty application fails just the same!

Even manual upload of app.zip (created using git-archive as explain in official docs) still does not work!

Here is the snippet from eb-engine log:

2025/02/06 14:26:33.126937 [INFO] Running command: systemctl enable build.service
2025/02/06 14:26:33.495323 [INFO] The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
Alias= settings in the [Install] section, and DefaultInstance= for template
units). This means they are not meant to be enabled using systemctl.
 
Possible reasons for having this kind of units are:
• A unit may be statically enabled by being symlinked from another unit's
  .wants/ or .requires/ directory.
• A unit's purpose may be to act as a helper for some other unit which has
  a requirement dependency on it.
• A unit may be started when needed via activation (socket, path, timer,
  D-Bus, udev, scripted systemctl call, ...).
• In case of template units, the unit is meant to be enabled with some
  instance name specified.

2025/02/06 14:26:33.495370 [INFO] Running command: systemctl show -p PartOf build.service
2025/02/06 14:26:33.512743 [INFO] Running command: systemctl is-active build.service
2025/02/06 14:26:33.522049 [INFO] Running command: systemctl start build.service
2025/02/06 14:36:31.164359 [INFO] Job for build.service failed because the control process exited with error code.
See "systemctl status build.service" and "journalctl -xeu build.service" for details.

2025/02/06 14:36:31.168125 [ERROR] An error occurred during execution of command [app-deploy] - [Java Specific Build Application]. Stop running the command. Error: Build application failed on command mvn -DskipTests clean package with error: startProcess Failure: starting process "build" failed: Command systemctl start build.service failed with error exit status 1. Stderr:Job for build.service failed because the control process exited with error code.
See "systemctl status build.service" and "journalctl -xeu build.service" for details.
  
2025/02/06 14:36:31.168145 [INFO] Executing cleanup logic
2025/02/06 14:36:31.188330 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1738852591170,"severity":"ERROR"}]}]}

Please offer suggestions how to fix this issue. I have already tried restarting app servers. I have already tried rollback. I have also tried Manual upload code zip. i have already rebooted the EC2 instance. All are fruitless. I need urgent assistance please.

1 Answer
0

Hello.

Did you run "journalctl -xeu build.service" as stated in the error log and check the log?
There are probably logs that are useful for troubleshooting that are output to the journal log.

2025/02/06 14:36:31.168125 [ERROR] An error occurred during execution of command [app-deploy] - [Java Specific Build Application]. Stop running the command. Error: Build application failed on command mvn -DskipTests clean package with error: startProcess Failure: starting process "build" failed: Command systemctl start build.service failed with error exit status 1. Stderr:Job for build.service failed because the control process exited with error code. See "systemctl status build.service" and "journalctl -xeu build.service" for details.

EXPERT

answered a year ago

  • i did try to view logs when the status was "Degraded" but could not because immediately Elastic Beanstalk began trying rolling back, so cannot "Request Logs". Today the status is stuck at Warning, and it somehow managed to rollback to a very old commit. So i SSH'd into the EC2 instance and tried "systemctl status build.service", it shows deactivated, because it runs only 1 time during deployment and gets deactivated. i tried "journalctl -xeu build.service" and it did not show any errors. Just exited the mvn package with success.

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.