forked from rancher/ecm-distro-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Command to check Rancher dependencies for a RC (rancher#286)
* change repo files * func to check all deps and command * add test * last adjusts * improve code * change requires * remove necessity of repo and org Signed-off-by: Johnatas <[email protected]> * more improves Signed-off-by: Johnatas <[email protected]> * more adjusts Signed-off-by: Johnatas <[email protected]> * removing logrus Signed-off-by: Johnatas <[email protected]> * adjust for message Signed-off-by: Johnatas <[email protected]> * adjust for message Signed-off-by: Johnatas <[email protected]> * add template tag Signed-off-by: Johnatas <[email protected]> * add template Signed-off-by: Johnatas <[email protected]> * add more changes Signed-off-by: Johnatas <[email protected]> * using regex for rancher txt files Signed-off-by: Johnatas <[email protected]> * add docs Signed-off-by: Johnatas <[email protected]> * Update rancher.go * remove unsed commit validation Signed-off-by: Johnatas <[email protected]> * split dev deps Signed-off-by: Johnatas <[email protected]> * update doc and requires Signed-off-by: Johnatas <[email protected]> * remove unsed api url Signed-off-by: Johnatas <[email protected]> * more fixes Signed-off-by: Johnatas <[email protected]> * remove func contents Signed-off-by: Johnatas <[email protected]> * more adjusts * add line and content to min version Signed-off-by: Johnatas <[email protected]> * add rancher images export in example --------- Signed-off-by: Johnatas <[email protected]>
- Loading branch information
Showing
5 changed files
with
329 additions
and
0 deletions.
There are no files selected for viewing
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
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,79 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/rancher/ecm-distro-tools/release/rancher" | ||
"github.com/sirupsen/logrus" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
func checkRancherRCDepsCommand() *cli.Command { | ||
return &cli.Command{ | ||
Name: "check-rancher-rc-deps", | ||
Usage: "check if the Rancher version specified by the commit or pre-release title does not contain development dependencies and rc tags", | ||
Flags: []cli.Flag{ | ||
&cli.StringFlag{ | ||
Name: "commit", | ||
Aliases: []string{"c"}, | ||
Usage: "last commit for a final rc", | ||
Required: false, | ||
}, | ||
&cli.StringFlag{ | ||
Name: "org", | ||
Aliases: []string{"o"}, | ||
Usage: "organization name", | ||
Required: false, | ||
Value: "rancher", | ||
}, | ||
&cli.StringFlag{ | ||
Name: "repo", | ||
Aliases: []string{"r"}, | ||
Usage: "rancher repository", | ||
Required: false, | ||
Value: "rancher", | ||
}, | ||
&cli.StringFlag{ | ||
Name: "files", | ||
Aliases: []string{"f"}, | ||
Usage: "files to be checked if remotely", | ||
Required: false, | ||
}, | ||
&cli.BoolFlag{ | ||
Name: "for-ci", | ||
Aliases: []string{"p"}, | ||
Usage: "export a md template also check raising an error if contains rc tags and dev deps", | ||
Required: false, | ||
}, | ||
}, | ||
Action: checkRancherRCDeps, | ||
} | ||
} | ||
|
||
func checkRancherRCDeps(c *cli.Context) error { | ||
const files = "/bin/rancher-images.txt,/bin/rancher-windows-images.txt,Dockerfile.dapper,go.mod,/package/Dockerfile,/pkg/apis/go.mod,/pkg/settings/setting.go,/scripts/package-env" | ||
|
||
var local bool | ||
|
||
rcCommit := c.String("commit") | ||
rcOrg := c.String("org") | ||
rcRepo := c.String("repo") | ||
rcFiles := c.String("files") | ||
forCi := c.Bool("for-ci") | ||
|
||
if rcFiles == "" { | ||
rcFiles = files | ||
} | ||
if rcCommit == "" { | ||
local = true | ||
} | ||
|
||
logrus.Debugf("organization: %s, repository: %s, commit: %s, files: %s", | ||
rcOrg, rcRepo, rcCommit, rcFiles) | ||
|
||
err := rancher.CheckRancherRCDeps(context.Background(), local, forCi, rcOrg, rcRepo, rcCommit, rcFiles) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
} |
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
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
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