Skip to content

Commit

Permalink
Merge pull request #3 from zaneb/lint
Browse files Browse the repository at this point in the history
Add lint checks
  • Loading branch information
celebdor committed Feb 21, 2022
2 parents a2d7431 + bb7a691 commit d14efb8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions data/data/agent/embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ package agent

import "embed"

// IgnitionData contains the source data for building the ignition file
//go:embed *
var IgnitionData embed.FS
2 changes: 2 additions & 0 deletions pkg/agent/imagebuilder/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import (
data "github.com/openshift-agent-team/fleeting/data/data/agent"
)

// ConfigBuilder builds an Ignition config
type ConfigBuilder struct {
}

// Ignition builds an ignition file and returns the bytes
func (c ConfigBuilder) Ignition() ([]byte, error) {
var err error

Expand Down
2 changes: 2 additions & 0 deletions pkg/agent/imagebuilder/embed_ignition.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const (
outputImage = "output/fleeting.iso"
)

// BuildImage builds an ISO with ignition content from a base image, and writes
// the result to disk.
func BuildImage(baseImage string) error {
ignition, err := ConfigBuilder{}.Ignition()
if err != nil {
Expand Down
5 changes: 3 additions & 2 deletions pkg/agent/isosource/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import (
const (
outputFile = "output/coreos.iso"

isoUrl = "https://rhcos-redirector.apps.art.xq1c.p1.openshiftapps.com/art/storage/releases/rhcos-4.10/410.84.202201251210-0/x86_64/rhcos-410.84.202201251210-0-live.x86_64.iso"
isoURL = "https://rhcos-redirector.apps.art.xq1c.p1.openshiftapps.com/art/storage/releases/rhcos-4.10/410.84.202201251210-0/x86_64/rhcos-410.84.202201251210-0-live.x86_64.iso"
isoSha256 = "2905c1f0d85739e8600e8816c0d32711fb4002be4f845e0b20eeab35314e5b58"
)

func downloadIso(dest string) error {
resp, err := http.Get(isoUrl)
resp, err := http.Get(isoURL)
if err != nil {
return err
}
Expand Down Expand Up @@ -59,6 +59,7 @@ func haveValidIso(location string) bool {
return bytes.Equal(hash.Sum(nil), expectedChecksum)
}

// EnsureIso downloads the ISO if it is not already present
func EnsureIso() (string, error) {
if !haveValidIso(outputFile) {
if err := downloadIso(outputFile); err != nil {
Expand Down

0 comments on commit d14efb8

Please sign in to comment.