-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added package management update during release (#33)
* Added updating package manager formulas during release * goimport updates * make generated-code updates
- Loading branch information
1 parent
38de7e9
commit 8bb4df6
Showing
18 changed files
with
293 additions
and
54 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,4 +66,4 @@ | |
|
||
[[override]] | ||
name = "github.com/solo-io/go-utils" | ||
version = "0.3.1" | ||
version = "0.7.11" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
changelog: | ||
- type: NON_USER_FACING | ||
description: Added auto update of packagement management formulas as part of release process |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,85 @@ | ||
package main | ||
|
||
import "github.com/solo-io/go-utils/githubutils" | ||
import ( | ||
"github.com/solo-io/go-utils/githubutils" | ||
"github.com/solo-io/go-utils/logger" | ||
"github.com/solo-io/go-utils/pkgmgmtutils" | ||
) | ||
|
||
func main() { | ||
const buildDir = "_output" | ||
const repoOwner = "solo-io" | ||
const repoName = "sqoop" | ||
|
||
assets := make([]githubutils.ReleaseAssetSpec, 4) | ||
assets[0] = githubutils.ReleaseAssetSpec{ | ||
Name: "sqoopctl-linux-amd64", | ||
ParentPath: "_output", | ||
ParentPath: buildDir, | ||
UploadSHA: true, | ||
} | ||
assets[1] = githubutils.ReleaseAssetSpec{ | ||
Name: "sqoopctl-darwin-amd64", | ||
ParentPath: "_output", | ||
ParentPath: buildDir, | ||
UploadSHA: true, | ||
} | ||
assets[2] = githubutils.ReleaseAssetSpec{ | ||
Name: "sqoopctl-windows-amd64.exe", | ||
ParentPath: "_output", | ||
ParentPath: buildDir, | ||
UploadSHA: true, | ||
} | ||
assets[3] = githubutils.ReleaseAssetSpec{ | ||
Name: "sqoop.yaml", | ||
ParentPath: "install/manifest", | ||
} | ||
|
||
spec := githubutils.UploadReleaseAssetSpec{ | ||
Owner: "solo-io", | ||
Repo: "sqoop", | ||
Owner: repoOwner, | ||
Repo: repoName, | ||
Assets: assets, | ||
SkipAlreadyExists: true, | ||
} | ||
githubutils.UploadReleaseAssetCli(&spec) | ||
} | ||
|
||
fOpts := []pkgmgmtutils.FormulaOptions{ | ||
{ | ||
Name: "homebrew-tap/sqoop", | ||
FormulaName: "sqoop", | ||
Path: "Formula/sqoop.rb", | ||
RepoOwner: repoOwner, // Make change in this repo owner | ||
RepoName: "homebrew-tap", // expects this repo is forked from PRRepoOwner if PRRepoOwner != RepoOwner | ||
PRRepoOwner: repoOwner, // Make PR to this repo owner | ||
PRRepoName: "homebrew-tap", // and this repo | ||
PRBranch: "master", // and merge into this branch | ||
PRDescription: "", | ||
PRCommitName: "Solo-io Bot", | ||
PRCommitEmail: "[email protected]", | ||
VersionRegex: `version\s*"([0-9.]+)"`, | ||
DarwinShaRegex: `url\s*".*-darwin.*\W*sha256\s*"(.*)"`, | ||
LinuxShaRegex: `url\s*".*-linux.*\W*sha256\s*"(.*)"`, | ||
}, | ||
} | ||
|
||
// Update package manager install formulas | ||
status, err := pkgmgmtutils.UpdateFormulas(repoOwner, repoName, buildDir, | ||
`sqoopctl-(darwin|linux|windows).*\.sha256`, fOpts) | ||
if err != nil { | ||
logger.Fatalf("Error trying to update package manager formulas. Error was: %s", err.Error()) | ||
} | ||
for _, s := range status { | ||
if !s.Updated { | ||
if s.Err != nil { | ||
logger.Fatalf("Error while trying to update formula %s. Error was: %s", s.Name, s.Err.Error()) | ||
} else { | ||
logger.Fatalf("Error while trying to update formula %s. Error was nil", s.Name) // Shouldn't happen; really bad if it does | ||
} | ||
} | ||
if s.Err != nil { | ||
if s.Err == pkgmgmtutils.ErrAlreadyUpdated { | ||
logger.Warnf("Formula %s was updated externally, so no updates applied during this release", s.Name) | ||
} else { | ||
logger.Fatalf("Error updating Formula %s. Error was: %s", s.Name, s.Err.Error()) | ||
} | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.