Skip to content

Commit

Permalink
plume/release: move AMI publishing out of modifyReleaseMetadataIndex()
Browse files Browse the repository at this point in the history
It seems odd to make the AMIs public in the function focused on updating
the release index. Let's do the AMI publicizing directly from
`runFcosRelease` so we can make `modifyReleaseMetadataIndex` truly only
about the release index.

(cherry picked from commit 7cb7297)
  • Loading branch information
jlebon authored and dustymabe committed Dec 1, 2022
1 parent f321500 commit 731988d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions mantle/cmd/plume/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ func runFcosRelease(cmd *cobra.Command, args []string) {

api := getAWSApi()
doS3(api)
modifyReleaseMetadataIndex(api)
rel := getReleaseMetadata(api)
makeReleaseAMIsPublic(rel)
modifyReleaseMetadataIndex(api, rel)
}

func getAWSApi() *aws.API {
Expand Down Expand Up @@ -182,7 +184,7 @@ func makeReleaseAMIsPublic(rel release.Release) {
}
}

func modifyReleaseMetadataIndex(api *aws.API) {
func modifyReleaseMetadataIndex(api *aws.API, rel release.Release) {
// Note we use S3 directly here instead of
// FetchAndParseCanonicalReleaseIndex(), since that one uses the
// CloudFronted URL and we need to be sure we're operating on the latest
Expand Down Expand Up @@ -225,8 +227,6 @@ func modifyReleaseMetadataIndex(api *aws.API) {
plog.Fatalf("creating metadata url: %v", err)
}

rel := getReleaseMetadata(api)

var commits []release.IndexReleaseCommit
for arch, vals := range rel.Architectures {
commits = append(commits, release.IndexReleaseCommit{
Expand Down Expand Up @@ -263,8 +263,6 @@ func modifyReleaseMetadataIndex(api *aws.API) {
}
}

makeReleaseAMIsPublic(rel)

releaseIdx.Releases = append(releaseIdx.Releases, newIdxRelease)

releaseIdx.Metadata.LastModified = time.Now().UTC().Format("2006-01-02T15:04:05Z")
Expand Down

0 comments on commit 731988d

Please sign in to comment.