Skip to content

Commit

Permalink
Add a Task to log the tools in test-runner
Browse files Browse the repository at this point in the history
Similar to what is done today in CI logs, add a task to log the
versions of tools in the test-runner. This is helpful for
debugging failures.
  • Loading branch information
afrittoli committed Oct 1, 2019
1 parent e4e7204 commit c19e8c7
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 59 deletions.
34 changes: 28 additions & 6 deletions tekton/README
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,18 @@ spec:

### Verify Release

The `pipeline-verify-release` verifies the release assets for a Tekton project.
It does so by performing the following steps:
The `verify-deploy-log-tekton-release` is an example pipeline to verify the
release assets for a Tekton project. The test part of the pipeline depends on
tasks defined in the specific repo, at least until we have more powerful ways to
invoke tasks in a pipeline, so the complete pipeline must be also defined in the
specific repos.

This pipeline performs the following steps:
* validate the release YAML from the bucket against that in GitHub
* deploy the release against a test k8s cluster
* wait for all the deployments and pods to be up and running (TBD)
* run E2E tests and validate results (TBD)
* wait for all the deployments and pods to be up and running
* log the version of tools in the test running image
* Not included: run E2E tests and validate results

Inputs are:
- Param `projectName`: the name of the project (pipeline, trigger,
Expand Down Expand Up @@ -120,7 +126,6 @@ spec:
```

The bucket resource can be read-only:

```
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
Expand All @@ -137,12 +142,29 @@ spec:
value: "y"
```

The plumbing git resource:
```
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: plumbing-git-master
spec:
type: git
params:
- name: revision
value: master
- name: url
value: https://github.com/tektoncd/plumbing
```

The pipeline can be executed using the `tkn` client:
```
tkn pipeline start \
--param=version=<version> \
--param=projectName=<tekton-project> \
--param=namespace=tekton-pipelines \
--resource=bucket=<tekton-bucket-resource> \
--resource=test-cluster=<test-cluster> \
pipeline-verify-release
--resource=plumbing=plumbing-git-master \
verify-deploy-log-tekton-release
```
73 changes: 73 additions & 0 deletions tekton/install_and_test_tekton_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Copyright 2019 The Tekton Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: tekton.dev/v1alpha1
kind: Pipeline
metadata:
name: verify-deploy-log-tekton-release
spec:
params:
- name: projectName
description: Name of the Tekton project to install e.g. pipeline, trigger, dashboard, experimental
default: pipeline
- name: version
description: The vX.Y.Z version that we want to install (including `v`)
- name: namespace
description: Namespace where the Tekton project is installed by the release
resources:
- name: bucket
type: storage
- name: test-cluster
type: cluster
- name: plumbing
type: git
tasks:
- name: verify
taskRef:
name: verify-tekton-release-github
params:
- name: projectName
value: $(params.projectName)
- name: version
value: $(params.version)
resources:
inputs:
- name: release-bucket
resource: bucket
- name: deploy
runAfter: [verify]
taskRef:
name: install-tekton-release
params:
- name: projectName
value: $(params.projectName)
- name: version
value: $(params.version)
- name: namespace
value: $(params.namespace)
resources:
inputs:
- name: release-bucket
resource: bucket
- name: k8s-cluster
resource: test-cluster
- name: plumbing-library
resource: plumbing
- name: log
runAfter: [deploy]
taskRef:
name: log-test-image-tools
resources:
inputs:
- name: plumbing-library
resource: plumbing
53 changes: 0 additions & 53 deletions tekton/install_tekton_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,56 +113,3 @@ spec:
diff \
/workspace/release-github.yaml \
$(inputs.resources.release-bucket.path)/$(inputs.params.projectName)/previous/$(inputs.params.version)/release.yaml # Diff exists with 0 only if there is no difference
---
apiVersion: tekton.dev/v1alpha1
kind: Pipeline
metadata:
name: pipeline-verify-release
spec:
params:
- name: projectName
description: Name of the Tekton project to install e.g. pipeline, trigger, dashboard, experimental
default: pipeline
- name: version
description: The vX.Y.Z version that we want to install (including `v`)
- name: namespace
description: Namespace where the Tekton project is installed by the release
resources:
- name: bucket
type: storage
- name: test-cluster
type: cluster
- name: plumbing
type: git
tasks:
- name: verify
taskRef:
name: verify-tekton-release-github
params:
- name: projectName
value: $(params.projectName)
- name: version
value: $(params.version)
resources:
inputs:
- name: release-bucket
resource: bucket
- name: deploy
runAfter: [verify]
taskRef:
name: install-tekton-release
params:
- name: projectName
value: $(params.projectName)
- name: version
value: $(params.version)
- name: namespace
value: $(params.namespace)
resources:
inputs:
- name: release-bucket
resource: bucket
- name: k8s-cluster
resource: test-cluster
- name: plumbing-library
resource: plumbing
45 changes: 45 additions & 0 deletions tekton/test_tekton_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2019 The Tekton Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
name: log-test-image-tools
spec:
inputs:
resources:
- name: plumbing-library
type: git
steps:
- name: log-test-runner-tools-setup
image: gcr.io/tekton-releases/tests/test-runner@sha256:a4a64b2b70f85a618bbbcc6c0b713b313b2e410504dee24c9f90ec6fe3ebf63f
command:
- /bin/bash
args:
- -ce
- |
source $(inputs.resources.plumbing-library.path)/scripts/library.sh
# Disable gcloud update notifications
gcloud config set component_manager/disable_update_check true
header "Current test setup"
echo ">> gcloud SDK version"
gcloud version
echo ">> kubectl version"
kubectl version --client
echo ">> go version"
go version
echo ">> git version"
git version
echo ">> bazel version"
bazel version 2> /dev/null

0 comments on commit c19e8c7

Please sign in to comment.