mattermost / mattermost-gitpod-config

5 stars 11 forks source link

On workspace initialization, check out correct version of all repos based on context URL #19

Open mickmister opened 2 years ago

mickmister commented 2 years ago

The default multi-repo functionality for Gitpod configuration doesn't take into account repositories that are not declared in .gitpod.yml, and doesn't take into account forks of the repos that are declared in .gitpod.yml. By "take account" I mean it will just check out the most recent commit on the main branch, rather than deriving the commit from the context URL.

The task here is to create a script scripts/common/checkout-code.sh that will be called in the init block by all terminals declared in the .gitpod.yml file. It can be called like:

/workspace/mattermost-gitpod-config/scripts/common/checkout-code.sh server

The server argument tells the script that this is the terminal that is dedicated to checking out the server code.

Something else we should support is cross-repo branch matching. We currently do this in CI when we build PRs. If a PR is made from a specific branch in the server repo, and there is an active branch in the webapp repo with the same branch name, the CI build will contain changes made in both of those repos. We can do the same thing when we check out code during Gitpod initialization, for all repos involved.

mickmister commented 1 year ago

Tried to do this with https://github.com/mattermost/mattermost-gitpod-config/pull/24, specifically with the line below. There may be further improvements to this.

https://github.com/mattermost/mattermost-gitpod-config/blob/f9ebadac922411f07ca94e9e75fc927687042ea9/scripts/app/init-app-project.sh#L13