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

Set a default revision #4427

Open
edmundmiller opened this issue Oct 18, 2023 · 1 comment
Open

Set a default revision #4427

edmundmiller opened this issue Oct 18, 2023 · 1 comment

Comments

@edmundmiller
Copy link
Contributor

New feature

In the manifest it would be nice if we could default to a git tag or commit hash.

Usage scenario

manifest {
    version         = '1.0.0'
    defaultBranch   = '1.0.0'
    // defaultRevision = '1.0.0'
}

So we don't need a master branch that is just a "stable" release, instead we can have users checkout a version by default and they won't get a dev version by mistake.

Suggest implementation

  1. Add a defaultRevision or modify the defaultBranch functionality to accept tags or commit hashs. The same functionality as -r
  2. Set the default behavior to look for a git tag, and if there isn't one default to master.
  3. If a manifest.version is set, then look for that git tag instead of using the defaultBranch on the git repo.
@bentsherman
Copy link
Member

I support deprecating defaultBranch in favor of defaultRevision which supports branch, tag, or commit hash

edmundmiller added a commit to edmundmiller/nextflow that referenced this issue Dec 18, 2024
edmundmiller added a commit to edmundmiller/nextflow that referenced this issue Jan 24, 2025
…tionality

- Implemented tests to resolve names to expected formats, including handling of various repository URLs.
- Added tests to ensure exceptions are thrown for invalid project names.
- Created tests for hub provider creation based on provider names.
- Developed tests for parsing Git URLs and extracting relevant information.
- Included tests for resolving script names from manifests and filtering remote branches.
- Enhanced Git config parsing tests to validate remote URLs and domains.

These additions improve test coverage and ensure the robustness of the AssetManager class.
edmundmiller added a commit to edmundmiller/nextflow that referenced this issue Jan 24, 2025
edmundmiller added a commit to edmundmiller/nextflow that referenced this issue Mar 26, 2025
edmundmiller added a commit to edmundmiller/nextflow that referenced this issue Mar 26, 2025
edmundmiller added a commit to edmundmiller/nextflow that referenced this issue Mar 26, 2025
…thod

Modify git repository initialization in test to use Git.init() with explicit master branch setting

Signed-off-by: Edmund Miller <[email protected]>
edmundmiller added a commit to edmundmiller/nextflow that referenced this issue Mar 26, 2025
…it config scenarios

Expand test coverage for Git configuration parsing by adding scenarios for:
- Multiple remote URLs
- Non-default branch configurations
- Custom default branch names

Signed-off-by: Edmund Miller <[email protected]>
edmundmiller added a commit to edmundmiller/nextflow that referenced this issue Mar 26, 2025
…module configuration

Expand AssetManagerTest with new scenarios:
- Handling gitmodules configuration with list and string inputs
- Testing manifest file parsing with malformed and missing configurations
- Adding submodule operations test
- Verifying repository error handling

Signed-off-by: Edmund Miller <[email protected]>
edmundmiller added a commit to edmundmiller/nextflow that referenced this issue Mar 26, 2025
edmundmiller added a commit to edmundmiller/nextflow that referenced this issue Mar 26, 2025
…ility and structure

- Consolidate assertions using 'with' for better clarity.
- Update test names for consistency and clarity.
- Enhance gitmodules configuration tests to handle both array and string formats.

Signed-off-by: Edmund Miller <[email protected]>
edmundmiller added a commit to edmundmiller/nextflow that referenced this issue Mar 26, 2025
edmundmiller added a commit to edmundmiller/nextflow that referenced this issue Mar 26, 2025
- Updated `getScriptFile` method to use a fallback for revision info when git revision cannot be retrieved.
- Added `getDefaultRevision` method to return the appropriate default revision, accommodating tags and commit hashes.
- Enhanced tests in `AssetManagerTest` to validate default branch and revision behavior, ensuring consistency across various configurations.
edmundmiller added a commit to edmundmiller/nextflow that referenced this issue Mar 26, 2025
- Introduced `@Tag("revision")` to multiple test cases to categorize them for revision handling.
- Added a new test case to validate the use of `defaultRevision` in checkout logic, ensuring it correctly retrieves the specified version from the manifest.

This enhances the clarity and organization of tests related to revision management in the AssetManager.
edmundmiller added a commit to edmundmiller/nextflow that referenced this issue Mar 26, 2025
nextflow-io#5610 (comment)

This change allows the AssetManager to properly use Git's default branch when no explicit branch is specified in the manifest. Now the chain of fallbacks will be:

1. Use manifest's defaultBranch if specified
2. Use Git's remote HEAD reference via getRemoteBranch()
3. Use DEFAULT_BRANCH ('master') as the final fallback

This provides more flexibility by respecting the repository's actual default branch configuration rather than assuming 'master'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants