Skip to content

Commit

Permalink
Merge branch 'master' into pipelinespec
Browse files Browse the repository at this point in the history
  • Loading branch information
pritidesai authored Sep 25, 2019
2 parents 3788230 + bcbba97 commit c5ece91
Show file tree
Hide file tree
Showing 141 changed files with 2,593 additions and 2,450 deletions.
12 changes: 3 additions & 9 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,11 @@ _See [the contribution guide](https://github.com/tektoncd/pipeline/blob/master/C
Double check this list of stuff that's easy to miss:

- If you are adding [a new binary/image to the `cmd` dir](../cmd), please update
[the release Task](../tekton/publish.yaml) and [TaskRun](../tekton/publish-run.yaml) to build and release this image
[the release Task](../tekton/publish.yaml) to build and release this image.

## Reviewer Notes

If [API changes](https://github.com/tektoncd/pipeline/blob/master/api_compatibility_policy.md)
are included, [additive changes](https://github.com/tektoncd/pipeline/blob/master/api_compatibility_policy.md#additive-changes)
must be approved by at least two [OWNERS](https://github.com/tektoncd/pipeline/blob/master/OWNERS)
and [backwards incompatible changes](https://github.com/tektoncd/pipeline/blob/master/api_compatibility_policy.md#backwards-incompatible-changes)
must be approved by [more than 50% of the OWNERS](https://github.com/tektoncd/pipeline/blob/master/OWNERS),
and they must first be added
[in a backwards compatible way](https://github.com/tektoncd/pipeline/blob/master/api_compatibility_policy.md#backwards-compatible-changes-first).
If [API changes](https://github.com/tektoncd/pipeline/blob/master/api_compatibility_policy.md) are included, [additive changes](https://github.com/tektoncd/pipeline/blob/master/api_compatibility_policy.md#additive-changes) must be approved by at least two [OWNERS](https://github.com/tektoncd/pipeline/blob/master/OWNERS) and [backwards incompatible changes](https://github.com/tektoncd/pipeline/blob/master/api_compatibility_policy.md#backwards-incompatible-changes) must be approved by [more than 50% of the OWNERS](https://github.com/tektoncd/pipeline/blob/master/OWNERS), and they must first be added [in a backwards compatible way](https://github.com/tektoncd/pipeline/blob/master/api_compatibility_policy.md#backwards-compatible-changes-first).

# Release Notes

Expand All @@ -41,4 +35,4 @@ Examples of user facing changes:
- Bug fixes
- Any changes in behavior
```
```
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# MacOS file viewer garbage.
.DS_Store

# Compiled Object files
*.slo
*.lo
Expand Down Expand Up @@ -39,3 +42,7 @@

# Python
*.pyc

# Release-generated source archives, just in case they get committed
# accidentally.
cmd/*/kodata/source.tar.gz
18 changes: 18 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,24 @@ developing and running Pipelines. The recommended configuration is:
- Node autoscaling, up to 3 nodes
- API scopes for cloud-platform

To setup a cluster with Docker on Desktop:

To use minikube:
```bash
minikube start
eval $(minikube docker-env)
```

To use the Kubernetes that comes with Docker for Desktop:
1. First go into the Docker For Desktop preferences. Under the resource tabs ensure that you have at least 4 CPUs, 8.0 GiB Memory, and 1.0 GiB Swap.
1. Under the Kubernetes tab, enable Kubernetes.
1. Click the Apply and Restart button to save the preferences.
1. Switch the proper `kubectl` config context:
```bash
kubectl config get-contexts
# You should see docker-for-desktop in the previous command output
kubectl config use-context docker-for-desktop
```
To setup a cluster with GKE:

1. [Install required tools and setup GCP project](https://github.com/knative/docs/blob/master/docs/install/Knative-with-GKE.md#before-you-begin)
Expand Down
10 changes: 7 additions & 3 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Tekton Pipelines are **Typed**:
| Version | Docs | Examples |
| ------- | ---- | -------- |
| [HEAD](DEVELOPMENT.md#install-pipeline) | [Docs @ HEAD](/docs/README.md) | [Examples @ HEAD](/examples) |
| [v0.7.0](https://github.com/tektoncd/pipeline/releases/tag/v0.7.0) | [Docs @ v0.7.0](https://github.com/tektoncd/pipeline/tree/v0.7.0/docs#tekton-pipelines) | [Examples @ v0.7.0](https://github.com/tektoncd/pipeline/tree/v0.7.0/examples#examples) |
| [v0.6.0](https://github.com/tektoncd/pipeline/releases/tag/v0.6.0) | [Docs @ v0.6.0](https://github.com/tektoncd/pipeline/tree/release-v0.6.x/docs#tekton-pipelines) | [Examples @ v0.6.0](https://github.com/tektoncd/pipeline/tree/v0.6.0/examples#examples) |
| [v0.5.2](https://github.com/tektoncd/pipeline/releases/tag/v0.5.2) | [Docs @ v0.5.2](https://github.com/tektoncd/pipeline/tree/v0.5.2/docs#tekton-pipelines) | [Examples @ v0.5.2](https://github.com/tektoncd/pipeline/tree/v0.5.2/examples#examples) |
| [v0.5.1](https://github.com/tektoncd/pipeline/releases/tag/v0.5.1) | [Docs @ v0.5.1](https://github.com/tektoncd/pipeline/tree/v0.5.1/docs#tekton-pipelines) | [Examples @ v0.5.1](https://github.com/tektoncd/pipeline/tree/v0.5.1/examples#examples) |
Expand Down
4 changes: 2 additions & 2 deletions api_compatibility_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ Backwards incompatible changes change the API, e.g. by removing fields from a CR
spec. These changes will mean that folks using a previous version of the API will need
to adjust their usage in order to use the new version.

These changes must be make [in a backwards compatible manner first](#backwards-compatible-changes-first),
and they must be improved by [more than half of the project OWNERS](OWNERS)
These changes must be made [in a backwards compatible manner first](#backwards-compatible-changes-first),
and the changes must be approved by [more than half of the project OWNERS](OWNERS)
(i.e. 50% + 1).
7 changes: 3 additions & 4 deletions cmd/bash/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ package main

import (
"flag"
"log"
"os/exec"
"strings"

"github.com/tektoncd/pipeline/pkg/logging"
)
Expand All @@ -59,8 +59,7 @@ func main() {
cmd := exec.Command("sh", "-c", *args)
stdoutStderr, err := cmd.CombinedOutput()
if err != nil {
logger.Errorf("Error executing command %q with arguments %s", *args, stdoutStderr)
log.Fatal(err)
logger.Fatalf("Error executing command %q ; error %s; cmd_output %s", strings.Join(cmd.Args, " "), err.Error(), stdoutStderr)
}
logger.Infof("Successfully executed command %q", *args)
logger.Infof("Successfully executed command %q; output %s", strings.Join(cmd.Args, " "), stdoutStderr)
}
8 changes: 4 additions & 4 deletions cmd/creds-init/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ git credential [`.git-credentials`]() file (with `-basic-git` flag).

### `-ssh-git`

This uses the `ssh-privatekey` and `know_hosts` keys of the secret to generate:
This uses the `ssh-privatekey` and `known_hosts` keys of the secret to generate:
- a `~/.ssh/id_{secret}` private key
- a `~/.ssh/config` file
- a `~/.ssh/known hosts`
- a `~/.ssh/known_hosts`

With a `Secret` that looks like:

Expand Down Expand Up @@ -46,7 +46,7 @@ The flag `-ssh-git=ssh-key=github.com` (with the environment variable
Port 22
```
- `~/.ssh/id_rsa` with the content of `ssh-privatekey` decoded
- `~/.ssh/known_hosts` with the content of `ssh-privatekey` decoded
- `~/.ssh/known_hosts` with the content of `known_hosts` decoded


### `-basic-git`
Expand Down Expand Up @@ -143,7 +143,7 @@ This uses the `config.json` key from a secret of type
`kubernetes.io/dockerconfigjson` to populate the generated docker's
`config.json` file.

### `-dokcer-cfg`
### `-docker-cfg`

This uses the `.dockercfg` key from a secret of type
`kubernetes.io/dockercfg` to populate the generated docker's
Expand Down
18 changes: 18 additions & 0 deletions cmd/imagedigestexporter/digest.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package main

import (
v1 "github.com/google/go-containerregistry/pkg/v1"
)

// GetDigest returns the digest of an OCI image index. If there is only one image in the index, the
// digest of the image is returned; otherwise, the digest of the whole index is returned.
func GetDigest(ii v1.ImageIndex) (v1.Hash, error) {
im, err := ii.IndexManifest()
if err != nil {
return v1.Hash{}, err
}
if len(im.Manifests) == 1 {
return im.Manifests[0].Digest, nil
}
return ii.Digest()
}
65 changes: 65 additions & 0 deletions cmd/imagedigestexporter/digest_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package main

import (
"testing"

"github.com/google/go-cmp/cmp"
v1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/google/go-containerregistry/pkg/v1/empty"
"github.com/google/go-containerregistry/pkg/v1/random"
)

func TestGetDigest(t *testing.T) {
mustGetIndex := func(ii v1.ImageIndex, err error) v1.ImageIndex {
if err != nil {
t.Fatalf("must get image: %s", err)
}
return ii
}
mustGetManifest := func(im *v1.IndexManifest, err error) *v1.IndexManifest {
if err != nil {
t.Fatalf("must get manifest: %s", err)
}
return im
}
mustGetDigest := func(h v1.Hash, err error) v1.Hash {
if err != nil {
t.Fatalf("must get digest: %s", err)
}
return h
}
indexSingleImage := mustGetIndex(random.Index(1024, 4, 1))
indexMultipleImages := mustGetIndex(random.Index(1024, 4, 4))
tests := []struct {
name string
index v1.ImageIndex
expected v1.Hash
}{
{
name: "empty index",
index: empty.Index,
expected: mustGetDigest(empty.Index.Digest()),
},
{
name: "index with single image",
index: indexSingleImage,
expected: mustGetManifest(indexSingleImage.IndexManifest()).Manifests[0].Digest,
},
{
name: "index with multiple images",
index: indexMultipleImages,
expected: mustGetDigest(indexMultipleImages.Digest()),
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
digest, err := GetDigest(test.index)
if err != nil {
t.Fatalf("cannot get digest: %s", err)
}
if diff := cmp.Diff(digest, test.expected); diff != "" {
t.Errorf("get digest: -want +got: %s", diff)
}
})
}
}
4 changes: 2 additions & 2 deletions cmd/imagedigestexporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ func main() {
log.Printf("ImageResource %s doesn't have an index.json file: %s", imageResource.Name, err)
continue
}
digest, err := ii.Digest()
digest, err := GetDigest(ii)
if err != nil {
log.Fatalf("Unexpected error getting image digest %v: %v", imageResource, err)
log.Fatalf("Unexpected error getting image digest for %s: %v", imageResource.Name, err)
}
output = append(output, v1alpha1.PipelineResourceResult{Name: imageResource.Name, Digest: digest.String()})
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/kubeconfigwriter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ func createKubeconfigFile(resource *v1alpha1.ClusterResource, logger *zap.Sugare
context := &clientcmdapi.Context{
Cluster: resource.Name,
AuthInfo: resource.Username,
// Namespace isn't written to kubeconfig if this is empty
Namespace: resource.Namespace,
}
c := clientcmdapi.NewConfig()
c.Clusters[resource.Name] = cluster
Expand Down
17 changes: 9 additions & 8 deletions config/config-observability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,18 @@ data:
# metrics.backend-destination field specifies the system metrics destination.
# It supports either prometheus (the default) or stackdriver.
# Note: Using stackdriver will incur additional charges
# Note: Using Stackdriver will incur additional charges.
metrics.backend-destination: prometheus
# metrics.stackdriver-project-id field specifies the stackdriver project ID. This
# metrics.stackdriver-project-id field specifies the Stackdriver project ID. This
# field is optional. When running on GCE, application default credentials will be
# used if this field is not provided.
# used and metrics will be sent to the cluster's project if this field is
# not provided.
metrics.stackdriver-project-id: "<your stackdriver project id>"
# metrics.allow-stackdriver-custom-metrics indicates whether it is allowed to send metrics to
# Stackdriver using "global" resource type and custom metric type if the
# metrics are not supported by "knative_revision" resource type. Setting this
# flag to "true" could cause extra Stackdriver charge.
# If metrics.backend-destination is not Stackdriver, this is ignored.
# metrics.allow-stackdriver-custom-metrics indicates whether it is allowed
# to send metrics to Stackdriver using "global" resource type and custom
# metric type. Setting this flag to "true" could cause extra Stackdriver
# charge. If metrics.backend-destination is not Stackdriver, this is
# ignored.
metrics.allow-stackdriver-custom-metrics: "false"
10 changes: 9 additions & 1 deletion config/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,27 @@
# 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: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: tekton-pipelines-controller
namespace: tekton-pipelines
labels:
app.kubernetes.io/name: tekton-pipelines
app.kubernetes.io/component: controller
spec:
replicas: 1
selector:
matchLabels:
app: tekton-pipelines-controller
template:
metadata:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
labels:
app: tekton-pipelines-controller
app.kubernetes.io/name: tekton-pipelines
app.kubernetes.io/component: controller
spec:
serviceAccountName: tekton-pipelines-controller
containers:
Expand Down
10 changes: 9 additions & 1 deletion config/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: tekton-pipelines-webhook
namespace: tekton-pipelines
labels:
app.kubernetes.io/name: tekton-pipelines
app.kubernetes.io/component: webhook-controller
spec:
replicas: 1
selector:
matchLabels:
app: tekton-pipelines-webhook
template:
metadata:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
labels:
app: tekton-pipelines-webhook
app.kubernetes.io/name: tekton-pipelines
app.kubernetes.io/component: webhook-controller
spec:
serviceAccountName: tekton-pipelines-controller
containers:
Expand Down
Loading

0 comments on commit c5ece91

Please sign in to comment.