jiri-test: add wrappers for kubernetes releases.
Change-Id: Ifb439f6ae217885bc9f8476b07e49f3841dd629b
diff --git a/jiri-test/internal/test/release_kube.go b/jiri-test/internal/test/release_kube.go
new file mode 100644
index 0000000..8c10423
--- /dev/null
+++ b/jiri-test/internal/test/release_kube.go
@@ -0,0 +1,52 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package test
+
+import (
+ "fmt"
+ "os"
+ "path/filepath"
+
+ "v.io/jiri"
+ "v.io/jiri/collect"
+ "v.io/x/devtools/internal/test"
+)
+
+func vanadiumReleaseKubeStaging(jirix *jiri.X, testName string, opts ...Opt) (_ *test.Result, e error) {
+ version := os.Getenv("SNAPSHOT_MANIFEST")
+ if version == "" {
+ return nil, fmt.Errorf("SNAPSHOT_MANIFEST environment variable not set")
+ }
+ return vanadiumReleaseKubeCommon(jirix, testName, "staging", version)
+}
+
+func vanadiumReleaseKubeProduction(jirix *jiri.X, testName string, opts ...Opt) (_ *test.Result, e error) {
+ return vanadiumReleaseKubeCommon(jirix, testName, "production", "")
+}
+
+func vanadiumReleaseKubeCommon(jirix *jiri.X, testName, updateType, version string) (_ *test.Result, e error) {
+ cleanup, err := initTest(jirix, testName, []string{"v23:base"})
+ if err != nil {
+ return nil, newInternalError(err, "Init")
+ }
+ defer collect.Error(func() error { return cleanup() }, &e)
+
+ // Build and run vprodupdater.
+ s := jirix.NewSeq()
+ if err := s.Last("jiri", "go", "install", "v.io/infrastructure/vprodupdater/"); err != nil {
+ return nil, newInternalError(err, "Build vprodupdater")
+ }
+ vprodupdaterBin := filepath.Join(jirix.Root, "infrastructure", "go", "bin", "vprodupdater")
+ args := []string{
+ fmt.Sprintf("-type=%s", updateType),
+ }
+ if version != "" {
+ args = append(args, fmt.Sprintf("-tag=%s", version))
+ }
+ if err := s.Last(vprodupdaterBin, args...); err != nil {
+ return nil, newInternalError(err, "Run vprodupdater")
+ }
+ return &test.Result{Status: test.Passed}, nil
+}
diff --git a/jiri-test/internal/test/run.go b/jiri-test/internal/test/run.go
index d855c88..d9ec6b7 100644
--- a/jiri-test/internal/test/run.go
+++ b/jiri-test/internal/test/run.go
@@ -138,6 +138,8 @@
"vanadium-release-candidate": vanadiumReleaseCandidate,
"vanadium-release-candidate-snapshot": vanadiumReleaseCandidateSnapshot,
"vanadium-release-production": vanadiumReleaseProduction,
+ "vanadium-release-kube-staging": vanadiumReleaseKubeStaging,
+ "vanadium-release-kube-production": vanadiumReleaseKubeProduction,
"vanadium-signup-github": vanadiumSignupGithub,
"vanadium-signup-github-new": vanadiumSignupGithubNew,
"vanadium-signup-group": vanadiumSignupGroup,