Need Simplified Approach
i have a project in the gitlab which has the application code and a coder workspace is created for that project in gitlab .
So whenever the a latest code is pushed to the gitlab project , my coder workspace , should restart , so that the scripts of the workspace would pull the latest code from the project
So for this use case can you suggest a good approach ?
2 Replies
<#1319566344080982049>
Category
Help needed
Product
Coder (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
You need to pull latest code from gitlab in your workspace whenever the upstream changes. I can't think of a simple way to keep watching for the repo for changes continuously but can suggest something that runs on a schedule or on demand.
For running on a schedule,
You can probably add a
coder_script
with that runs on cron
to pull changes.
https://registry.terraform.io/providers/coder/coder/latest/docs/resources/script#cron-1
For running on demand,
A coder_app
that runs a command
to pull your changes whenever you click the button in UI.
https://registry.terraform.io/providers/coder/coder/latest/docs/resources/app#command-1
my coder workspace , should restart , so that the scripts of the workspace would pull the latest code from the projectYou don't have to restart the workspace to run the scripts. See my answer above for suggestion on running commands without a restart.