{"action":"created","issue":{"url":"https://api.github.com/repos/openshift/installer/issues/290","repository_url":"https://api.github.com/repos/openshift/installer","labels_url":"https://api.github.com/repos/openshift/installer/issues/290/labels{/name}","comments_url":"https://api.github.com/repos/openshift/installer/issues/290/comments","events_url":"https://api.github.com/repos/openshift/installer/issues/290/events","html_url":"https://github.com/openshift/installer/pull/290","id":362019822,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE2ODQ1NzU1","number":290,"title":"pkg/rhcos: Default to the most-recent AMI","user":{"login":"wking","id":209920,"node_id":"MDQ6VXNlcjIwOTkyMA==","avatar_url":"https://avatars1.githubusercontent.com/u/209920?v=4","gravatar_id":"","url":"https://api.github.com/users/wking","html_url":"https://github.com/wking","followers_url":"https://api.github.com/users/wking/followers","following_url":"https://api.github.com/users/wking/following{/other_user}","gists_url":"https://api.github.com/users/wking/gists{/gist_id}","starred_url":"https://api.github.com/users/wking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wking/subscriptions","organizations_url":"https://api.github.com/users/wking/orgs","repos_url":"https://api.github.com/users/wking/repos","events_url":"https://api.github.com/users/wking/events{/privacy}","received_events_url":"https://api.github.com/users/wking/received_events","type":"User","site_admin":false},"labels":[{"id":959732229,"node_id":"MDU6TGFiZWw5NTk3MzIyMjk=","url":"https://api.github.com/repos/openshift/installer/labels/approved","name":"approved","color":"0ffa16","default":false},{"id":959729794,"node_id":"MDU6TGFiZWw5NTk3Mjk3OTQ=","url":"https://api.github.com/repos/openshift/installer/labels/size/M","name":"size/M","color":"eebb00","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-09-20T05:03:48Z","updated_at":"2018-09-20T05:04:43Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/openshift/installer/pulls/290","html_url":"https://github.com/openshift/installer/pull/290","diff_url":"https://github.com/openshift/installer/pull/290.diff","patch_url":"https://github.com/openshift/installer/pull/290.patch"},"body":"We're pushing public AMIs since openshift/os#304.  There's still no public analog to [this][1], so I'm just scraping this from metadata on images available via the AWS API.  The analogous AWS command line invocation is:\n\n```console\n$ AWS_DEFAULT_REGION=us-east-1 aws ec2 describe-images --filter 'Name=name,Values=rhcos*' --query 'sort_by(Images, &CreationDate)[-1].ImageId' --output text\n```\n\nwith a few extra filters thrown in.  The full set of metadata on the most recent current image is:\n\n```console\n$ AWS_DEFAULT_REGION=us-east-1 aws ec2 describe-images --filter 'Name=name,Values=rhcos*' --query 'sort_by(Images, &CreationDate)[-1]' --output json\n{\n    \"VirtualizationType\": \"hvm\",\n    \"Description\": \"Red Hat CoreOS 4.0.5846 (c9a6bb48b837b5bcfeb9bd427be9a18b5bd75b6c57cb289245f211ff98b2a740)\",\n    \"Hypervisor\": \"xen\",\n    \"EnaSupport\": true,\n    \"SriovNetSupport\": \"simple\",\n    \"ImageId\": \"ami-08a5792a684330602\",\n    \"State\": \"available\",\n    \"BlockDeviceMappings\": [\n        {\n            \"DeviceName\": \"/dev/xvda\",\n            \"Ebs\": {\n                \"Encrypted\": false,\n                \"DeleteOnTermination\": true,\n                \"VolumeType\": \"gp2\",\n                \"VolumeSize\": 8,\n                \"SnapshotId\": \"snap-00a45db4ad6173805\"\n            }\n        },\n        {\n            \"DeviceName\": \"/dev/xvdb\",\n            \"VirtualName\": \"ephemeral0\"\n        }\n    ],\n    \"Architecture\": \"x86_64\",\n    \"ImageLocation\": \"531415883065/rhcos_dev_c9a6bb4-hvm\",\n    \"RootDeviceType\": \"ebs\",\n    \"OwnerId\": \"531415883065\",\n    \"RootDeviceName\": \"/dev/xvda\",\n    \"CreationDate\": \"2018-09-19T23:40:54.000Z\",\n    \"Public\": true,\n    \"ImageType\": \"machine\",\n    \"Name\": \"rhcos_dev_c9a6bb4-hvm\"\n}\n```\n\nThat doesn't include the \"tested\" information, so there's still no support for changing channels.  We'll need to wait for a public analog of [this][1], which is blocked on getting stable, production hosting for the release metadata.\n\nI'd prefer to use JMESPath and server-side filtering in Go as well, to only return the latest matching AMI.  But the AWS Go library doesn't seem to support server-side filtering at the moment (aws/aws-sdk-go#2156).  Docs for the AWS Go APIs I'm using are [here][3], [here][4], [here][5], [here][6], [here][7], and [here][8].\n\nThe filters I'm adding here are similar to those we used for Container Linux before they were dropped in #233.  I added a few more just to be conservative (e.g. we don't want to match a `pending` or `failed` image, so I require `state` to be `available`).\n\nI haven't pushed the `Context` variables all the way up the stack yet, so there are some `context.TODO()` entries.  The 30-second timeout keeps us from hanging excessively when the caller lacks AWS credentials; the error messages look like:\n\n```\nfailed to init cluster: failed to parse test config: failed to determine default AMI: NoCredentialProviders: no valid providers in chain. Deprecated.\n  For verbose messaging see aws.Config.CredentialsChainVerboseErrors\n```\n\nYou can test this error condition by removing the explicit AMI values I've added to our fixtures in this commit and running:\n\n```console\n$ AWS_PROFILE=does-not-exist go test ./installer/pkg/...\n```\n\nCC @ashcrow, @jupierce.\n\n[1]: http://aos-ostree.rhev-ci-vms.eng.rdu2.redhat.com/rhcos/images/aws-us-east-1-tested.json\n[2]: https://github.com/aws/aws-sdk-go/issues/2156\n[3]: https://docs.aws.amazon.com/sdk-for-go/api/aws/session/#NewSessionWithOptions\n[4]: https://docs.aws.amazon.com/sdk-for-go/api/aws/session/#Options\n[5]: https://docs.aws.amazon.com/sdk-for-go/api/aws/session/#Must\n[6]: https://docs.aws.amazon.com/sdk-for-go/api/service/ec2/#New\n[7]: https://docs.aws.amazon.com/sdk-for-go/api/service/ec2/#EC2.DescribeImagesWithContext\n[8]: https://docs.aws.amazon.com/sdk-for-go/api/service/ec2/#DescribeImagesInput"},"comment":{"url":"https://api.github.com/repos/openshift/installer/issues/comments/423041219","html_url":"https://github.com/openshift/installer/pull/290#issuecomment-423041219","issue_url":"https://api.github.com/repos/openshift/installer/issues/290","id":423041219,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzA0MTIxOQ==","user":{"login":"openshift-ci-robot","id":30189103,"node_id":"MDQ6VXNlcjMwMTg5MTAz","avatar_url":"https://avatars1.githubusercontent.com/u/30189103?v=4","gravatar_id":"","url":"https://api.github.com/users/openshift-ci-robot","html_url":"https://github.com/openshift-ci-robot","followers_url":"https://api.github.com/users/openshift-ci-robot/followers","following_url":"https://api.github.com/users/openshift-ci-robot/following{/other_user}","gists_url":"https://api.github.com/users/openshift-ci-robot/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift-ci-robot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift-ci-robot/subscriptions","organizations_url":"https://api.github.com/users/openshift-ci-robot/orgs","repos_url":"https://api.github.com/users/openshift-ci-robot/repos","events_url":"https://api.github.com/users/openshift-ci-robot/events{/privacy}","received_events_url":"https://api.github.com/users/openshift-ci-robot/received_events","type":"User","site_admin":false},"created_at":"2018-09-20T05:04:43Z","updated_at":"2018-09-20T05:04:43Z","author_association":"NONE","body":"@wking: The following test **failed**, say `/retest` to rerun them all:\n\nTest name | Commit | Details | Rerun command\n--- | --- | --- | ---\nci/prow/go-vet | 546d7b88b3cb77ae486751b0f17756d242aaa67f | [link](https://openshift-gce-devel.appspot.com/build/origin-ci-test/pr-logs/pull/openshift_installer/290/pull-ci-openshift-installer-go-vet/353) | `/test go-vet`\n\n[Full PR test history](https://openshift-gce-devel.appspot.com/pr/openshift_installer/290). [Your PR dashboard](https://openshift-gce-devel.appspot.com/pr/wking). Please help us cut down on flakes by [linking to](https://github.com/kubernetes/community/blob/master/contributors/devel/flaky-tests.md#filing-issues-for-flaky-tests) an [open issue](https://github.com/openshift/installer/issues?q=is:issue+is:open) when you hit one in your PR.\n\n<details>\n\nInstructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).\n</details>\n<!-- test report -->"}}
{"actor":{"display_login":"openshift-ci-robot"}}