Hey,
in the company I work, I moved all out projects to aws code commit and friends (build, deploy and pipeline). Because there is no overview with the last result of all pipelines, I wanted to build a small application that loads all pipelines and prints the last status.
I have the following code for that:
use rusoto_codepipeline::*;
use rusoto_core::credential::ChainProvider;
use rusoto_core::{HttpClient, Region};
fn main() {
let client = CodePipelineClient::new(Region::default());
let result = client
.get_pipeline_state(GetPipelineStateInput {
name: String::from("always_ok"),
})
.sync()
.unwrap();
dbg!(result);
}
When I execute the program, it dies with the following exception:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseError("missing field `created` at line 1 column 205")', src/libcore/result.rs:999:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
I then printed the aws response using python boto3. This is the response:
{
"pipelineName": "always_ok",
"pipelineVersion": 2,
"stageStates": [
{
"stageName": "Source",
"inboundTransitionState": {
"enabled": true
},
"actionStates": [
{
"actionName": "Source",
"currentRevision": {
"revisionId": "984a13c88031e6cbd4c5fd27bfa31754a9f913b2"
},
"latestExecution": {
"status": "Succeeded",
"summary": "Cleanup\n",
"lastStatusChange": "datetime.datetime(2019,5,24,21,30,55,548000, tzinfo=tzlocal())",
"externalExecutionId": "984a13c88031e6cbd4c5fd27bfa31754a9f913b2"
},
"entityUrl": "URL",
"revisionUrl": "URL"
}
],
"latestExecution": {
"pipelineExecutionId": "15abaf0e-e22e-442e-933c-09e277925bf6",
"status": "Succeeded"
}
},
{
"snip": "----"
}
],
"created": "datetime.datetime(2019,5,23,20,13,12,167000, tzinfo=tzlocal())",
"updated": "datetime.datetime(2019,5,24,21,30,29,873000, tzinfo=tzlocal())"
}
After some digging, I found out that the Object stageStates.actionStates.currentRevision does not have the field created. When you take a look at the official AWS documentation they say that this field is required, but in the response, it is not there. In rusoto this struct is handling this part. The field revisionChangeId is also required and not there.
I know that the real issue that the official documentation is wrong, but maybe we can find a way to fix it in this crate.
Thanks for the crate :)
Have a nice day
Thanks for the great report!
Both the AWS docs you linked and the botocore service definition state the fields are required.
To fix this we'll have to add a special case to our code generation for Code Pipeline to make those fields optional.
If you don麓t have anything against it, I would like to look into it.
That'd be great! Feel free to ask for help if you'd like another set of eyes. 馃憤
Done! 鉂わ笍