PHP Hello World Demo page for Red Hat OpenShift S2I using CI/CD (Red Hat OpenShift Pipelines).
-
You have access to an OpenShift Container Platform cluster.
-
You have installed OpenShift Pipelines using the Red Hat OpenShift Pipelines Operator listed in the OpenShift OperatorHub. Once installed, it is applicable to the entire cluster.
-
You have installed OpenShift Pipelines CLI (or use the terminal offered by the
Web Terminal
operator) -
(Optional) You have forked this Git repository using your GitHub ID, and have administrator access to that repository (just for testing the Webhook part)
-
Create the project with the web console or from command line, ex.
s2i
:oc new-project s2i
-
Deploy the initial app:
-
Using web consle (
+Add
->From Git
) with this repo: https://github.com/josgonza-rh/openshift-s2i-phpWARNING:
Name
is crucial here. You must set it to as hello-world as you can see in the sreenshot. If you want to change theName
to another value, you should change thedeployment-name
value in for the TriggerTemplate. -
From command line:
oc new-app php:7.4~https://github.com/josgonza-rh/openshift-s2i-php --name=hello-world
-
-
Create Pipeline
-
Running the Pipeline
-
Using web consle (
Pipeline
->Start
) -
From command line:
tkn pipeline start build-and-deploy-hello-world-app -w name=workspace,volumeClaimTemplateFile=https://raw.githubusercontent.com/josgonza-rh/openshift-s2i-php/main/cicd/resources/00-worspaces/hello-world-workspace.yaml -p GIT_REPO=https://github.com/josgonza-rh/openshift-s2i-php --use-param-defaults
NOTE: A
PipelineRun
resource starts a pipeline and ties it to the Git and image resources that should be used for the specific invocation. It automatically creates and starts theTaskRun
resources for each task in the pipeline. -
Triggers enable pipelines to respond to external GitHub events, such as push events and pull requests. After you assemble and start a pipeline for the application, add the TriggerBinding
, TriggerTemplate
, Trigger
, and EventListener
resources to capture the GitHub events.
-
Adding triggers to the pipeline
-
Expose the
EventListener
service as an OpenShift Container Platform route to make it publicly accessible:oc expose svc el-hello-world-app
NOTE: Adding webhooks requires administrative privileges to the repository. If you do not have administrative access to your repository, contact your system administrator for adding webhooks.
-
Get the webhook URL:
echo "URL: $(oc get route el-hello-world-app --template='http://{{.spec.host}}')"
-
Configure webhook manually on your repository: