Skip to content

Commit

Permalink
Add CLI arg to override git ref (#101)
Browse files Browse the repository at this point in the history
* Add CLI arg to override git ref

* fix typo
  • Loading branch information
epwalsh authored Nov 21, 2024
1 parent bcd0a97 commit 9bd20c2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Added

- Added `--ref` command-line argument to `gantry run` for overriding the target git ref (commit/branch/tag) to use.

## [v1.9.1](https://github.com/allenai/beaker-gantry/releases/tag/v1.9.1) - 2024-11-20

### Fixed
Expand Down
12 changes: 11 additions & 1 deletion gantry/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@
default=constants.GITHUB_TOKEN_SECRET,
show_default=True,
)
@click.option(
"--ref",
type=str,
help="""The target git ref to use. This defaults to the current commit.""",
)
@click.option(
"--conda",
type=click.Path(exists=True, dir_okay=False),
Expand Down Expand Up @@ -280,6 +285,7 @@ def run(
shared_memory: Optional[str] = None,
dataset: Optional[Tuple[str, ...]] = None,
gh_token_secret: str = constants.GITHUB_TOKEN_SECRET,
ref: Optional[str] = None,
conda: Optional[PathOrStr] = None,
pip: Optional[PathOrStr] = None,
venv: Optional[str] = None,
Expand Down Expand Up @@ -342,7 +348,11 @@ def run(
)

# Get repository account, name, and current ref.
github_account, github_repo, git_ref, is_public = util.ensure_repo(allow_dirty)
github_account, github_repo, git_ref, is_public = util.ensure_repo(
allow_dirty=ref is not None or allow_dirty
)
if ref is not None:
git_ref = ref

# Initialize Beaker client and validate workspace.
beaker = util.ensure_workspace(
Expand Down

0 comments on commit 9bd20c2

Please sign in to comment.