Skip to content

Commit

Permalink
adjust for public repo
Browse files Browse the repository at this point in the history
  • Loading branch information
syan-tibco committed Jun 5, 2024
1 parent 054314d commit fd7f49b
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 55 deletions.
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,9 @@ The `platform-provisioner.sh` script will create a Docker container and run the
### Run the Platform Provisioner

Go to the directory where you save the recipe and run the following command.
We need to set `GITHUB_TOKEN` to access the pipeline private repo
```bash
export GITHUB_TOKEN=""
export PIPELINE_INPUT_RECIPE=""
export PIPELINE_CHART_REPO="${GITHUB_TOKEN}@raw.githubusercontent.com/tibco/platform-provisioner/gh-pages/"
/bin/bash -c "$(curl -fsSL https://${GITHUB_TOKEN}@raw.githubusercontent.com/tibco/platform-provisioner/main/dev/platform-provisioner.sh)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/TIBCOSoftware/platform-provisioner/main/dev/platform-provisioner.sh)"
```

## Run the Platform Provisioner in headless mode with the Tekton pipeline
Expand All @@ -59,10 +56,8 @@ In this case, the recipe and pipeline will be scheduled by Tekton and run in the

#### Install Tekton with Tekton dashboard
```bash
export GITHUB_TOKEN=""
export PIPELINE_SKIP_TEKTON_DASHBOARD=false
export PLATFORM_PROVISIONER_PIPLINE_REPO="https://${GITHUB_TOKEN}@raw.githubusercontent.com/tibco/platform-provisioner/gh-pages/"
/bin/bash -c "$(curl -fsSL https://${GITHUB_TOKEN}@raw.githubusercontent.com/tibco/platform-provisioner/main/dev/platform-provisioner-install.sh)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/TIBCOSoftware/platform-provisioner/main/dev/platform-provisioner-install.sh)"
```

After the installation, you can run the following command to port-forward the Tekton dashboard to local machine.
Expand All @@ -76,9 +71,8 @@ We can now access Tekton provided dashboard: http://localhost:8080

Go to the directory where you save the recipe and run the following command
```bash
export GITHUB_TOKEN=""
export PIPELINE_INPUT_RECIPE="<path to recipe>"
/bin/bash -c "$(curl -fsSL https://${GITHUB_TOKEN}@raw.githubusercontent.com/tibco/platform-provisioner/main/dev/platform-provisioner-pipelinerun.sh)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/TIBCOSoftware/platform-provisioner/main/dev/platform-provisioner-pipelinerun.sh)"
```

You will be able to see the running pipelinerun on Tekton Dashboard by clicking the PipelineRuns on the left.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ recipe: |
DP_NAMESPACE: "${GUI_DP_NAMESPACE}"
DP_CONFIG_AWS_VERSION: ${GUI_DP_CONFIG_AWS_VERSION}
GITHUB_TOKEN: ${GITHUB_TOKEN:-$(cat /tmp/secret-github/GITHUB_TOKEN)} # You need to set GITHUB_TOKEN for local use. For pipeline, it will be set by pipeline
DP_CHART_REPO: https://${GITHUB_TOKEN}@raw.githubusercontent.com/tibco/tp-helm-charts/gh-pages
DP_CHART_REPO: https://tibcosoftware.github.io/tp-helm-charts
tools:
yq: "4.40"
helm: "3.13"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

pipelineName: "Deploy Elasticsearch (dp-config-es)"
description: "This will deploy or upgrade ES and ES index templates. Chart: <a href='https://github.com/tibco/tp-helm-charts/tree/main/charts/dp-config-es' target='_blank'>link</a>"
description: "This will deploy or upgrade ES and ES index templates. Chart: <a href='https://github.com/TIBCOSoftware/tp-helm-charts/tree/main/charts/dp-config-es' target='_blank'>link</a>"
options:
- name: "GUI_DP_PUBLIC_DOMAIN"
type: string
Expand All @@ -24,7 +24,7 @@ options:
guiType: input
reference: "meta.guiEnv.GUI_DP_CONFIG_CHART_VERSION"
required: true
description: "The version of dp-config-es helm chart. see: <a href='https://github.com/tibco/tp-helm-charts/tree/gh-pages' target='_blank'>link</a>"
description: "The version of dp-config-es helm chart. see: <a href='https://github.com/TIBCOSoftware/tp-helm-charts/tree/gh-pages' target='_blank'>link</a>"
- name: "GUI_DP_CONFIG_ES_VERSION"
type: string
guiType: input
Expand Down Expand Up @@ -104,7 +104,7 @@ recipe: |
DP_ECK_VERSION: "${GUI_DP_ECK_VERSION}"
DP_ES_RELEASE_NAME: dp-config-es
GITHUB_TOKEN: "${GUI_GITHUB_TOKEN}"
DP_CHART_REPO: https://${GUI_GITHUB_TOKEN}@raw.githubusercontent.com/tibco/tp-helm-charts/gh-pages
DP_CHART_REPO: https://tibcosoftware.github.io/tp-helm-charts
tools:
yq: "4.40"
helm: "3.13"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ meta:
# GitHub credentials
GITHUB_TOKEN: "${GUI_GITHUB_TOKEN}" # You need to set GITHUB_TOKEN for local use. For pipeline, it will be set by pipeline
GITHUB_USER_NAME: ${GUI_GITHUB_USER_NAME:-"cp-test"}
CP_CHART_REPO: https://${GITHUB_TOKEN}@raw.githubusercontent.com/tibco/tp-helm-charts/gh-pages
CP_CHART_REPO: https://tibcosoftware.github.io/tp-helm-charts
# env
CP_INSTANCE_ID: ${GUI_CP_INSTANCE_ID:-"cp1"}
CP_PROVIDER: local # deployment target. Example: aws, azure, local.
Expand Down Expand Up @@ -346,7 +346,7 @@ helmCharts:
auth:
password: ${GITHUB_TOKEN}
username: ${GITHUB_USER_NAME}
repoUrl: https://raw.githubusercontent.com/tibco/tp-helm-charts/gh-pages
repoUrl: https://tibcosoftware.github.io/tp-helm-charts
default: true
type: chart-museum
dpMetadata:
Expand Down
58 changes: 31 additions & 27 deletions dev/platform-provisioner-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@
# PIPELINE_DOCKER_IMAGE: the docker image for the pipeline
# PIPELINE_SKIP_PROVISIONER_UI: true or other string if true, will skip installing platform-provisioner GUI
# PIPELINE_SKIP_TEKTON_DASHBOARD: true or other string if true, will skip installing tekton dashboard
# GITHUB_TOKEN: the token to access github that all pipeline can share
# Arguments:
# None
# Returns:
# 0 if thing was deleted, non-zero on error
# Notes:
# None
# By default without any input, it will install tekton, common-dependency, generic-runner, helm-install pipelines
# If we want to add tekton official dashboard, we can set PIPELINE_SKIP_TEKTON_DASHBOARD to false
# If we want to add platform-provisioner GUI, we need to set PIPLINE_GUI_DOCKER_IMAGE_REPO, PIPLINE_GUI_DOCKER_IMAGE_USERNAME, PIPLINE_GUI_DOCKER_IMAGE_TOKEN
# and set PIPELINE_SKIP_PROVISIONER_UI to false to install provisioner GUI
# Samples:
# export PIPLINE_GUI_DOCKER_IMAGE_TOKEN="your-ecr-token"
# export PIPLINE_GUI_DOCKER_IMAGE_REPO="your-ecr-repo"
Expand Down Expand Up @@ -66,38 +70,35 @@ fi

kubectl create namespace tekton-tasks

fucntion k8s-waitfor-deployment() {
_DEPLOYMENT_NAME=$1
_TIMEOUT=$2
kubectl wait --for=condition=available -n tekton-pipelines "deployment/${_DEPLOYMENT_NAME}" --timeout=${_TIMEOUT}
if [ $? -ne 0 ]; then
echo "Timeout: Deployment '${_DEPLOYMENT_NAME}' did not become available within ${_TIMEOUT}."
exit 1
else
echo "Deployment '${_DEPLOYMENT_NAME}' is now ready."
fi
}

echo "waiting for tekton controller to be ready..."
_DEPLOYMENT_NAME="tekton-pipelines-controller"
_TIMEOUT="120s"
kubectl wait --for=condition=available -n tekton-pipelines "deployment/${_DEPLOYMENT_NAME}" --timeout=${_TIMEOUT}
if [ $? -ne 0 ]; then
echo "Timeout: Deployment '${_DEPLOYMENT_NAME}' did not become available within ${_TIMEOUT}."
exit 1
else
echo "Deployment '${_DEPLOYMENT_NAME}' is now ready."
fi
k8s-waitfor-deployment "tekton-pipelines-controller" "120s"

echo "waiting for tekton webhook to be ready..."
_DEPLOYMENT_NAME="tekton-pipelines-webhook"
_TIMEOUT="120s"
kubectl wait --for=condition=available -n tekton-pipelines "deployment/${_DEPLOYMENT_NAME}" --timeout=${_TIMEOUT}
if [ $? -ne 0 ]; then
echo "Timeout: Deployment '${_DEPLOYMENT_NAME}' did not become available within ${_TIMEOUT}."
exit 1
else
echo "Deployment '${_DEPLOYMENT_NAME}' is now ready."
fi
k8s-waitfor-deployment "tekton-pipelines-webhook" "120s"

# create service account for this pipeline
kubectl create -n tekton-tasks serviceaccount pipeline-cluster-admin
kubectl create clusterrolebinding pipeline-cluster-admin --clusterrole=cluster-admin --serviceaccount=tekton-tasks:pipeline-cluster-admin

export PLATFORM_PROVISIONER_PIPLINE_REPO=${PLATFORM_PROVISIONER_PIPLINE_REPO:-"https://tibcosoftware.github.io/platform-provisioner"}
export PLATFORM_PROVISIONER_PIPLINE_REPO=${PLATFORM_PROVISIONER_PIPLINE_REPO:-"tibcosoftware.github.io/platform-provisioner"}
export PIPLINE_NAMESPACE=${PIPLINE_NAMESPACE:-"tekton-tasks"}

# install a sample pipeline with docker image that can run locally
helm upgrade --install -n "${PIPLINE_NAMESPACE}" common-dependency common-dependency \
--version ^1.0.0 --repo "${PLATFORM_PROVISIONER_PIPLINE_REPO}"
--version ^1.0.0 --repo "${PLATFORM_PROVISIONER_PIPLINE_REPO}" \
--set githubToken="${GITHUB_TOKEN}"
if [[ $? -ne 0 ]]; then
echo "failed to install common-dependency"
exit 1
Expand All @@ -121,6 +122,12 @@ if [[ $? -ne 0 ]]; then
exit 1
fi

# create secret for pulling images from ECR
if [[ ${PIPELINE_SKIP_PROVISIONER_UI} == "true" ]]; then
echo "### skip installing platform-provisioner GUI"
exit 0
fi

# install provisioner config
helm upgrade --install -n "${PIPLINE_NAMESPACE}" provisioner-config-local provisioner-config-local \
--version ^1.0.0 --repo "${PLATFORM_PROVISIONER_PIPLINE_REPO}"
Expand All @@ -129,12 +136,6 @@ if [[ $? -ne 0 ]]; then
exit 1
fi

# create secret for pulling images from ECR
if [[ ${PIPELINE_SKIP_PROVISIONER_UI} == "true" ]]; then
echo "### skip installing platform-provisioner GUI"
exit 0
fi

_image_pull_secret_name="platform-provisioner-ui-image-pull"
if kubectl get secret -n "${PIPLINE_NAMESPACE}" ${_image_pull_secret_name} > /dev/null 2>&1; then
kubectl delete secret -n "${PIPLINE_NAMESPACE}" ${_image_pull_secret_name}
Expand All @@ -161,3 +162,6 @@ if [[ $? -ne 0 ]]; then
echo "failed to install platform-provisioner-ui"
exit 1
fi

echo "waiting for platform-provisioner-ui to be ready..."
k8s-waitfor-deployment "platform-provisioner-ui" "120s"
2 changes: 1 addition & 1 deletion dev/platform-provisioner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ set +x

# pipeline image
[[ -z "${PIPELINE_DOCKER_IMAGE}" ]] && export PIPELINE_DOCKER_IMAGE=${PIPELINE_DOCKER_IMAGE:-"syantibco/platform-provisioner:latest"}
[[ -z "${PIPELINE_CHART_REPO}" ]] && export PIPELINE_CHART_REPO="TIBCOSoftware.github.io/platform-provisioner/"
[[ -z "${PIPELINE_CHART_REPO}" ]] && export PIPELINE_CHART_REPO="tibcosoftware.github.io/platform-provisioner"

# we need to set REGION, otherwise the INPUT will not be loaded
[[ -z "${ACCOUNT}" ]] && export ACCOUNT="on-prem"
Expand Down
4 changes: 2 additions & 2 deletions docs/recipes/controlplane/tp-cp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ meta:
# GitHub credentials
GITHUB_TOKEN: "" # You need to set GITHUB_TOKEN for local use. For pipeline, it will be set by pipeline
GITHUB_USER_NAME: ${GUI_GITHUB_USER_NAME:-"cp-test"}
CP_CHART_REPO: https://${GITHUB_TOKEN}@raw.githubusercontent.com/tibco/tp-helm-charts/gh-pages
CP_CHART_REPO: https://tibcosoftware.github.io/tp-helm-charts
# env
CP_INSTANCE_ID: ${GUI_CP_INSTANCE_ID:-"cp1"}
CP_PROVIDER: local # deployment target. Example: aws, azure, local.
Expand Down Expand Up @@ -331,7 +331,7 @@ helmCharts:
auth:
password: ${GITHUB_TOKEN}
username: ${GITHUB_USER_NAME}
repoUrl: https://raw.githubusercontent.com/tibco/tp-helm-charts/gh-pages
repoUrl: https://tibcosoftware.github.io/tp-helm-charts
default: true
type: chart-museum
dpMetadata:
Expand Down
8 changes: 4 additions & 4 deletions docs/recipes/k8s/cloud/deploy-tp-aks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ meta:
PIPELINE_CHECK_DOCKER_STATUS: false
# github
GITHUB_TOKEN: ${GUI_GITHUB_TOKEN}
TP_CHART_REPO: https://${GITHUB_TOKEN}@raw.githubusercontent.com/tibco/tp-helm-charts/gh-pages
TP_CHART_REPO: https://tibcosoftware.github.io/tp-helm-charts
# cluster
TP_CLUSTER_NAME: ${GUI_TP_CLUSTER_NAME}
CLUSTER_NAME: ${TP_CLUSTER_NAME} # pipeline aks internal variable
Expand Down Expand Up @@ -68,7 +68,7 @@ preTasks:
repo:
git:
github:
repo: github.com/tibco/platform-provisioner
repo: github.com/TIBCOSoftware/platform-provisioner
path: docs/recipes/k8s/cloud/scripts/aks
branch: ${TP_SCRIPT_BRANCH}
script:
Expand All @@ -78,7 +78,7 @@ preTasks:
repo:
git:
github:
repo: github.com/tibco/platform-provisioner
repo: github.com/TIBCOSoftware/platform-provisioner
path: docs/recipes/k8s/cloud/scripts/aks
branch: ${TP_SCRIPT_BRANCH}
script:
Expand All @@ -98,7 +98,7 @@ preTasks:
repo:
git:
github:
repo: github.com/tibco/platform-provisioner
repo: github.com/TIBCOSoftware/platform-provisioner
path: docs/recipes/k8s/cloud/scripts/aks
branch: ${TP_SCRIPT_BRANCH}
script:
Expand Down
6 changes: 3 additions & 3 deletions docs/recipes/k8s/cloud/deploy-tp-eks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ meta:
PIPELINE_CHECK_DOCKER_STATUS: false
# github
GITHUB_TOKEN: ${GUI_GITHUB_TOKEN}
TP_CHART_REPO: https://${GITHUB_TOKEN}@raw.githubusercontent.com/tibco/tp-helm-charts/gh-pages
TP_CHART_REPO: https://tibcosoftware.github.io/tp-helm-charts
# cluster
TP_CLUSTER_NAME: ${GUI_TP_CLUSTER_NAME}
TP_CLUSTER_VERSION: ${GUI_TP_CLUSTER_VERSION:-1.29}
Expand Down Expand Up @@ -60,7 +60,7 @@ preTasks:
repo:
git:
github:
repo: github.com/tibco/platform-provisioner
repo: github.com/TIBCOSoftware/platform-provisioner
path: docs/recipes/k8s/cloud/scripts/eks
branch: ${TP_SCRIPT_BRANCH}
script:
Expand All @@ -72,7 +72,7 @@ preTasks:
repo:
git:
github:
repo: github.com/tibco/platform-provisioner
repo: github.com/TIBCOSoftware/platform-provisioner
path: docs/recipes/k8s/cloud/scripts/eks
branch: ${TP_SCRIPT_BRANCH}
script:
Expand Down
2 changes: 1 addition & 1 deletion docs/recipes/k8s/on-prem/kind.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ kind delete cluster -n tp

## Prepare TIBCO Platform for kind

After setting up [Platform Provisioner Prerequisite](https://github.com/tibco/platform-provisioner?tab=readme-ov-file#install-tekton-with-tekton-dashboard);
After setting up [Platform Provisioner Prerequisite](https://github.com/TIBCOSoftware/platform-provisioner?tab=readme-ov-file#install-tekton-with-tekton-dashboard);
we have Platform Provisioner installed in minikube.

Now we can run the following command under the project root to install third party tools for CP on minikube:
Expand Down
2 changes: 1 addition & 1 deletion docs/recipes/k8s/on-prem/microk8s.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export KUBECONFIG=~/.kube/microk8s.yaml

## Prepare TIBCO Platform for MicroK8s

After setting up [Platform Provisioner Prerequisite](https://github.com/tibco/platform-provisioner?tab=readme-ov-file#install-tekton-with-tekton-dashboard);
After setting up [Platform Provisioner Prerequisite](https://github.com/TIBCOSoftware/platform-provisioner?tab=readme-ov-file#install-tekton-with-tekton-dashboard);
we have Platform Provisioner installed in MicroK8s.

Now we can run the following command under the project root to install third party tools for CP on MicroK8s:
Expand Down
2 changes: 1 addition & 1 deletion docs/recipes/k8s/on-prem/minikube.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ After all these steps; we should have a minikube cluster ready to install CP. We

## Prepare TIBCO Platform for minikube

After setting up [Platform Provisioner Prerequisite](https://github.com/tibco/platform-provisioner?tab=readme-ov-file#install-tekton-with-tekton-dashboard);
After setting up [Platform Provisioner Prerequisite](https://github.com/TIBCOSoftware/platform-provisioner?tab=readme-ov-file#install-tekton-with-tekton-dashboard);
we have Platform Provisioner installed in minikube.

Now we can run the following command under the project root to install third party tools for CP on minikube:
Expand Down

0 comments on commit fd7f49b

Please sign in to comment.