forked from tektoncd/experimental
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[workflows] Add Workflow CRD and associated scaffolding
This commit adds an empty workflow CRD as well as all of the associated scaffolding and generated code. Signed-off-by: Dibyo Mukherjee <dibyo@google.com>
- Loading branch information
1 parent
eddc3ed
commit 7ade2a7
Showing
133 changed files
with
12,912 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright 2021 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 | ||
# | ||
# https://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: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: workflows.tekton.dev | ||
labels: | ||
app.kubernetes.io/instance: default | ||
app.kubernetes.io/part-of: tekton-pipelines | ||
version: "devel" | ||
spec: | ||
group: tekton.dev | ||
preserveUnknownFields: false | ||
versions: | ||
- name: v1alpha1 | ||
served: true | ||
storage: true | ||
schema: | ||
openAPIV3Schema: | ||
type: object | ||
# One can use x-kubernetes-preserve-unknown-fields: true | ||
# at the root of the schema (and inside any properties, additionalProperties) | ||
# to get the traditional CRD behaviour that nothing is pruned, despite | ||
# setting spec.preserveUnknownProperties: false. | ||
# | ||
# See https://kubernetes.io/blog/2019/06/20/crd-structural-schema/ | ||
# See issue: https://github.com/knative/serving/issues/912 | ||
x-kubernetes-preserve-unknown-fields: true | ||
# Opt into the status subresource so metadata.generation | ||
# starts to increment | ||
subresources: | ||
status: {} | ||
names: | ||
kind: Workflow | ||
plural: workflows | ||
categories: | ||
- tekton | ||
- tekton-pipelines | ||
scope: Namespaced |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: tekton.dev/v1alpha1 | ||
kind: Workflow | ||
metadata: | ||
name: example-workflow | ||
spec: | ||
pipeline: | ||
ref: my-pipeline | ||
params: | ||
- name: default-repo | ||
default: my-repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module github.com/tektoncd/experimental/workflows | ||
|
||
go 1.16 | ||
|
||
require ( | ||
github.com/GoogleCloudPlatform/cloud-builders/gcs-fetcher v0.0.0-20210729182058-ea1f5c7c37f1 | ||
github.com/tektoncd/plumbing v0.0.0-20210514044347-f8a9689d5bd5 | ||
go.uber.org/zap v1.18.1 | ||
k8s.io/api v0.20.7 | ||
k8s.io/apimachinery v0.20.7 | ||
k8s.io/client-go v0.20.7 | ||
k8s.io/code-generator v0.20.7 | ||
k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd | ||
knative.dev/pkg v0.0.0-20210730172132-bb4aaf09c430 | ||
) | ||
|
||
// Knative deps (release-0.20) | ||
replace ( | ||
contrib.go.opencensus.io/exporter/stackdriver => contrib.go.opencensus.io/exporter/stackdriver v0.13.4 | ||
github.com/Azure/azure-sdk-for-go => github.com/Azure/azure-sdk-for-go v38.2.0+incompatible | ||
) |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
Copyright 2021 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. | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2017 The Kubernetes 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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
|
||
# generate-groups generates everything for a project with external types only, e.g. a project based | ||
# on CustomResourceDefinitions. | ||
|
||
if [ "$#" -lt 4 ] || [ "${1}" == "--help" ]; then | ||
cat <<EOF | ||
Usage: $(basename "$0") <generators> <output-package> <apis-package> <groups-versions> ... | ||
<generators> the generators comma separated to run (deepcopy,defaulter,client,lister,informer) or "all". | ||
<output-package> the output package name (e.g. github.com/example/project/pkg/generated). | ||
<apis-package> the external types dir (e.g. github.com/example/api or github.com/example/project/pkg/apis). | ||
<groups-versions> the groups and their versions in the format "groupA:v1,v2 groupB:v1 groupC:v2", relative | ||
to <api-package>. | ||
... arbitrary flags passed to all generator binaries. | ||
Examples: | ||
$(basename "$0") all github.com/example/project/pkg/client github.com/example/project/pkg/apis "foo:v1 bar:v1alpha1,v1beta1" | ||
$(basename "$0") deepcopy,client github.com/example/project/pkg/client github.com/example/project/pkg/apis "foo:v1 bar:v1alpha1,v1beta1" | ||
EOF | ||
exit 0 | ||
fi | ||
|
||
GENS="$1" | ||
OUTPUT_PKG="$2" | ||
APIS_PKG="$3" | ||
GROUPS_WITH_VERSIONS="$4" | ||
shift 4 | ||
|
||
( | ||
# To support running this script from anywhere, we have to first cd into this directory | ||
# so we can install the tools. | ||
cd "$(dirname "${0}")" | ||
go install k8s.io/code-generator/cmd/{defaulter-gen,client-gen,lister-gen,informer-gen,deepcopy-gen} | ||
) | ||
|
||
PREFIX=${GOBIN:-${GOPATH}/bin} | ||
|
||
function codegen::join() { local IFS="$1"; shift; echo "$*"; } | ||
|
||
# enumerate group versions | ||
FQ_APIS=() # e.g. k8s.io/api/apps/v1 | ||
for GVs in ${GROUPS_WITH_VERSIONS}; do | ||
IFS=: read -r G Vs <<<"${GVs}" | ||
|
||
# enumerate versions | ||
for V in ${Vs//,/ }; do | ||
FQ_APIS+=("${APIS_PKG}/${G}/${V}") | ||
done | ||
done | ||
|
||
if [ "${GENS}" = "all" ] || grep -qw "deepcopy" <<<"${GENS}"; then | ||
echo "Generating deepcopy funcs for ${GROUPS_WITH_VERSIONS} at ${APIS_PKG}" | ||
set -x | ||
"${PREFIX}/deepcopy-gen" --input-dirs "$(codegen::join , "${FQ_APIS[@]}")" -O zz_generated.deepcopy --bounding-dirs "${APIS_PKG}" "$@" | ||
fi | ||
|
||
if [ "${GENS}" = "all" ] || grep -qw "client" <<<"${GENS}"; then | ||
echo "Generating clientset for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}" | ||
"${PREFIX}/client-gen" --clientset-name "${CLIENTSET_NAME_VERSIONED:-versioned}" --input-base "" --input "$(codegen::join , "${FQ_APIS[@]}")" --output-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}" "$@" | ||
fi | ||
|
||
if [ "${GENS}" = "all" ] || grep -qw "lister" <<<"${GENS}"; then | ||
echo "Generating listers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/listers" | ||
"${PREFIX}/lister-gen" --input-dirs "$(codegen::join , "${FQ_APIS[@]}")" --output-package "${OUTPUT_PKG}/listers" "$@" | ||
fi | ||
|
||
if [ "${GENS}" = "all" ] || grep -qw "informer" <<<"${GENS}"; then | ||
echo "Generating informers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/informers" | ||
"${PREFIX}/informer-gen" \ | ||
--input-dirs "$(codegen::join , "${FQ_APIS[@]}")" \ | ||
--versioned-clientset-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}/${CLIENTSET_NAME_VERSIONED:-versioned}" \ | ||
--listers-package "${OUTPUT_PKG}/listers" \ | ||
--output-package "${OUTPUT_PKG}/informers" \ | ||
"$@" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2019 The Knative 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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
# generate-groups generates everything for a project with external types only, e.g. a project based | ||
# on CustomResourceDefinitions. | ||
|
||
if [ "$#" -lt 4 ] || [ "${1}" == "--help" ]; then | ||
cat <<EOF | ||
Usage: $(basename $0) <generators> <client-package> <apis-package> <groups-versions> ... | ||
<generators> the generators comma separated to run (deepcopy,defaulter,client,lister,informer) or "all". | ||
<client-package> the client package dir (e.g. github.com/example/project/pkg/clientset). | ||
<apis-package> the external types dir (e.g. github.com/example/api or github.com/example/project/pkg/apis). | ||
<groups-versions> the groups and their versions in the format "groupA:v1,v2 groupB:v1 groupC:v2", relative | ||
to <api-package>. | ||
... arbitrary flags passed to all generator binaries. | ||
Examples: | ||
$(basename $0) all github.com/example/project/pkg/client github.com/example/project/pkg/apis "foo:v1 bar:v1alpha1,v1beta1" | ||
$(basename $0) injection,foo github.com/example/project/pkg/client github.com/example/project/pkg/apis "foo:v1 bar:v1alpha1,v1beta1" | ||
EOF | ||
exit 0 | ||
fi | ||
|
||
GENS="$1" | ||
CLIENT_PKG="$2" | ||
APIS_PKG="$3" | ||
GROUPS_WITH_VERSIONS="$4" | ||
shift 4 | ||
|
||
( | ||
# To support running this script from anywhere, we have to first cd into this directory | ||
# so we can install the tools. | ||
cd $(dirname "${0}") | ||
go install knative.dev/pkg/codegen/cmd/injection-gen | ||
) | ||
|
||
PREFIX=${GOBIN:-${GOPATH}/bin} | ||
|
||
function codegen::join() { local IFS="$1"; shift; echo "$*"; } | ||
|
||
# enumerate group versions | ||
FQ_APIS=() # e.g. k8s.io/api/apps/v1 | ||
for GVs in ${GROUPS_WITH_VERSIONS}; do | ||
IFS=: read G Vs <<<"${GVs}" | ||
|
||
# enumerate versions | ||
for V in ${Vs//,/ }; do | ||
FQ_APIS+=(${APIS_PKG}/${G}/${V}) | ||
done | ||
done | ||
|
||
|
||
if grep -qw "injection" <<<"${GENS}"; then | ||
if [[ -z "${OUTPUT_PKG:-}" ]]; then | ||
OUTPUT_PKG="${CLIENT_PKG}/injection" | ||
fi | ||
|
||
if [[ -z "${VERSIONED_CLIENTSET_PKG:-}" ]]; then | ||
VERSIONED_CLIENTSET_PKG="${CLIENT_PKG}/clientset/versioned" | ||
fi | ||
|
||
if [[ -z "${EXTERNAL_INFORMER_PKG:-}" ]]; then | ||
EXTERNAL_INFORMER_PKG="${CLIENT_PKG}/informers/externalversions" | ||
fi | ||
|
||
if [[ -z "${LISTERS_PKG:-}" ]]; then | ||
LISTERS_PKG="${CLIENT_PKG}/listers" | ||
fi | ||
|
||
echo "Generating injection for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}" | ||
|
||
# Clear old injection | ||
rm -rf ${OUTPUT_PKG} | ||
|
||
${PREFIX}/injection-gen \ | ||
--input-dirs $(codegen::join , "${FQ_APIS[@]}") \ | ||
--versioned-clientset-package ${VERSIONED_CLIENTSET_PKG} \ | ||
--external-versions-informers-package ${EXTERNAL_INFORMER_PKG} \ | ||
--listers-package ${LISTERS_PKG} \ | ||
--output-package ${OUTPUT_PKG} \ | ||
"$@" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// +build tools | ||
|
||
package tools | ||
|
||
import ( | ||
_ "github.com/tektoncd/plumbing" | ||
_ "github.com/tektoncd/plumbing/scripts" | ||
|
||
_ "k8s.io/code-generator/cmd/client-gen" | ||
_ "k8s.io/code-generator/cmd/deepcopy-gen" | ||
_ "k8s.io/code-generator/cmd/defaulter-gen" | ||
_ "k8s.io/code-generator/cmd/informer-gen" | ||
_ "k8s.io/code-generator/cmd/lister-gen" | ||
_ "k8s.io/kube-openapi/cmd/openapi-gen" | ||
|
||
_ "knative.dev/pkg/codegen/cmd/injection-gen" | ||
|
||
_ "github.com/GoogleCloudPlatform/cloud-builders/gcs-fetcher/cmd/gcs-fetcher" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env bash | ||
|
||
# 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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
source $(git rev-parse --show-toplevel)/vendor/github.com/tektoncd/plumbing/scripts/library.sh | ||
|
||
PREFIX=${GOBIN:-${GOPATH}/bin} | ||
|
||
OLDGOFLAGS="${GOFLAGS:-}" | ||
GOFLAGS="-mod=vendor" | ||
# generate the code with: | ||
# --output-base because this script should also be able to run inside the vendor dir of | ||
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir | ||
# instead of the $GOPATH directly. For normal projects this can be dropped. | ||
bash ${REPO_ROOT_DIR}/workflows/hack/generate-groups.sh "deepcopy,client,informer,lister" \ | ||
github.com/tektoncd/experimental/workflows/pkg/client github.com/tektoncd/experimental/workflows/pkg/apis \ | ||
"workflows:v1alpha1" \ | ||
--go-header-file ${REPO_ROOT_DIR}/workflows/hack/boilerplate/boilerplate.go.txt | ||
|
||
# Knative Injection | ||
bash ${REPO_ROOT_DIR}/workflows/hack/generate-knative.sh "injection" \ | ||
github.com/tektoncd/experimental/workflows/pkg/client github.com/tektoncd/experimental/workflows/pkg/apis \ | ||
"workflows:v1alpha1" \ | ||
--go-header-file ${REPO_ROOT_DIR}/workflows/hack/boilerplate/boilerplate.go.txt | ||
GOFLAGS="${OLDGOFLAGS}" | ||
|
||
# Make sure our dependencies are up-to-date | ||
${REPO_ROOT_DIR}/workflows/hack/update-deps.sh |
Oops, something went wrong.