Skip to content

Commit

Permalink
update release script (#1040)
Browse files Browse the repository at this point in the history
  • Loading branch information
kunmingg authored and k8s-ci-robot committed Jul 12, 2019
1 parent d746bde commit 67b5571
Show file tree
Hide file tree
Showing 9 changed files with 117,012 additions and 7 deletions.
9 changes: 6 additions & 3 deletions submit_release_job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Usage submit_release_job.sh ${COMMIT}
#
# COMMIT=commit to build at
# release workflow will submit to kubeflow-ci until release cluster updated
set -ex

COMMIT=$1
Expand All @@ -17,7 +18,7 @@ BUILD_NUMBER=$(uuidgen)
BUILD_NUMBER=${BUILD_NUMBER:0:4}
REPO_OWNER=kubeflow
REPO_NAME=tf-operator
ENV=releasing
ENV=test
DATE=`date +%Y%m%d`
PULL_BASE_SHA=${COMMIT:0:8}
VERSION_TAG="v${DATE}-${PULL_BASE_SHA}"
Expand All @@ -29,8 +30,10 @@ PROW_VAR="${PROW_VAR},PULL_BASE_SHA=${PULL_BASE_SHA}"

cd ${ROOT}/test/workflows

ks param set --env=${ENV} workflows namespace kubeflow-releasing
ks param set --env=${ENV} workflows name "${USER}-${JOB_NAME}-${PULL_BASE_SHA}-${BUILD_NUMBER}"
ks param set --env=${ENV} workflows namespace kubeflow-test-infra
ks param set --env=${ENV} workflows name "${JOB_NAME}-${PULL_BASE_SHA}-${USER}"
ks param set --env=${ENV} workflows prow_env "${PROW_VAR}"
ks param set --env=${ENV} workflows versionTag "${VERSION_TAG}"
ks param set --env=${ENV} workflows registry gcr.io/kubeflow-images-public
ks param set --env=${ENV} workflows bucket kubeflow-releasing-artifacts
ks apply ${ENV} -c workflows
4 changes: 2 additions & 2 deletions test/workflows/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ environments:
releasing:
destination:
namespace: kubeflow-releasing
server: https://35.226.49.107
server: https://35.231.208.75
k8sVersion: v1.7.0
path: releasing
test:
destination:
namespace: kubeflow-test-infra
server: https://35.196.213.148
k8sVersion: v1.7.0
k8sVersion: v1.11.10
path: test
kind: ksonnet.io/app
name: worfklows-app
Expand Down
4 changes: 2 additions & 2 deletions test/workflows/environments/releasing/params.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ params + {
workflows+: {
bucket: 'kubeflow-releasing-artifacts',
gcpCredentialsSecretName: 'gcp-credentials',
name: 'jlewi-tf-operator-release--b2a8',
name: 'tf-operator-release-d746bde9-kunming',
namespace: 'kubeflow-releasing',
project: 'kubeflow-releasing',
prow_env: 'JOB_NAME=tf-operator-release,JOB_TYPE=tf-operator-release,REPO_NAME=tf-operator,REPO_OWNER=kubeflow,BUILD_NUMBER=b2a8,PULL_BASE_SHA=6214e560',
prow_env: 'JOB_NAME=tf-operator-release,JOB_TYPE=tf-operator-release,REPO_NAME=tf-operator,REPO_OWNER=kubeflow,BUILD_NUMBER=204B,PULL_BASE_SHA=d746bde9',
registry: 'gcr.io/kubeflow-images-public',
versionTag: 'kubeflow-tf-operator-postsubmit-v2-70cafb1-271-1911',
zone: 'us-central1-a',
Expand Down
2 changes: 2 additions & 0 deletions test/workflows/environments/test/globals.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
9 changes: 9 additions & 0 deletions test/workflows/environments/test/main.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
local base = import "base.libsonnet";
// uncomment if you reference ksonnet-lib
// local k = import "k.libsonnet";
// local deployment = k.apps.v1beta2.deployment;

base + {
// Insert user-specified overrides here. For example if a component is named \"nginx-deployment\", you might have something like:\n")
// "nginx-deployment"+: deployment.mixin.metadata.withLabels({foo: "bar"})
}
21 changes: 21 additions & 0 deletions test/workflows/environments/test/params.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
local params = std.extVar('__ksonnet/params');
local globals = import 'globals.libsonnet';
local envParams = params + {
components+: {
workflows+: {
namespace: 'kubeflow-test-infra',
name: 'tf-operator-release-d746bde9-kunming',
prow_env: 'JOB_NAME=tf-operator-release,JOB_TYPE=tf-operator-release,REPO_NAME=tf-operator,REPO_OWNER=kubeflow,BUILD_NUMBER=01A3,PULL_BASE_SHA=d746bde9',
versionTag: 'v20190702-d746bde9',
registry: 'gcr.io/kubeflow-images-public',
bucket: 'kubeflow-releasing-artifacts',
},
},
};

{
components: {
[x]: envParams.components[x] + globals
for x in std.objectFields(envParams.components)
},
}
129 changes: 129 additions & 0 deletions test/workflows/lib/ksonnet-lib/v1.11.10/k.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
local k8s = import 'k8s.libsonnet';
local fn = {
mapContainers(f):: {
local podContainers = super.spec.template.spec.containers,
spec+: {
template+: {
spec+: {
containers: std.map(f, podContainers),
},
},
},
},
mapContainersWithName(names, f)::
local nameSet = if std.type(names) == 'array' then std.set(names) else std.set([names]);
local inNameSet(name) = std.length(std.setInter(nameSet, std.set([name]))) > 0;

self.mapContainers(function(c) if std.objectHas(c, 'name') && inNameSet(c.name) then f(c) else c),
};

k8s + {
apps:: k8s.apps + {
v1:: k8s.apps.v1 + {
daemonSet:: k8s.apps.v1.daemonSet + {
mapContainers(f):: fn.mapContainers(f),
mapContainersWithName(names, f):: fn.mapContainersWithName(names, f),
},
deployment:: k8s.apps.v1.deployment + {
mapContainers(f):: fn.mapContainers(f),
mapContainersWithName(names, f):: fn.mapContainersWithName(names, f),
},
replicaSet:: k8s.apps.v1.replicaSet + {
mapContainers(f):: fn.mapContainers(f),
mapContainersWithName(names, f):: fn.mapContainersWithName(names, f),
},
statefulSet:: k8s.apps.v1.statefulSet + {
mapContainers(f):: fn.mapContainers(f),
mapContainersWithName(names, f):: fn.mapContainersWithName(names, f),
},
},
v1beta1:: k8s.apps.v1beta1 + {
deployment:: k8s.apps.v1beta1.deployment + {
mapContainers(f):: fn.mapContainers(f),
mapContainersWithName(names, f):: fn.mapContainersWithName(names, f),
},
statefulSet:: k8s.apps.v1beta1.statefulSet + {
mapContainers(f):: fn.mapContainers(f),
mapContainersWithName(names, f):: fn.mapContainersWithName(names, f),
},
},
v1beta2:: k8s.apps.v1beta2 + {
daemonSet:: k8s.apps.v1beta2.daemonSet + {
mapContainers(f):: fn.mapContainers(f),
mapContainersWithName(names, f):: fn.mapContainersWithName(names, f),
},
deployment:: k8s.apps.v1beta2.deployment + {
mapContainers(f):: fn.mapContainers(f),
mapContainersWithName(names, f):: fn.mapContainersWithName(names, f),
},
replicaSet:: k8s.apps.v1beta2.replicaSet + {
mapContainers(f):: fn.mapContainers(f),
mapContainersWithName(names, f):: fn.mapContainersWithName(names, f),
},
statefulSet:: k8s.apps.v1beta2.statefulSet + {
mapContainers(f):: fn.mapContainers(f),
mapContainersWithName(names, f):: fn.mapContainersWithName(names, f),
},
},
},
batch:: k8s.batch + {
v1:: k8s.batch.v1 + {
job:: k8s.batch.v1.job + {
mapContainers(f):: fn.mapContainers(f),
mapContainersWithName(names, f):: fn.mapContainersWithName(names, f),
},
},
v1beta1:: k8s.batch.v1beta1 + {
cronJob:: k8s.batch.v1beta1.cronJob + {
mapContainers(f):: fn.mapContainers(f),
mapContainersWithName(names, f):: fn.mapContainersWithName(names, f),
},
},
v2alpha1:: k8s.batch.v2alpha1 + {
cronJob:: k8s.batch.v2alpha1.cronJob + {
mapContainers(f):: fn.mapContainers(f),
mapContainersWithName(names, f):: fn.mapContainersWithName(names, f),
},
},
},
core:: k8s.core + {
v1:: k8s.core.v1 + {
list:: {
new(items):: {
apiVersion: 'v1',
} + {
kind: 'List',
} + self.items(items),
items(items):: if std.type(items) == 'array' then { items+: items } else { items+: [items] },
},
pod:: k8s.core.v1.pod + {
mapContainers(f):: fn.mapContainers(f),
mapContainersWithName(names, f):: fn.mapContainersWithName(names, f),
},
podTemplate:: k8s.core.v1.podTemplate + {
mapContainers(f):: fn.mapContainers(f),
mapContainersWithName(names, f):: fn.mapContainersWithName(names, f),
},
replicationController:: k8s.core.v1.replicationController + {
mapContainers(f):: fn.mapContainers(f),
mapContainersWithName(names, f):: fn.mapContainersWithName(names, f),
},
},
},
extensions:: k8s.extensions + {
v1beta1:: k8s.extensions.v1beta1 + {
daemonSet:: k8s.extensions.v1beta1.daemonSet + {
mapContainers(f):: fn.mapContainers(f),
mapContainersWithName(names, f):: fn.mapContainersWithName(names, f),
},
deployment:: k8s.extensions.v1beta1.deployment + {
mapContainers(f):: fn.mapContainers(f),
mapContainersWithName(names, f):: fn.mapContainersWithName(names, f),
},
replicaSet:: k8s.extensions.v1beta1.replicaSet + {
mapContainers(f):: fn.mapContainers(f),
mapContainersWithName(names, f):: fn.mapContainersWithName(names, f),
},
},
},
}
Loading

0 comments on commit 67b5571

Please sign in to comment.