Skip to content

[server] Do not use branch names for additionalRepositories #13529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

aledbf
Copy link
Member

@aledbf aledbf commented Oct 3, 2022

Description

When we open a workspace from a branch and the repository contains a .gitpod.yml file with additionalRepositories, we should not assume the branch exists in those repositories. Also, when we specify a branch in one of the additionalRepositories, we should be able to use that branch.

Related Issue(s)

Fixes #13527

How to test

Release Notes

NONE

Werft options:

  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-integration-tests=all
    Valid options are all, workspace, webapp, ide

[server] Do not use branch names for additionalRepositories
@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-aledbf-addi.1 because the annotations in the pull request description changed
(with .werft/ from main)

@aledbf aledbf marked this pull request as ready for review October 3, 2022 12:21
@aledbf aledbf requested a review from a team October 3, 2022 12:21
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Oct 3, 2022
Add integration tests for additionalRepositories
@roboquat roboquat added size/M and removed size/XS labels Oct 3, 2022
@aledbf
Copy link
Member Author

aledbf commented Oct 3, 2022

/werft run with-integration-tests=workspace

👍 started the job as gitpod-build-aledbf-addi.3
(with .werft/ from main)

@svenefftinge
Copy link
Member

It used to be optional, i.e. if the branch exist use it if not use tge default branch. Did anything change in content init wrt?

@aledbf
Copy link
Member Author

aledbf commented Oct 3, 2022

Yes, we check the branch name now to avoid issues with non-existing ones.

This change was introduced here #11854

@svenefftinge
Copy link
Member

Oh, it was intentionally logged as debug and not returning an error. Was there a user-facing problem with this, can't tell from #11854 what the actual issue was?

@aledbf
Copy link
Member Author

aledbf commented Oct 3, 2022

This was triggered in prebuilds. Please check Jenting comments

@kylos101
Copy link
Contributor

kylos101 commented Oct 3, 2022

@aledbf looks like the tests failed, but could just be a timeout or flakey test:

    additional_repositories_test.go:61: cannot launch a workspace: "cannot wait for workspace start: \"cannot wait for workspace: context deadline exceeded\""
--- FAIL: TestAdditionalRepositories (600.07s)
    --- FAIL: TestAdditionalRepositories/additional-repositories (600.07s)
        --- FAIL: TestAdditionalRepositories/additional-repositories/can_open_a_workspace_using_the_additionalRepositories_property (600.07s)
            --- FAIL: TestAdditionalRepositories/additional-repositories/can_open_a_workspace_using_the_additionalRepositories_property/workspace_with_additionalRepositories_using_a_branch (348.19s)
            --- FAIL: TestAdditionalRepositories/additional-repositories/can_open_a_workspace_using_the_additionalRepositories_property/workspace_with_additionalRepositories_also_using_a_branch_in_one_of_the_additionalRepositories (251.87s)

Does the test work when you run it by itself?

@aledbf
Copy link
Member Author

aledbf commented Oct 3, 2022

It used to be optional, i.e. if the branch exist use it if not use tge default branch

I cannot find a reference for that logic.

@jesseops
Copy link

jesseops commented Oct 3, 2022

It used to be optional, i.e. if the branch exist use it if not use tge default branch

I cannot find a reference for that logic.

@aledbf from https://www.gitpod.io/docs/configure/workspaces/multi-repo#cloning-additional-repositories

If you open a workspace on a branch, Gitpod will clone the same-named branch in all repositories. If such a branch doesn’t exist Gitpod checks out the default branch.

This is failing right now for our team as well.

Case 1
Create new multiRepo workspace from main branch
SUCCESS

Case 2
Launch workspace from PR against main repository w/ no corresponding branch in additionalRepository

cannot initialize workspace: cannot initialize workspace:
git initializer clone: Remote branch BRANCH-NAME does not exist in https://github.com/ORG/SECONDARY-REPOSITORY.git

Case 3
Push new branch to additionalRepository
SUCCESS

@aledbf
Copy link
Member Author

aledbf commented Oct 3, 2022

/hold

@david-bakin
Copy link

david-bakin commented Oct 3, 2022

Should also fix #13512 - the actual issue is it needs to work as described in the documentation which is correct for most (all?) use cases. If the additional repos have the same branch, use it. If the additional repos don't have the same branch as the main: use their default. For each separate additional repo.

@aledbf aledbf closed this Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Validation
Development

Successfully merging this pull request may close these issues.

Branch names should not be used to checkout additionalRepositories
6 participants