mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 09:24:23 +00:00
Remove testing
This commit is contained in:
@@ -107,13 +107,10 @@ var release = &cobra.Command{
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
PreRun: func(cmd *cobra.Command, args []string) {
|
|
||||||
logDebug("Preparing Git environemnt")
|
|
||||||
prepareGit()
|
|
||||||
},
|
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
modName := args[0]
|
modName := args[0]
|
||||||
versionType := args[1]
|
versionType := args[1]
|
||||||
|
createTempDir()
|
||||||
logInfo("Creating tag for module %s", modName)
|
logInfo("Creating tag for module %s", modName)
|
||||||
pwd, err := os.Getwd()
|
pwd, err := os.Getwd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -156,20 +153,16 @@ var release = &cobra.Command{
|
|||||||
mod.Tag(),
|
mod.Tag(),
|
||||||
)
|
)
|
||||||
|
|
||||||
// Run module tests
|
if !noDryRun {
|
||||||
output, err := mod.RunTest()
|
|
||||||
if err != nil {
|
|
||||||
logWarn(output)
|
|
||||||
} else if !noDryRun {
|
|
||||||
logInfo("Skipping push module %s. Run with --no-dry-run to push the release.", mod.name)
|
logInfo("Skipping push module %s. Run with --no-dry-run to push the release.", mod.name)
|
||||||
} else {
|
} else {
|
||||||
pushRelease(tempDir, branch, mod)
|
pushRelease(tempDir, branch, mod)
|
||||||
}
|
}
|
||||||
// Clean
|
// Clean
|
||||||
cleanGit()
|
removeTempDir()
|
||||||
pruneWorktree(pwd)
|
pruneWorktree(pwd)
|
||||||
deleteBranch(pwd, branch)
|
deleteBranch(pwd, branch)
|
||||||
logInfo("Module %s completes", mod.name)
|
logInfo("Releasing for module %s completes", mod.name)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,7 +297,7 @@ func (m *module) Tag() string {
|
|||||||
return m.name + "/" + m.version.String()
|
return m.name + "/" + m.version.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *module) RunTest() (string, error) {
|
func (m module) RunTest() (string, error) {
|
||||||
if noTest {
|
if noTest {
|
||||||
logInfo("Tests disabled.")
|
logInfo("Tests disabled.")
|
||||||
return "", nil
|
return "", nil
|
||||||
@@ -323,17 +316,21 @@ func (m *module) RunTest() (string, error) {
|
|||||||
|
|
||||||
// === Git environment functions ===
|
// === Git environment functions ===
|
||||||
|
|
||||||
func prepareGit() {
|
func createTempDir() {
|
||||||
var err error
|
|
||||||
// Create temporary directory
|
// Create temporary directory
|
||||||
tempDir, err = ioutil.TempDir("", "kustomize-releases")
|
temp, err := ioutil.TempDir("", "kustomize-releases")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logFatal(err.Error())
|
logFatal(err.Error())
|
||||||
}
|
}
|
||||||
logDebug("Created git temp dir: " + tempDir)
|
logDebug("Created git temp dir: " + tempDir)
|
||||||
|
tempDir = path.Join(temp, "sigs.k8s.io/kustomize")
|
||||||
|
err = os.MkdirAll(tempDir, 0700)
|
||||||
|
if err != nil {
|
||||||
|
logFatal(err.Error())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func cleanGit() {
|
func removeTempDir() {
|
||||||
logDebug("Deleting git temp dir: " + tempDir)
|
logDebug("Deleting git temp dir: " + tempDir)
|
||||||
err := os.RemoveAll(tempDir)
|
err := os.RemoveAll(tempDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -395,7 +392,6 @@ func newBranch(path, name string) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
logFatal(string(stdoutStderr))
|
logFatal(string(stdoutStderr))
|
||||||
}
|
}
|
||||||
logInfo("Finished creating branch")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteBranch(path, name string) {
|
func deleteBranch(path, name string) {
|
||||||
@@ -417,7 +413,6 @@ func addWorktree(path, tempDir, branch string) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
logFatal(string(stdoutStderr))
|
logFatal(string(stdoutStderr))
|
||||||
}
|
}
|
||||||
logInfo("Finished adding worktree")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func pruneWorktree(path string) {
|
func pruneWorktree(path string) {
|
||||||
@@ -440,7 +435,6 @@ func merge(path, branch string) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
logFatal(string(stdoutStderr))
|
logFatal(string(stdoutStderr))
|
||||||
}
|
}
|
||||||
logInfo("Finished merging")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func pushRelease(path, branch string, mod module) {
|
func pushRelease(path, branch string, mod module) {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ func TestList(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRelease(t *testing.T) {
|
func TestRelease(t *testing.T) {
|
||||||
prepareGit()
|
createTempDir()
|
||||||
modName := "api"
|
modName := "api"
|
||||||
versionType := "patch"
|
versionType := "patch"
|
||||||
pwd, err := os.Getwd()
|
pwd, err := os.Getwd()
|
||||||
@@ -64,7 +64,7 @@ func TestRelease(t *testing.T) {
|
|||||||
mod.path = tempDir
|
mod.path = tempDir
|
||||||
|
|
||||||
// Clean
|
// Clean
|
||||||
cleanGit()
|
removeTempDir()
|
||||||
pruneWorktree(pwd)
|
pruneWorktree(pwd)
|
||||||
deleteBranch(pwd, branch)
|
deleteBranch(pwd, branch)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user