Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions README_ADVANCED.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@ foc-devnet init [OPTIONS]
- `--rand` - Use random mnemonic instead of deterministic one. Use this for unique test scenarios.

**Source Format:**
- `gittag:v1.0.0` - Specific git tag (uses default repo)
- `gittag:https://github.com/user/repo.git:v1.0.0` - Tag from custom repo
- `gitcommit:abc123` - Specific git commit
- `gitbranch:main` - Specific git branch
- `local:/path/to/repo` - Local directory
- `latesttag` - Newest git tag in the default repo (resolved once at `init`).
- `latesttag:<selector>` - Newest git tag matching a glob selector, e.g. `latesttag:v*` or `latesttag:pdp/v*`.
- `latesttag:<url>:<selector>` - Newest matching tag from a custom repo, e.g. `latesttag:https://github.com/org/repo.git:v*`.
- `gittag:<tag>` - Specific git tag (uses default repo)
- `gittag:<url>:<tag>` - Tag from custom repo, e.g. `gittag:https://github.com/org/repo.git:v1.0.0`
- `gitcommit:<sha>` - Specific commit (uses default repo)
- `gitcommit:<url>:<sha>` - Commit from custom repo
- `gitbranch:<branch>` - Specific branch (uses default repo)
- `gitbranch:<url>:<branch>` - Branch from custom repo
- `local:<dir>` - Local directory

**Example:**
```bash
Expand Down Expand Up @@ -812,6 +817,7 @@ port_range_count = 100
Default versions for these repositories are defined in code (see [`src/config.rs`](src/config.rs) `Config::default()`).

**Version specification methods:**
- **Latest tag** (`latesttag`, `latesttag:<selector>`, `latesttag:<url>:<selector>`): Resolved once at `init` time via `git ls-remote` and pinned as a concrete `GitTag` in `config.toml`. Use a glob selector to scope which tags are considered, e.g. `latesttag:v*` or `latesttag:pdp/v*`. Bare `latesttag` matches all tags.
- **Git tags** (`GitTag`): Used for stable releases. Tags provide version pinning and stability.
- **Git commits** (`GitCommit`): Used for repositories where specific commits are required and there isn't a corresponding tag yet. (Generally tags should be preferred over commits.)
- **Git branches** (`GitBranch`): Used for development or when tracking latest changes.
Expand Down
25 changes: 20 additions & 5 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,28 @@ pub enum Commands {
Stop,
/// Initialize foc-devnet by building and caching Docker images
Init {
/// Curio source location (e.g., 'gittag:tag', 'gittag:url:tag', 'gitcommit:commit', 'gitcommit:url:commit', 'gitbranch:branch', 'gitbranch:url:branch', 'local:/path/to/curio')
/// Curio source location.
/// Latest tag: 'latesttag' (newest), 'latesttag:<selector>' (e.g. 'latesttag:pdp/v*'),
/// 'latesttag:<url>:<selector>' (custom repo). Resolved once at init.
/// Explicit: 'gittag:<tag>', 'gittag:<url>:<tag>', 'gitcommit:<sha>',
/// 'gitcommit:<url>:<sha>', 'gitbranch:<branch>', 'gitbranch:<url>:<branch>',
/// 'local:/path/to/curio'.
#[arg(long)]
curio: Option<String>,
/// Lotus source location (e.g., 'gittag:v1.0.0', 'gittag:url:tag', 'gitcommit:abc123', 'gitcommit:url:commit', 'gitbranch:main', 'gitbranch:url:main', 'local:/path/to/lotus')
/// Lotus source location.
/// Latest tag: 'latesttag' (newest), 'latesttag:<selector>' (e.g. 'latesttag:v*'),
/// 'latesttag:<url>:<selector>' (custom repo). Resolved once at init.
/// Explicit: 'gittag:<tag>', 'gittag:<url>:<tag>', 'gitcommit:<sha>',
/// 'gitcommit:<url>:<sha>', 'gitbranch:<branch>', 'gitbranch:<url>:<branch>',
/// 'local:/path/to/lotus'.
#[arg(long)]
lotus: Option<String>,
/// Filecoin Services source location (e.g., 'gittag:v1.0.0', 'gittag:url:tag', 'gitcommit:abc123', 'gitcommit:url:commit', 'gitbranch:main', 'gitbranch:url:main', 'local:/path/to/filecoin-services')
/// Filecoin Services source location.
/// Latest tag: 'latesttag' (newest), 'latesttag:<selector>' (e.g. 'latesttag:v*'),
/// 'latesttag:<url>:<selector>' (custom repo). Resolved once at init.
/// Explicit: 'gittag:<tag>', 'gittag:<url>:<tag>', 'gitcommit:<sha>',
/// 'gitcommit:<url>:<sha>', 'gitbranch:<branch>', 'gitbranch:<url>:<branch>',
/// 'local:/path/to/filecoin-services'.
#[arg(long)]
filecoin_services: Option<String>,
/// Yugabyte download URL
Expand Down Expand Up @@ -82,12 +97,12 @@ pub enum BuildCommands {
pub enum ConfigCommands {
/// Configure Lotus source location
Lotus {
/// Lotus source location (e.g., 'gittag:v1.0.0', 'gitcommit:abc123', 'local:/path/to/lotus')
/// Lotus source location (e.g., 'latesttag', 'latesttag:v*', 'latesttag:<url>:v*', 'gittag:v1.0.0', 'gitcommit:abc123', 'gitbranch:main', 'local:/path/to/lotus')
source: String,
},
/// Configure Curio source location
Curio {
/// Curio source location (e.g., 'gittag:v1.0.0', 'gitcommit:abc123', 'local:/path/to/curio')
/// Curio source location (e.g., 'latesttag', 'latesttag:pdp/v*', 'latesttag:<url>:pdp/v*', 'gittag:v1.0.0', 'gitcommit:abc123', 'gitbranch:main', 'local:/path/to/curio')
source: String,
},
}
2 changes: 1 addition & 1 deletion src/commands/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ fn update_config_location(
.map_err(|e| format!("Failed to parse config file: {}", e))?;

// Parse the source location
let location = Location::parse_with_default(&source, default_url)
let location = Location::resolve_with_default(&source, default_url)
.map_err(|e| format!("Invalid {} source format: {}", field, e))?;

// Update the appropriate field
Expand Down
2 changes: 1 addition & 1 deletion src/commands/init/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub fn apply_location_override(
Location::GitBranch { ref url, .. } => url.clone(),
Location::LocalSource { .. } => default_url.to_string(),
};
*location = Location::parse_with_default(&loc_str, &url)
*location = Location::resolve_with_default(&loc_str, &url)
.map_err(|e| format!("Invalid location: {}", e))?;
}
Ok(())
Expand Down
Loading
Loading