Skip to content

Conversation

@DiamondJoseph
Copy link
Contributor

@DiamondJoseph DiamondJoseph commented Nov 17, 2025

Fixes #813 (@noemifrisina for comment on current implementation while I work on tests).

Allows configuring a target revision for a repository checked out in the scratch area.

I think I have overcomplicated the actual use case, but hopefully this diagram helps explain: checks out an existing branch of the desired name (if possible), else checks out the existing tag (if possible) and creates a branch of the name to track changes.

flowchart TD
    Start{Repo already exists in scratch?} --> |No| Clone[Clone default branch of repo from remote]
    Start --> |Yes| Connect[Use existing repo on current branch]
    Clone --> Configured{Target revision configured?}
    Connect --> Configured
    Configured --> |No| End
    Configured --> |Yes| Fetch[Fetch configured remote]
    Fetch --> Branch{Branch of name exists?}
    Branch --> |Yes| Checkout[Check out branch]
    Branch --> |No| Exists{Tag configured?}
    Exists --> |Yes| Tag{Tag of name exists?}
    Exists --> |No| Except
    Tag --> |Yes| Create[Check out tag]
    Create --> CB[Create branch of name]
    Tag --> |No| Except
    Checkout --> ShouldPull{.pull?}
    CB --> Checkout
    ShouldPull --> |No| End
    ShouldPull --> |Yes| pull
    pull --> End
Loading

example:

      - name: "dodal"
        remote_url: https://github.com/DiamondLightSource/dodal.git
        targetRevision:
          tag: 1.65.0
          branch: dev

Checks out dodal on 1.65 and creates a dev branch to track it, if a branch called dev does not exist locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow selecting version of repositories checked out into the scratch area on kubernetes

2 participants