Skip to content
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

Main branch not recognised when executing an online workflow #3593

Closed
marcodelapierre opened this issue Jan 31, 2023 · 12 comments · Fixed by #5375 · May be fixed by #4659
Closed

Main branch not recognised when executing an online workflow #3593

marcodelapierre opened this issue Jan 31, 2023 · 12 comments · Fixed by #5375 · May be fixed by #4659
Assignees
Milestone

Comments

@marcodelapierre
Copy link
Member

I have a github repo whose primary branch is called main instead of master, which is becoming increasingly common.
Nextflow asks me to specify the branch with -r :

$ nextflow run marcodelapierre/toy-cowsay-nf -profile condawave

N E X T F L O W  ~  version 22.12.0-edge
Pulling marcodelapierre/toy-cowsay-nf ...
 downloaded from https://github.com/marcodelapierre/toy-cowsay-nf.git
Project `marcodelapierre/toy-cowsay-nf` is currently stickied on revision: main -- you need to explicitly specify a revision with the option `-r` in order to use it

All good with -r:

$ nextflow run -r main marcodelapierre/toy-cowsay-nf -profile condawave

N E X T F L O W  ~  version 22.12.0-edge
Launching `https://github.com/marcodelapierre/toy-cowsay-nf` [cranky_hypatia] DSL2 - revision: cd804ac170 [main]
executor >  local (8)
[b7/d27846] process > sayHello (1) [100%] 4 of 4 ✔
[35/cabd24] process > cowSay (4)   [100%] 4 of 4 ✔

I suggest to enable Nextflow to look for both master and main branches.

@stale
Copy link

stale bot commented Aug 12, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Aug 12, 2023
@stale stale bot removed the stale label Aug 13, 2023
@marcodelapierre
Copy link
Member Author

pinging this one back as I think it should be discussed - should be a quick fix, if approved for action

@pditommaso @bentsherman @jordeu

@bentsherman
Copy link
Member

Basically the AssetManager should be modified to accept both master and main as "default branch" names:

if( current != defaultBranch ) {
if( !revision ) {
throw new AbortOperationException("Project `$project` is currently stickied on revision: $current -- you need to explicitly specify a revision with the option `-r` in order to use it")
}
}

@marcodelapierre
Copy link
Member Author

is there a way to know what is the default branch of a repo?

@marcodelapierre marcodelapierre self-assigned this Nov 7, 2023
@jordeu
Copy link
Collaborator

jordeu commented Nov 7, 2023

is there a way to know what is the default branch of a repo?

The default branch concept do not exists on Git, it is a provider concept. I know that using Github API you can check which is the default branch.

@pditommaso
Copy link
Member

pditommaso commented Nov 13, 2023

Indeed https://stackoverflow.com/a/16501903/395921.

Very likely it's available also on BitBucket and GitLab

@ewels
Copy link
Member

ewels commented Sep 26, 2024

This just came up again, @BioWilko was asking if it was the case. I had totally forgotten about this issue and assured him that master couldn't be hardcoded in the codebase 👀 (then I tried it myself)

We're hoping to move to using main as the default branch name for all @nf-core repos soon, but will need to wait for this to be resolved first.

Is it solved by #4659?

@marcodelapierre
Copy link
Member Author

marcodelapierre commented Sep 27, 2024

Hey Phil, yep, at the moment any Nextflow git repo whose default branch is not master should have it explicitly mentioned in the manifest for proper functionality:

manifest {
  ..
  name = 'hello world'
  description = 'Toy pipeline for simple Nextflow tests'
  homePage = ' ... '
  ..
  defaultBranch = 'main'
  ..
}

The most developed open PR to handle multiple git revisions is #5089.
With it, pipelines with non master default branch will not give an error.
However, there is still a corner case caveat (documented in the PR) where the default branch appears duplicated in the list of branches, both as DEFAULT (or similar) and <defaultBranch name>. This happens if the pipeline has previously been called both with no -r/--revision flag AND with -r <defaultBranch name>. These two ways of calling the default branch may point to distinct commits over time; they can be reconciled by updating both to latest.

@ewels
Copy link
Member

ewels commented Sep 30, 2024

Possible approach to using git to figure this out here: https://stackoverflow.com/questions/28666357/how-to-get-default-git-branch

@ewels
Copy link
Member

ewels commented Oct 7, 2024

https://github.com/nextflow-io/socks now has default branch main, can use this for testing.

@pditommaso
Copy link
Member

Smell bad 😆

tom-seqera added a commit that referenced this issue Oct 8, 2024
tom-seqera added a commit that referenced this issue Oct 8, 2024
pditommaso added a commit that referenced this issue Oct 9, 2024
…5375)


Signed-off-by: Tom Sellman <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Co-authored-by: Paolo Di Tommaso <[email protected]>
@bentsherman
Copy link
Member

Resolved by #5375

alberto-miranda pushed a commit to alberto-miranda/nextflow that referenced this issue Nov 19, 2024
…io#3593) (nextflow-io#5375)


Signed-off-by: Tom Sellman <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Co-authored-by: Paolo Di Tommaso <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment