1

I am doing a Bamboo plan with two task,

  1. check out source code from the git

  2. run the flask (Python) application

And I want to execute the above plans in Bamboo when a new commit happens in in git repository.

I have configured my project as per the Bamboo Documentation

But, After execute the 2nd task (Python application) Bamboo could not detect the commit changes and not executing the tasks also.

Only Works if all tasks are stopped.

Vineesh TP
  • 7,755
  • 12
  • 66
  • 130
  • Does the Bamboo task finish running or does it "hang" on the task where you run the Flask application (i.e. does the build finish successfully or keep running)? – Wesley Rolnick Jul 16 '19 at 16:16
  • @WesleyRolnick: It is keep running. So that, I think Bamboo couldn't detect another commit on the Git. How do I solve this issue? – Vineesh TP Jul 17 '19 at 06:32
  • @WesleyRolnick: Any idea about , How to fix this issue. – Vineesh TP Jul 17 '19 at 13:30

2 Answers2

0

Bamboo itself is running the Flask application and not your system. As a result, the Bamboo build never finishes and all other Bamboo threads related to this build plan are locked. Bamboo tasks will often run until they receive an exit code, which will never happen while your Flask app is running.

Instead of attempting to run the code from Bamboo, you should instead run the flask app outside of bamboo. You can then trigger a reload of your flask app from within Bamboo on source code changes. This will require:

  1. Have Bamboo detection setup to trigger on code changes (you have this and it sounds like it is working even though it is currently blocked).
  2. Have a task where you checkout the source code - but check it out to the directory where you are going to be running the Flask app.
  3. Configure your flask application to watch this source code folder outside of Bamboo. When the source code is updated it will reload the app. The Flask documentation explains this but you can also do it with this one line:
$ FLASK_APP=main.py FLASK_DEBUG=1 python -m flask run

There are several good answers here on SO that go over how to reload your flask app with the latest code changes:

Auto reloading python Flask app upon code changes

How to reload python module in flask?

Wesley Rolnick
  • 871
  • 4
  • 11
  • 3.Use a script task to trigger a reload of the Flask app , If I add it as a task, my problem is once the flask app started to run, It can not identify the commit inthe Git. – Vineesh TP Jul 17 '19 at 20:16
  • @VineeshTP: Part 3 of my answer updated for clarification. Update the Flask python code or at the least have it watch the folder for code changes. Bamboo should not be running the python at all as it will block. – Wesley Rolnick Jul 17 '19 at 20:38
0

Resolved by using docker inside Bamboo. Working fine.

Done the following.

  • Check out source code from repository

  • Created docker container as a task in Bamboo

  • Run the docker container using bamboo.

Installed python dependencies with docker file

Vineesh TP
  • 7,755
  • 12
  • 66
  • 130