Skip to content

Commit

Permalink
Merge pull request #3717 from saschagrunert/archive
Browse files Browse the repository at this point in the history
Skip release archive
  • Loading branch information
k8s-ci-robot authored Aug 28, 2024
2 parents 461e4f0 + b45bdca commit 1e56d18
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 1,340 deletions.
4 changes: 3 additions & 1 deletion cmd/krel/cmd/announce_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import (
"github.com/spf13/cobra"

"sigs.k8s.io/release-utils/command"

"k8s.io/release/pkg/announce"
)

const (
Expand Down Expand Up @@ -240,7 +242,7 @@ func (opts *buildAnnounceOptions) saveAnnouncement(announcementSubject string, a
return fmt.Errorf("saving announcement.html: %w", err)
}

absOutputPath = filepath.Join(opts.workDir, "announcement-subject.txt")
absOutputPath = filepath.Join(opts.workDir, announce.SubjectFile)
logrus.Infof("Writing announcement subject to %s", absOutputPath)
err = os.WriteFile(absOutputPath, []byte(announcementSubject), os.FileMode(0o644))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/krel/cmd/announce_send.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func runAnnounce(opts *sendAnnounceOptions, announceRootOpts *announceOptions, r

tag := util.AddTagPrefix(announceRootOpts.tag)
u := fmt.Sprintf(
"%s/archive/anago-%s/announcement.html",
"%s/release/%s/announcement.html",
release.URLPrefixForBucket(release.ProductionBucket), tag,
)
logrus.Infof("Using announcement remote URL: %s", u)
Expand Down
2 changes: 1 addition & 1 deletion cmd/krel/cmd/sign_blobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func runSignBlobs(signOpts *signOptions, signBlobOpts *signBlobOptions, args []s
}
}

t := throttler.New(int(signOpts.maxWorkers), len(bundle)) //nolint:gosec // overlow is highly unlikely
t := throttler.New(int(signOpts.maxWorkers), len(bundle)) //nolint:gosec // overflow is highly unlikely
for _, fileBundle := range bundle {
go func(fileBundle signingBundle) {
logrus.Infof("Signing %s...", fileBundle.fileToSign)
Expand Down
24 changes: 13 additions & 11 deletions pkg/anago/anago.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"sigs.k8s.io/release-utils/util"
"sigs.k8s.io/release-utils/version"

"k8s.io/release/pkg/announce"
"k8s.io/release/pkg/release"
)

Expand All @@ -51,6 +52,12 @@ const (
// releaseNotesJSONFile is the file containing the release notes in json format.
releaseNotesJSONFile = workspaceDir + "/src/release-notes.json"

// announcementHTMLFile is the file containing the release announcement in HTML format.
announcementHTMLFile = workspaceDir + "/src/" + announce.AnnouncementFile

// announcementSubjectFile is the file containing the release announcement subject.
announcementSubjectFile = workspaceDir + "/src/" + announce.SubjectFile

// The default license for all artifacts.
LicenseIdentifier = "Apache-2.0"
)
Expand Down Expand Up @@ -395,7 +402,7 @@ func (r *Release) Run() error {
return fmt.Errorf("init log file: %w", err)
}

logger := log.NewStepLogger(12)
logger := log.NewStepLogger(11)
v := version.GetVersionInfo()
logger.Infof("Using krel version: %s", v.GitVersion)

Expand Down Expand Up @@ -431,6 +438,11 @@ func (r *Release) Run() error {
logrus.Warnf("Unable to check provenance attestation: %v", err)
}

logger.WithStep().Info("Creating announcement")
if err := r.client.CreateAnnouncement(); err != nil {
return fmt.Errorf("create announcement: %w", err)
}

logger.WithStep().Info("Pushing artifacts")
if err := r.client.PushArtifacts(); err != nil {
return fmt.Errorf("push artifacts: %w", err)
Expand All @@ -441,21 +453,11 @@ func (r *Release) Run() error {
return fmt.Errorf("push git objects: %w", err)
}

logger.WithStep().Info("Creating announcement")
if err := r.client.CreateAnnouncement(); err != nil {
return fmt.Errorf("create announcement: %w", err)
}

logger.WithStep().Info("Updating GitHub release page")
if err := r.client.UpdateGitHubPage(); err != nil {
return fmt.Errorf("updating github page: %w", err)
}

logger.WithStep().Info("Archiving release")
if err := r.client.Archive(); err != nil {
return fmt.Errorf("archive release: %w", err)
}

logger.Info("Release done")
return nil
}
9 changes: 2 additions & 7 deletions pkg/anago/anago_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func mockGenerateReleaseVersionRelease(mock *anagofakes.FakeReleaseClient) {
mock.GenerateReleaseVersionReturns(nil)
}

//nolint:dupl // duplications in those tests are intentional
func TestRunStage(t *testing.T) {
for _, tc := range []struct {
prepare func(*anagofakes.FakeStageClient)
Expand Down Expand Up @@ -131,6 +132,7 @@ func TestRunStage(t *testing.T) {
}
}

//nolint:dupl // duplications in those tests are intentional
func TestRunRelease(t *testing.T) {
for _, tc := range []struct {
prepare func(*anagofakes.FakeReleaseClient)
Expand Down Expand Up @@ -200,13 +202,6 @@ func TestRunRelease(t *testing.T) {
},
shouldError: true,
},
{ // Archive fails
prepare: func(mock *anagofakes.FakeReleaseClient) {
mockGenerateReleaseVersionRelease(mock)
mock.ArchiveReturns(err)
},
shouldError: true,
},
} {
opts := anago.DefaultReleaseOptions()
sut := anago.NewRelease(opts)
Expand Down
65 changes: 0 additions & 65 deletions pkg/anago/anagofakes/fake_release_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 0 additions & 74 deletions pkg/anago/anagofakes/fake_release_impl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1e56d18

Please sign in to comment.