mirror of
https://github.com/bahdotsh/wrkflw.git
synced 2025-12-29 16:36:38 +01:00
Compare commits
5 Commits
wrkflw-par
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81d8d7ab6d | ||
|
|
1d2008852e | ||
|
|
c707bf8b97 | ||
|
|
b1cc74639c | ||
|
|
f45babc605 |
26
Cargo.toml
26
Cargo.toml
@@ -15,19 +15,19 @@ license = "MIT"
|
||||
|
||||
[workspace.dependencies]
|
||||
# Internal crate dependencies
|
||||
wrkflw-models = { path = "crates/models", version = "0.7.2" }
|
||||
wrkflw-evaluator = { path = "crates/evaluator", version = "0.7.2" }
|
||||
wrkflw-executor = { path = "crates/executor", version = "0.7.2" }
|
||||
wrkflw-github = { path = "crates/github", version = "0.7.2" }
|
||||
wrkflw-gitlab = { path = "crates/gitlab", version = "0.7.2" }
|
||||
wrkflw-logging = { path = "crates/logging", version = "0.7.2" }
|
||||
wrkflw-matrix = { path = "crates/matrix", version = "0.7.2" }
|
||||
wrkflw-parser = { path = "crates/parser", version = "0.7.2" }
|
||||
wrkflw-runtime = { path = "crates/runtime", version = "0.7.2" }
|
||||
wrkflw-secrets = { path = "crates/secrets", version = "0.7.2" }
|
||||
wrkflw-ui = { path = "crates/ui", version = "0.7.2" }
|
||||
wrkflw-utils = { path = "crates/utils", version = "0.7.2" }
|
||||
wrkflw-validators = { path = "crates/validators", version = "0.7.2" }
|
||||
wrkflw-models = { path = "crates/models", version = "0.7.3" }
|
||||
wrkflw-evaluator = { path = "crates/evaluator", version = "0.7.3" }
|
||||
wrkflw-executor = { path = "crates/executor", version = "0.7.3" }
|
||||
wrkflw-github = { path = "crates/github", version = "0.7.3" }
|
||||
wrkflw-gitlab = { path = "crates/gitlab", version = "0.7.3" }
|
||||
wrkflw-logging = { path = "crates/logging", version = "0.7.3" }
|
||||
wrkflw-matrix = { path = "crates/matrix", version = "0.7.3" }
|
||||
wrkflw-parser = { path = "crates/parser", version = "0.7.3" }
|
||||
wrkflw-runtime = { path = "crates/runtime", version = "0.7.3" }
|
||||
wrkflw-secrets = { path = "crates/secrets", version = "0.7.3" }
|
||||
wrkflw-ui = { path = "crates/ui", version = "0.7.3" }
|
||||
wrkflw-utils = { path = "crates/utils", version = "0.7.3" }
|
||||
wrkflw-validators = { path = "crates/validators", version = "0.7.3" }
|
||||
|
||||
# External dependencies
|
||||
clap = { version = "4.3", features = ["derive"] }
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
name: Clippy Test
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Test secrets after clippy fixes
|
||||
env:
|
||||
TEST_VAR: ${{ secrets.TEST_SECRET }}
|
||||
run: |
|
||||
echo "Secret length: ${#TEST_VAR}"
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wrkflw-evaluator"
|
||||
version.workspace = true
|
||||
version = "0.7.3"
|
||||
edition.workspace = true
|
||||
description = "Workflow evaluation functionality for wrkflw execution engine"
|
||||
license.workspace = true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wrkflw-executor"
|
||||
version.workspace = true
|
||||
version = "0.7.3"
|
||||
edition.workspace = true
|
||||
description = "Workflow execution engine for wrkflw"
|
||||
license.workspace = true
|
||||
|
||||
@@ -1538,7 +1538,16 @@ async fn execute_step(ctx: StepExecutionContext<'_>) -> Result<StepResult, Execu
|
||||
let container_workspace = Path::new("/github/workspace");
|
||||
|
||||
// Set up volume mapping from host working dir to container workspace
|
||||
let volumes: Vec<(&Path, &Path)> = vec![(ctx.working_dir, container_workspace)];
|
||||
let mut volumes: Vec<(&Path, &Path)> = vec![(ctx.working_dir, container_workspace)];
|
||||
|
||||
// Also mount the GitHub environment files directory if GITHUB_ENV is set
|
||||
if let Some(github_env_path) = ctx.job_env.get("GITHUB_ENV") {
|
||||
if let Some(github_dir) = Path::new(github_env_path).parent() {
|
||||
if let Some(github_parent) = github_dir.parent() {
|
||||
volumes.push((github_parent, github_parent));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let output = ctx
|
||||
.runtime
|
||||
@@ -1687,7 +1696,16 @@ async fn execute_step(ctx: StepExecutionContext<'_>) -> Result<StepResult, Execu
|
||||
let container_workspace = Path::new("/github/workspace");
|
||||
|
||||
// Set up volume mapping from host working dir to container workspace
|
||||
let volumes: Vec<(&Path, &Path)> = vec![(ctx.working_dir, container_workspace)];
|
||||
let mut volumes: Vec<(&Path, &Path)> = vec![(ctx.working_dir, container_workspace)];
|
||||
|
||||
// Also mount the GitHub environment files directory if GITHUB_ENV is set
|
||||
if let Some(github_env_path) = ctx.job_env.get("GITHUB_ENV") {
|
||||
if let Some(github_dir) = Path::new(github_env_path).parent() {
|
||||
if let Some(github_parent) = github_dir.parent() {
|
||||
volumes.push((github_parent, github_parent));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Execute the command
|
||||
match ctx
|
||||
@@ -2071,6 +2089,10 @@ async fn execute_reusable_workflow_job(
|
||||
ExecutionError::Execution(format!("Failed to create temp dir: {}", e))
|
||||
})?;
|
||||
let repo_url = format!("https://github.com/{}/{}.git", owner, repo);
|
||||
|
||||
// Clone into a subdirectory within tempdir to get clean structure
|
||||
let repo_dir = tempdir.path().join("cloned_repo");
|
||||
|
||||
// git clone
|
||||
let status = Command::new("git")
|
||||
.arg("clone")
|
||||
@@ -2079,7 +2101,7 @@ async fn execute_reusable_workflow_job(
|
||||
.arg("--branch")
|
||||
.arg(&r#ref)
|
||||
.arg(&repo_url)
|
||||
.arg(tempdir.path())
|
||||
.arg(&repo_dir)
|
||||
.status()
|
||||
.map_err(|e| ExecutionError::Execution(format!("Failed to execute git: {}", e)))?;
|
||||
if !status.success() {
|
||||
@@ -2088,18 +2110,93 @@ async fn execute_reusable_workflow_job(
|
||||
repo_url, r#ref
|
||||
)));
|
||||
}
|
||||
let joined = tempdir.path().join(path);
|
||||
let joined = repo_dir.join(path);
|
||||
|
||||
if !joined.exists() {
|
||||
return Err(ExecutionError::Execution(format!(
|
||||
"Reusable workflow file not found in repo: {}",
|
||||
joined.display()
|
||||
)));
|
||||
}
|
||||
joined
|
||||
|
||||
// Parse called workflow while keeping tempdir alive
|
||||
let called = parse_workflow(&joined)?;
|
||||
|
||||
// Create child env context
|
||||
let mut child_env = ctx.env_context.clone();
|
||||
if let Some(with_map) = with {
|
||||
for (k, v) in with_map {
|
||||
child_env.insert(format!("INPUT_{}", k.to_uppercase()), v.clone());
|
||||
}
|
||||
}
|
||||
if let Some(secrets_val) = secrets {
|
||||
if let Some(map) = secrets_val.as_mapping() {
|
||||
for (k, v) in map {
|
||||
if let (Some(key), Some(value)) = (k.as_str(), v.as_str()) {
|
||||
child_env.insert(
|
||||
format!("SECRET_{}", key.to_uppercase()),
|
||||
value.to_string(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Execute called workflow
|
||||
let plan = dependency::resolve_dependencies(&called)?;
|
||||
let mut all_results = Vec::new();
|
||||
let mut any_failed = false;
|
||||
for batch in plan {
|
||||
let results = execute_job_batch(
|
||||
&batch,
|
||||
&called,
|
||||
ctx.runtime,
|
||||
&child_env,
|
||||
ctx.verbose,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
.await?;
|
||||
for r in &results {
|
||||
if r.status == JobStatus::Failure {
|
||||
any_failed = true;
|
||||
}
|
||||
}
|
||||
all_results.extend(results);
|
||||
}
|
||||
|
||||
// Summarize into a single JobResult
|
||||
let mut logs = String::new();
|
||||
logs.push_str(&format!("Called workflow: {}\n", joined.display()));
|
||||
for r in &all_results {
|
||||
logs.push_str(&format!("- {}: {:?}\n", r.name, r.status));
|
||||
}
|
||||
|
||||
// Represent as one summary step for UI
|
||||
let summary_step = StepResult {
|
||||
name: format!("Run reusable workflow: {}", uses),
|
||||
status: if any_failed {
|
||||
StepStatus::Failure
|
||||
} else {
|
||||
StepStatus::Success
|
||||
},
|
||||
output: logs.clone(),
|
||||
};
|
||||
|
||||
return Ok(JobResult {
|
||||
name: ctx.job_name.to_string(),
|
||||
status: if any_failed {
|
||||
JobStatus::Failure
|
||||
} else {
|
||||
JobStatus::Success
|
||||
},
|
||||
steps: vec![summary_step],
|
||||
logs,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Parse called workflow
|
||||
// Parse called workflow (for local paths)
|
||||
let called = parse_workflow(&workflow_path)?;
|
||||
|
||||
// Create child env context
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wrkflw-github"
|
||||
version.workspace = true
|
||||
version = "0.7.3"
|
||||
edition.workspace = true
|
||||
description = "GitHub API integration for wrkflw workflow execution engine"
|
||||
license.workspace = true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wrkflw-gitlab"
|
||||
version.workspace = true
|
||||
version = "0.7.3"
|
||||
edition.workspace = true
|
||||
description = "GitLab API integration for wrkflw workflow execution engine"
|
||||
license.workspace = true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wrkflw-logging"
|
||||
version.workspace = true
|
||||
version = "0.7.3"
|
||||
edition.workspace = true
|
||||
description = "Logging functionality for wrkflw workflow execution engine"
|
||||
license.workspace = true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wrkflw-matrix"
|
||||
version.workspace = true
|
||||
version = "0.7.3"
|
||||
edition.workspace = true
|
||||
description = "Matrix job parallelization for wrkflw workflow execution engine"
|
||||
license.workspace = true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wrkflw-models"
|
||||
version.workspace = true
|
||||
version = "0.7.3"
|
||||
edition.workspace = true
|
||||
description = "Data models and structures for wrkflw workflow execution engine"
|
||||
license.workspace = true
|
||||
@@ -14,4 +14,4 @@ categories.workspace = true
|
||||
serde.workspace = true
|
||||
serde_yaml.workspace = true
|
||||
serde_json.workspace = true
|
||||
thiserror.workspace = true
|
||||
thiserror.workspace = true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wrkflw-parser"
|
||||
version.workspace = true
|
||||
version = "0.7.3"
|
||||
edition.workspace = true
|
||||
description = "Workflow parsing functionality for wrkflw execution engine"
|
||||
license.workspace = true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wrkflw-runtime"
|
||||
version.workspace = true
|
||||
version = "0.7.3"
|
||||
edition.workspace = true
|
||||
description = "Runtime execution environment for wrkflw workflow engine"
|
||||
license.workspace = true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wrkflw-secrets"
|
||||
version.workspace = true
|
||||
version = "0.7.3"
|
||||
edition.workspace = true
|
||||
description = "Secrets management for wrkflw workflow execution engine"
|
||||
license.workspace = true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wrkflw-ui"
|
||||
version.workspace = true
|
||||
version = "0.7.3"
|
||||
edition.workspace = true
|
||||
description = "Terminal user interface for wrkflw workflow execution engine"
|
||||
license.workspace = true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wrkflw-utils"
|
||||
version.workspace = true
|
||||
version = "0.7.3"
|
||||
edition.workspace = true
|
||||
description = "Utility functions for wrkflw workflow execution engine"
|
||||
license.workspace = true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wrkflw-validators"
|
||||
version.workspace = true
|
||||
version = "0.7.3"
|
||||
edition.workspace = true
|
||||
description = "Workflow validation functionality for wrkflw execution engine"
|
||||
license.workspace = true
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
name: Final Secrets Test
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
verify-secrets:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Test secrets are working
|
||||
env:
|
||||
SECRET_VAL: ${{ secrets.TEST_SECRET }}
|
||||
run: |
|
||||
echo "Secret length: ${#SECRET_VAL}"
|
||||
echo "All secrets functionality verified!"
|
||||
Reference in New Issue
Block a user