Skip to content

Commit

Permalink
plume: rename -B/--board to -A/--arch and update variable names
Browse files Browse the repository at this point in the history
"board" is a ChromeOS/Container Linux remnant.
  • Loading branch information
bgilbert authored and openshift-merge-robot committed Feb 16, 2021
1 parent e9538d9 commit b6c7410
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions docs/mantle/plume.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ Here is an example of doing a Fedora Cloud pre-release with plume:
--version 30 \
--timestamp 20190819 \
--respin 0 \
--board x86_64 \
--arch x86_64 \
--compose-id Fedora-Cloud-30-20190819.0 \
--image-type Cloud-Base \
--debug
Expand All @@ -186,7 +186,7 @@ Here is an example of doing a Fedora Cloud release with plume:
--version 30 \
--timestamp 20190819 \
--respin 0 \
--board x86_64 \
--arch x86_64 \
--compose-id Fedora-Cloud-30-20190819.0 \
--image-type Cloud-Base \
--debug
Expand Down
2 changes: 1 addition & 1 deletion mantle/cmd/plume/fcos.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var (
specProfile string
specPolicy string
specCommitId string
specBoard string
specArch string
specChannel string
specVersion string
)
Expand Down
26 changes: 13 additions & 13 deletions mantle/cmd/plume/fedora.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var (
specRespin string
specImageType string
specTimestamp string
awsFedoraBoards = []string{
awsFedoraArches = []string{
"x86_64",
"aarch64",
}
Expand Down Expand Up @@ -77,7 +77,7 @@ var (
fedoraSpecs = map[string]channelSpec{
"rawhide": channelSpec{
BaseURL: "https://koji.fedoraproject.org/compose/rawhide",
Boards: awsFedoraBoards,
Arches: awsFedoraArches,
AWS: awsSpec{
BaseName: "Fedora",
BaseDescription: "Fedora Cloud Base AMI",
Expand All @@ -87,7 +87,7 @@ var (
},
"branched": channelSpec{
BaseURL: "https://koji.fedoraproject.org/compose/branched",
Boards: awsFedoraBoards,
Arches: awsFedoraArches,
AWS: awsSpec{
BaseName: "Fedora",
BaseDescription: "Fedora Cloud Base AMI",
Expand All @@ -97,7 +97,7 @@ var (
},
"updates": channelSpec{
BaseURL: "https://koji.fedoraproject.org/compose/updates",
Boards: awsFedoraBoards,
Arches: awsFedoraArches,
AWS: awsSpec{
BaseName: "Fedora",
BaseDescription: "Fedora Cloud Base AMI",
Expand All @@ -107,7 +107,7 @@ var (
},
"cloud": channelSpec{
BaseURL: "https://koji.fedoraproject.org/compose/cloud",
Boards: awsFedoraBoards,
Arches: awsFedoraArches,
AWS: awsSpec{
BaseName: "Fedora",
BaseDescription: "Fedora Cloud Base AMI",
Expand Down Expand Up @@ -136,8 +136,8 @@ func ChannelFedoraSpec() (channelSpec, error) {
if specVersion == "" {
plog.Fatal("--version is required")
}
if len(specBoard) == 0 || specBoard == "amd64-usr" {
specBoard = "x86_64"
if specArch == "" {
specArch = "x86_64"
}

spec, ok := fedoraSpecs[specChannel]
Expand All @@ -148,15 +148,15 @@ func ChannelFedoraSpec() (channelSpec, error) {
if specEnv == "dev" {
spec.AWS.Partitions = awsFedoraDevAccountPartitions
}
boardOk := false
for _, board := range spec.Boards {
if specBoard == board {
boardOk = true
archOk := false
for _, arch := range spec.Arches {
if specArch == arch {
archOk = true
break
}
}
if !boardOk {
plog.Fatalf("Unknown board %q for channel %q", specBoard, specChannel)
if !archOk {
plog.Fatalf("Unknown arch %q for channel %q", specArch, specChannel)
}

return spec, nil
Expand Down
12 changes: 6 additions & 6 deletions mantle/cmd/plume/prerelease.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
"github.com/coreos/mantle/platform/api/azure"
"github.com/coreos/mantle/sdk"
"github.com/coreos/mantle/storage"
"github.com/coreos/mantle/system"
"github.com/coreos/mantle/util"
)

Expand Down Expand Up @@ -91,8 +92,7 @@ type imageInfo struct {

// Common switches between Fedora Cloud and Fedora CoreOS
func AddSpecFlags(flags *pflag.FlagSet) {
board := sdk.DefaultBoard()
flags.StringVarP(&specBoard, "board", "B", board, "target board")
flags.StringVarP(&specArch, "arch", "A", system.RpmArch(), "target arch")
flags.StringVarP(&specChannel, "channel", "C", "testing", "target channel")
if err := flags.MarkDeprecated("channel", "use --stream instead"); err != nil {
panic(err)
Expand Down Expand Up @@ -190,7 +190,7 @@ func getFedoraImageFile(client *http.Client, spec *channelSpec, src *storage.Buc
return imagePath, nil
}

rawxzURI, err := url.Parse(fmt.Sprintf("%v/%v/compose/%v/%v/images/%v", spec.BaseURL, specComposeID, getImageTypeURI(), specBoard, fileName))
rawxzURI, err := url.Parse(fmt.Sprintf("%v/%v/compose/%v/%v/images/%v", spec.BaseURL, specComposeID, getImageTypeURI(), specArch, fileName))
if err != nil {
return "", err
}
Expand Down Expand Up @@ -368,7 +368,7 @@ func getSpecAWSImageMetadata(spec *channelSpec) (map[string]string, error) {
Timestamp: specTimestamp,
Respin: specRespin,
ImageType: specImageType,
Arch: specBoard,
Arch: specArch,
}
t := template.Must(template.New("filename").Parse(imageFileName))
buffer := &bytes.Buffer{}
Expand Down Expand Up @@ -423,7 +423,7 @@ func awsUploadToPartition(spec *channelSpec, part *awsPartitionSpec, imagePath s
var s3ObjectPath string
switch selectedDistro {
case "fedora":
s3ObjectPath = fmt.Sprintf("%s/%s/%s", specBoard, specVersion, strings.TrimSuffix(imageFileName, filepath.Ext(imageFileName)))
s3ObjectPath = fmt.Sprintf("%s/%s/%s", specArch, specVersion, strings.TrimSuffix(imageFileName, filepath.Ext(imageFileName)))
}
s3ObjectURL := fmt.Sprintf("s3://%s/%s", part.Bucket, s3ObjectPath)

Expand Down Expand Up @@ -475,7 +475,7 @@ func awsUploadToPartition(spec *channelSpec, part *awsPartitionSpec, imagePath s
"Version": specVersion,
"ComposeID": specComposeID,
"Date": specTimestamp,
"Arch": specBoard,
"Arch": specArch,
})
if err != nil {
return nil, fmt.Errorf("couldn't tag images: %v", err)
Expand Down
8 changes: 4 additions & 4 deletions mantle/cmd/plume/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ package main
type storageSpec struct {
BaseURL string
Title string // Replace the bucket name in index page titles
NamedPath string // Copy to $BaseURL/$Board/$NamedPath
VersionPath bool // Copy to $BaseURL/$Board/$Version
NamedPath string // Copy to $BaseURL/$Arch/$NamedPath
VersionPath bool // Copy to $BaseURL/$Arch/$Version
DirectoryHTML bool
IndexHTML bool
}
Expand Down Expand Up @@ -71,8 +71,8 @@ type awsSpec struct {
}

type channelSpec struct {
BaseURL string // Copy from $BaseURL/$Board/$Version
Boards []string
BaseURL string // Copy from $BaseURL/$Arch/$Version
Arches []string
Destinations []storageSpec
GCE gceSpec
Azure azureSpec
Expand Down

0 comments on commit b6c7410

Please sign in to comment.