mirror of
				https://github.com/ohwgiles/laminar.git
				synced 2025-06-13 12:54:29 +00:00 
			
		
		
		
	laminarc: replace start with run
This commit is contained in:
		
							parent
							
								
									4d2388c271
								
							
						
					
					
						commit
						a5d8b985f1
					
				
							
								
								
									
										16
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								README.md
									
									
									
									
									
								
							| @ -181,29 +181,29 @@ A typical pipeline may involve several steps, such as build, test and deploy. De | ||||
| 
 | ||||
| The preferred way to accomplish this in Laminar is to use the same method as [regular run triggering](#triggering-a-run), that is, calling `laminarc` directly in your `example.run` scripts. | ||||
| 
 | ||||
| In addition to `laminarc trigger`, `laminar start` triggers a job run, but waits for its completion and returns a non-zero exit code if the run failed. Furthermore, both `trigger` and `start` will accept multiple jobs in a single invocation: | ||||
| In addition to `laminarc trigger`, `laminar run` triggers a job run, but waits for its completion and returns a non-zero exit code if the run failed. Furthermore, both `trigger` and `run` will accept multiple jobs in a single invocation: | ||||
| 
 | ||||
| ```bash | ||||
| #!/bin/bash -xe | ||||
| 
 | ||||
| # simultaneously starts example-test-qemu and example-test-target | ||||
| # and returns a non-zero error code if either of them fail | ||||
| laminarc start example-test-qemu example-test-target | ||||
| laminarc run example-test-qemu example-test-target | ||||
| ``` | ||||
| 
 | ||||
| An advantage to using this `laminarc` approach from bash or other scripting language is that it enables highly dynamic pipelines, since you can execute commands like | ||||
| 
 | ||||
| ```bash | ||||
| if [ ... ]; then | ||||
|   laminarc start example-downstream-special | ||||
|   laminarc run example-downstream-special | ||||
| else | ||||
|   laminarc start example-downstream-regular | ||||
|   laminarc run example-downstream-regular | ||||
| fi | ||||
| 
 | ||||
| laminarc start example-test-$TARGET_PLATFORM | ||||
| laminarc run example-test-$TARGET_PLATFORM | ||||
| ``` | ||||
| 
 | ||||
| `laminarc` reads the `$JOB` and `$RUN` variables set by `laminard` and passes them as part of the trigger/start request so the dependency chain can always be traced back. | ||||
| `laminarc` reads the `$JOB` and `$RUN` variables set by `laminard` and passes them as part of the trigger/run request so the dependency chain can always be traced back. | ||||
| 
 | ||||
| ### Parameterized runs | ||||
| 
 | ||||
| @ -534,14 +534,14 @@ Laminar will also export variables in the form `KEY=VALUE` found in these files: | ||||
| - `nodes/$NODE.env` | ||||
| - `jobs/$JOB.env` | ||||
| 
 | ||||
| Finally, variables supplied on the command-line call to `laminarc start` or `laminarc trigger` will be available. See [parameterized builds](#parameterized-builds) | ||||
| Finally, variables supplied on the command-line call to `laminarc run` or `laminarc trigger` will be available. See [parameterized builds](#parameterized-builds) | ||||
| 
 | ||||
| ### `laminarc` | ||||
| 
 | ||||
| `laminarc` commands are: | ||||
| 
 | ||||
| - `trigger [JOB [PARAMS...]]...` triggers one or more jobs with optional parameters, returning immediately. | ||||
| - `start [JOB [PARAMS...]]...` triggers one or more jobs with optional parameters and waits for the completion of all jobs. Returns a non-zero error code if any job failed. | ||||
| - `run [JOB [PARAMS...]]...` triggers one or more jobs with optional parameters and waits for the completion of all jobs. Returns a non-zero error code if any job failed. | ||||
| - `set [VARIABLE=VALUE]...` sets one or more variables to be exported in subsequent scripts for the run identified by the `$JOB` and `$RUN` environment variables | ||||
| - `lock [NAME]` acquires the [lock](#locks) named `NAME` | ||||
| - `release [NAME]` releases the lock named `NAME` | ||||
|  | ||||
| @ -106,11 +106,14 @@ int main(int argc, char** argv) { | ||||
|                 return ENOENT; | ||||
|             } | ||||
|         } | ||||
|     } else if(strcmp(argv[1], "start") == 0) { | ||||
|     } else if(strcmp(argv[1], "run") == 0 || strcmp(argv[1], "start") == 0) { | ||||
|         if(argc < 3) { | ||||
|             fprintf(stderr, "Usage %s start <jobName>\n", argv[0]); | ||||
|             fprintf(stderr, "Usage %s run <jobName>\n", argv[0]); | ||||
|             return EINVAL; | ||||
|         } | ||||
|         if(strcmp(argv[1], "start") == 0) { | ||||
|             fprintf(stderr, "Warning: \"start\" is deprecated, please use \"run\" instead\n"); | ||||
|         } | ||||
|         struct: public kj::TaskSet::ErrorHandler { | ||||
|             void taskFailed(kj::Exception&&) override {} | ||||
|         } ignoreFailed; | ||||
| @ -118,10 +121,10 @@ int main(int argc, char** argv) { | ||||
|         int jobNameIndex = 2; | ||||
|         // make a request for each job specified on the commandline
 | ||||
|         do { | ||||
|             auto req = laminar.startRequest(); | ||||
|             auto req = laminar.runRequest(); | ||||
|             req.setJobName(argv[jobNameIndex]); | ||||
|             int n = setParams(argc - jobNameIndex - 1, &argv[jobNameIndex + 1], req); | ||||
|             ts.add(req.send().then([&ret,argv,jobNameIndex](capnp::Response<LaminarCi::StartResults> resp){ | ||||
|             ts.add(req.send().then([&ret,argv,jobNameIndex](capnp::Response<LaminarCi::RunResults> resp){ | ||||
|                 printf("%s:%d\n", argv[jobNameIndex], resp.getBuildNum()); | ||||
|                 if(resp.getResult() != LaminarCi::JobResult::SUCCESS) { | ||||
|                     ret = EFAILED; | ||||
|  | ||||
| @ -3,7 +3,7 @@ | ||||
| interface LaminarCi { | ||||
| 
 | ||||
|     trigger @0 (jobName :Text, params :List(JobParam)) -> (result :MethodResult); | ||||
|     start @1 (jobName :Text, params :List(JobParam)) -> (result :JobResult, buildNum :UInt32); | ||||
|     run @1 (jobName :Text, params :List(JobParam)) -> (result :JobResult, buildNum :UInt32); | ||||
|     set @2 (jobName :Text, buildNum :UInt32, param :JobParam) -> (result :MethodResult); | ||||
|     lock @3 (lockName :Text) -> (); | ||||
|     release @4 (lockName :Text) -> (); | ||||
|  | ||||
| @ -105,9 +105,9 @@ public: | ||||
|     } | ||||
| 
 | ||||
|     // Start a job and wait for the result
 | ||||
|     kj::Promise<void> start(StartContext context) override { | ||||
|     kj::Promise<void> run(RunContext context) override { | ||||
|         std::string jobName = context.getParams().getJobName(); | ||||
|         LLOG(INFO, "RPC start", jobName); | ||||
|         LLOG(INFO, "RPC run", jobName); | ||||
|         ParamMap params; | ||||
|         for(auto p : context.getParams().getParams()) { | ||||
|             params[p.getName().cStr()] = p.getValue().cStr(); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user