To answer my own question, yes, it is possible to find the pipeline 
scheduled date/time from the JSON element stages[0]/jobs[0]/scheduled_data. 
According to *https://docs.go.cd/15.1.0/api/stages_api.html*, the 
scheduled_date field in the response is in UNIX timestamp format. It 
records the number of milliseconds since the UNIX epoch date of 01 JAN 
1970. This information can be obtained any time after the pipeline has 
started using the "Get pipeline instance" 
https://api.go.cd/current/#get-pipeline-instance API and using the 
GO_PIPELINE_NAME and GO_PIPELINE_COUNTER environment variables as inputs.
 
*https://docs.go.cd/15.1.0/api/stages_api.html*
*Note: The scheduled_date field in the response is in UNIX timestamp 
format. It records the number of milliseconds since the UNIX epoch date of 
01 JAN 1970. To read more about this value and see examples of how to 
convert it to other formats including human readable form (for various 
languages) see http://www.epochconverter.com/. Be aware it may be necessary 
to convert to seconds first.*

On Thursday, October 27, 2016 at 9:29:27 AM UTC-7, Jay wrote:
>
> Hi,
>
> Is there a way to query gocd for the scheduled date/time of a pipeline, 
> while that pipeline is still in progress? I've found that the Properties 
> described under https://docs.go.cd/current/advanced_usage/properties.html 
> are only available after a job/stage has completed and these usually only 
> apply to the job and not the pipeline run. I've found that querying the 
> current pipeline instance using the "Get pipeline instance" 
> https://api.go.cd/current/#get-pipeline-instance API call also does not 
> show any pipeline scheduled date information. For now we are finding this 
> information based on the stages[0]/jobs[0]/scheduled_data JSON data 
> returned by the API. Is there a better way to query for this information 
> while a pipeline is still in progress. The goal here is to query and 
> capture the scheduled start date/time as a first step within the first 
> stage of a pipeline run. The scheduled time in this case would be different 
> from the actual start time because there might be some delay in between.
>
> Jay
>

-- 
You received this message because you are subscribed to the Google Groups 
"go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to