-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OpenShift] Improve Addon Task management
Move logic to create 'versioned clustertasks' (clustertasks with version suffix in names), into operator Move kind replacement of all tasks into operator Move tasks from (openshift) pipelines-catalog into operator openshift kodata Modify fetch clustertasks script to download tasks only from tektoncd/catalog repository main branch Signed-off-by: Nikhil Thomas <nikthoma@redhat.com>
- Loading branch information
1 parent
18bfb46
commit 85445a3
Showing
21 changed files
with
174 additions
and
304 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
7 changes: 1 addition & 6 deletions
7
...perator/kodata/tekton-addon/addons/02-clustertasks/source_local/buildah/buildah-task.yaml
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
3 changes: 2 additions & 1 deletion
3
...ft/operator/kodata/tekton-addon/addons/02-clustertasks/source_local/maven/maven-task.yaml
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
--- | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: ClusterTask | ||
kind: Task | ||
metadata: | ||
name: maven | ||
labels: | ||
|
4 changes: 2 additions & 2 deletions
4
...ton-addon/addons/02-clustertasks/source_local/openshift-client/openshift-client-task.yaml
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
6 changes: 1 addition & 5 deletions
6
...r/kodata/tekton-addon/addons/02-clustertasks/source_local/s2i-dotnet/s2i-dotnet-task.yaml
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
6 changes: 1 addition & 5 deletions
6
.../operator/kodata/tekton-addon/addons/02-clustertasks/source_local/s2i-go/s2i-go-task.yaml
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
6 changes: 1 addition & 5 deletions
6
...rator/kodata/tekton-addon/addons/02-clustertasks/source_local/s2i-java/s2i-java-task.yaml
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
6 changes: 1 addition & 5 deletions
6
...r/kodata/tekton-addon/addons/02-clustertasks/source_local/s2i-nodejs/s2i-nodejs-task.yaml
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
6 changes: 1 addition & 5 deletions
6
...rator/kodata/tekton-addon/addons/02-clustertasks/source_local/s2i-perl/s2i-perl-task.yaml
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
6 changes: 1 addition & 5 deletions
6
...perator/kodata/tekton-addon/addons/02-clustertasks/source_local/s2i-php/s2i-php-task.yaml
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
6 changes: 1 addition & 5 deletions
6
...r/kodata/tekton-addon/addons/02-clustertasks/source_local/s2i-python/s2i-python-task.yaml
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
6 changes: 1 addition & 5 deletions
6
...rator/kodata/tekton-addon/addons/02-clustertasks/source_local/s2i-ruby/s2i-ruby-task.yaml
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
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
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,122 @@ | ||
#!/usr/bin/env bash | ||
set -e -u -o pipefail | ||
|
||
declare -r SCRIPT_NAME=$(basename "$0") | ||
declare -r SCRIPT_DIR=$(cd $(dirname "$0") && pwd) | ||
|
||
log() { | ||
local level=$1; shift | ||
echo -e "$level: $@" | ||
} | ||
|
||
|
||
err() { | ||
log "ERROR" "$@" >&2 | ||
} | ||
|
||
info() { | ||
log "INFO" "$@" | ||
} | ||
|
||
die() { | ||
local code=$1; shift | ||
local msg="$@"; shift | ||
err $msg | ||
exit $code | ||
} | ||
|
||
usage() { | ||
local msg="$1" | ||
cat <<-EOF | ||
Error: $msg | ||
USAGE: | ||
$SCRIPT_NAME DEST_DIR | ||
Example: | ||
$SCRIPT_NAME cmd/openshift/operator/kodata/tekton-addon/addons/02-clustertasks/source_external | ||
EOF | ||
exit 1 | ||
} | ||
|
||
#declare -r CATALOG_VERSION="release-v0.7" | ||
|
||
declare -r TEKTON_CATALOG="https://raw.githubusercontent.com/tektoncd/catalog" | ||
declare -A TEKTON_CATALOG_TASKS=( | ||
# Need to remove version param | ||
["git-clone"]="0.4" | ||
["kn"]="0.1" | ||
["kn-apply"]="0.1" | ||
["skopeo-copy"]="0.1" | ||
["tkn"]="0.2" | ||
# Those tasks are managed directly in the repository | ||
# ["buildah"]="0.1" | ||
# ["openshift-client"]="0.2" | ||
) | ||
|
||
download_task() { | ||
local task_path="$1"; shift | ||
local task_url="$1"; shift | ||
|
||
info "downloading ... $t from $task_url" | ||
# validate url | ||
curl --output /dev/null --silent --head --fail "$task_url" || return 1 | ||
|
||
|
||
cat <<-EOF > "$task_path" | ||
# auto generated by script/update-tasks.sh | ||
# DO NOT EDIT: use the script instead | ||
# source: $task_url | ||
# | ||
--- | ||
$(curl -sLf "$task_url") | ||
EOF | ||
|
||
# NOTE: helps when the original and the generated need to compared | ||
# curl -sLf "$task_url" -o "$task_path.orig" | ||
|
||
} | ||
|
||
|
||
get_tasks() { | ||
local dest_dir="$1"; shift | ||
local catalog="$1"; shift | ||
local catalog_version="$1"; shift | ||
local -n tasks=$1 | ||
|
||
info "Downloading tasks from catalog $catalog to $dest_dir directory" | ||
for t in ${!tasks[@]} ; do | ||
# task filenames do not follow a naming convention, | ||
# some are taskname.yaml while others are taskname-task.yaml | ||
# so, try both before failing | ||
local task_url="$catalog/$catalog_version/task/$t/${tasks[$t]}/${t}.yaml" | ||
echo "$catalog/$catalog_version/task/$t/${tasks[$t]}/${t}.yaml" | ||
|
||
mkdir -p "$dest_dir/$t/" | ||
local task_path="$dest_dir/$t/$t-task.yaml" | ||
|
||
download_task "$task_path" "$task_url" || | ||
die 1 "Failed to download $t" | ||
done | ||
} | ||
|
||
create_dir_or_die() { | ||
local dest_dir="$1"; shift | ||
mkdir -p "$dest_dir" || die 1 "failed to create ${dest_dir}" | ||
echo $dest_dir created | ||
} | ||
|
||
main() { | ||
|
||
local dest_dir=${1:-''} | ||
[[ -z "$dest_dir" ]] && usage "missing destination directory" | ||
shift | ||
|
||
[[ ! -d "$dest_dir" ]] && create_dir_or_die "$dest_dir" || echo "$dest_dir" exists | ||
|
||
get_tasks "$dest_dir" "$TEKTON_CATALOG" "main" TEKTON_CATALOG_TASKS | ||
|
||
return $? | ||
} | ||
|
||
main "$@" |
Oops, something went wrong.