Skip to content

Commit

Permalink
Added package management update during release (#33)
Browse files Browse the repository at this point in the history
* Added updating package manager formulas during release
* goimport updates
* make generated-code updates
  • Loading branch information
scranton authored and soloio-bulldozer[bot] committed May 10, 2019
1 parent 38de7e9 commit 8bb4df6
Show file tree
Hide file tree
Showing 18 changed files with 293 additions and 54 deletions.
171 changes: 164 additions & 7 deletions Gopkg.lock

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

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@

[[override]]
name = "github.com/solo-io/go-utils"
version = "0.3.1"
version = "0.7.11"
3 changes: 3 additions & 0 deletions changelog/v0.2.5/package-management-update.yaml
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
64 changes: 57 additions & 7 deletions ci/upload_github_release_assets.go
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())
}
}
}

}
Loading

0 comments on commit 8bb4df6

Please sign in to comment.