Use pythonanywhere.com API to trigger deploy in CI/CD
Status
The API provides interesting triggers:
- send inputs to console:
/api/v0/user/{username}/consoles/{id}/send_input/
, with JSON payload containing an"input"
entry with a string of commands,\n
-separated; - trigger reload of the webapp:
/api/v0/user/{username}/webapps/{domain_name}/reload/
Where:
-
username
isojob
- console
id
is14020986
- webapp
domain_name
isojob.pythonanywhere.com
- request shall be performed with
Aurthorization
header set atToken {token}
, wheretoken
is provided in the Account section of their website.
Actions
-
define thewrite a python script, called in Gitlab CI/CDcurl
commands -
Update develop
branch with such commands, for automated deploy when all previous steps succeed.
Edited by Joël Bourgault