-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
115ee76
commit 99f6cc1
Showing
29 changed files
with
848 additions
and
259 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
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 |
---|---|---|
@@ -1,37 +1,20 @@ | ||
name: str() | ||
home: str(required=False) | ||
version: str() | ||
apiVersion: str() | ||
appVersion: any(str(), num(), required=False) | ||
description: str(required=False) | ||
keywords: list(str(), required=False) | ||
sources: list(str(), required=False) | ||
maintainers: list(include('maintainer'), required=False) | ||
dependencies: list(include('dependency'), required=False) | ||
icon: str(required=False) | ||
engine: str(required=False) | ||
condition: str(required=False) | ||
tags: str(required=False) | ||
deprecated: bool(required=False) | ||
kubeVersion: str(required=False) | ||
annotations: map(str(), str(), required=False) | ||
type: str(required=False) | ||
--- | ||
maintainer: | ||
name: str() | ||
name: str(required=False) | ||
email: str(required=False) | ||
url: str(required=False) | ||
--- | ||
dependency: | ||
name: str() | ||
version: str() | ||
repository: str(required=False) | ||
condition: str(required=False) | ||
tags: list(str(), required=False) | ||
enabled: bool(required=False) | ||
import-values: any(list(str()), list(include('import-value')), required=False) | ||
alias: str(required=False) | ||
--- | ||
import-value: | ||
child: str() | ||
parent: str() | ||
url: str(required=False) |
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,83 @@ | ||
#!/usr/bin/env bash | ||
#Assumes User is logged in to cluster | ||
set -euo pipefail | ||
|
||
all_cmds_found=0 | ||
for cmd in oc tkn; do | ||
if ! which -s $cmd; then | ||
echo "No $cmd executable found in $PATH" >&2 | ||
all_cmds_found=1 | ||
fi | ||
done | ||
if ! [[ $all_cmds_found ]]; then exit 1; fi | ||
|
||
|
||
tekton_setup_dir="$(dirname $BASH_SOURCE)/tekton-demo-setup" | ||
python_example_txt="$(dirname $BASH_SOURCE)/python-example/response.txt" | ||
|
||
echo "Setting up resources:" | ||
|
||
echo "1. Installing tekton operator" | ||
oc apply -f "$tekton_setup_dir/01-tekton-operator.yaml" | ||
|
||
echo "2. Setting up python tekton project" | ||
if ! project_setup_output="$(oc apply -f $tekton_setup_dir/02-project.yaml 2>&1)"; then | ||
if echo "$project_setup_output" | grep -q "AlreadyExists"; then | ||
echo "Project already exists" | ||
else | ||
echo "$project_setup_output" >&2 | ||
exit 1 | ||
fi | ||
else | ||
echo "$project_setup_output" | ||
fi | ||
|
||
|
||
echo "3. Setting up build and deployment information" | ||
oc process -f "$tekton_setup_dir/03-build-and-deploy.yaml" | oc apply -f - | ||
|
||
route="$(oc get -n basic-python-tekton route/basic-python-tekton --output=go-template='http://{{.spec.host}}')" | ||
|
||
url=$1 | ||
|
||
counter=1 | ||
|
||
current_branch="$(git symbolic-ref HEAD)" | ||
current_branch=${current_branch##refs/heads/} | ||
|
||
function run_pipeline { | ||
tkn pipeline start -n basic-python-tekton --showlog basic-python-tekton-pipeline \ | ||
-w name=repo,claimName=basic-python-tekton-build-pvc \ | ||
-p git-url="$url" -p git-revision="$current_branch" | ||
} | ||
|
||
echo -e "\nRunning pipeline\n" | ||
run_pipeline | ||
|
||
echo -e "\nWhen ready, page will be available at $route" | ||
|
||
while true; do | ||
echo "" | ||
echo "The pipeline and first run of the demo app has started. When it has finished, you may rerun (with commits) or quit now." | ||
echo "1. Rerun with Commit" | ||
echo "2. Quit" | ||
read -p "Type 1 or 2: " -n 1 a | ||
echo "" | ||
case $a in | ||
1* ) | ||
echo "We've modified this file, time to build and deploy a new version. Times modified: $counter" | tee -a "$python_example_txt" | ||
git commit -m "modifying python example, number $counter" -- "$python_example_txt" | ||
git push origin "$current_branch" | ||
|
||
run_pipeline | ||
|
||
echo -e "\nWhen ready, page will be available at $route" | ||
|
||
counter=$((counter+1)) | ||
;; | ||
|
||
2* ) exit 0 ;; | ||
* ) echo "I'm not sure what $a means, please give 1 or 2" >&2 ;; | ||
esac | ||
done | ||
|
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,6 +1,7 @@ | ||
#!/bin/bash | ||
#Test oc tool | ||
#Assumes User is logged in to cluster | ||
set -e | ||
|
||
path=$1 | ||
url=$2 | ||
|
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,33 @@ | ||
from http.server import HTTPServer, BaseHTTPRequestHandler | ||
|
||
response_file_bytes = b"" | ||
response_file_txt = "" | ||
|
||
|
||
class ResponseHandler(BaseHTTPRequestHandler): | ||
def do_GET(self): | ||
self.log_message( | ||
f"Got request, returning {response_file_txt} (as bytes {response_file_bytes})" | ||
) | ||
self.send_response(200, "PELORUS IS COOL") | ||
self.send_header("Content-Type", "text/plain") | ||
self.send_header("Content-Length", str(len(response_file_bytes))) | ||
self.end_headers() | ||
|
||
self.wfile.write(response_file_bytes) | ||
|
||
|
||
def main(): | ||
global response_file_txt, response_file_bytes | ||
with open("response.txt", "br") as f: | ||
response_file_bytes = f.read() | ||
response_file_txt = response_file_bytes.decode("utf-8") | ||
print( | ||
f"Loaded response.txt with contents {response_file_txt} (as bytes {response_file_bytes})" | ||
) | ||
server = HTTPServer(("", 8080), ResponseHandler) | ||
server.serve_forever() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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 @@ | ||
Hello world! |
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: operators.coreos.com/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
name: openshift-pipelines-operator | ||
namespace: openshift-operators | ||
spec: | ||
channel: stable | ||
name: openshift-pipelines-operator-rh | ||
source: redhat-operators | ||
sourceNamespace: openshift-marketplace |
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,6 @@ | ||
apiVersion: project.openshift.io/v1 | ||
kind: ProjectRequest | ||
displayName: Basic Python Tekton App | ||
metadata: | ||
name: basic-python-tekton | ||
creationTimestam: null |
Oops, something went wrong.