Skip to content

majoferenc/ocp-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OCP Tekton Demo Test App

Prerequisites

References

Prepare local Env (CRC)

In your shell:

  crc setup
  crc start --memory 16000 --disk-size 50 --cpus 8

Create OCP project

In your shell:

oc new-project tekton-demo

https://github.com/tektoncd/catalog/tree/main/task/buildah

Install Tekton Community Tasks

In your shell:

  tkn hub install task git-clone
  tkn hub install task buildah
  tkn hub install task kaniko
  tkn hub install task openshift-client

If using Helm for deployment:

  tkn hub install task helm-upgrade-from-source

Add Repo to OCP

Create file repo.yaml with content:

  apiVersion: pipelinesascode.tekton.dev/v1alpha1
  kind: Repository
  metadata:
    name: git-ocp-test-git
    namespace: tekton-demo
  spec:
    url: 'https://github.com/majoferenc/ocp-test.git'

Create Container Registry Secret

Set default values for CRC

Bash:

  CRC_REGISTRY_SERVER=default-route-openshift-image-registry.apps-crc.testing
  CRC_USERNAME=kubeadmin
  CRC_PASSWORD=$(oc whoami -t)
  [email protected]
  CRC_SECRET_NAME=docker-credentials

Powershell:

  $CRC_REGISTRY_SERVER = "default-route-openshift-image-registry.apps-crc.testing"
  $CRC_USERNAME = "kubeadmin"
  $CRC_PASSWORD = (oc whoami -t)
  $CRC_EMAIL = "[email protected]"
  $CRC_SECRET_NAME = "docker-credentials"

Create a Docker-registry secret for CRC

Bash:

  oc create secret docker-registry $CRC_SECRET_NAME \
      --docker-server=$CRC_REGISTRY_SERVER \
      --docker-username=$CRC_USERNAME \
      --docker-password=$CRC_PASSWORD \
      --docker-email=$CRC_EMAIL

Powershell:

  oc create secret docker-registry $CRC_SECRET_NAME `
  --docker-server=$CRC_REGISTRY_SERVER `
  --docker-username=$CRC_USERNAME `
  --docker-password=$CRC_PASSWORD `
  --docker-email=$CRC_EMAIL

Link the secret to the default service account in the crc namespace

  oc secrets link default -n tekton-demo $CRC_SECRET_NAME --for=pull

Import needed images

  oc import-image ubi8/openjdk-8:1.18-2 --from=registry.access.redhat.com/ubi8/openjdk-8:1.18-2 --confirm

Allow deployment from tekton pipeline

  oc policy add-role-to-user edit -z default -n tekton-demo

Create Pipeline

  oc apply -f .tekton/pipeline.yaml

Trigger Pipeline Run

  oc create -f .tekton/pipelinerun.yaml

Configure auto trigger after commit in git

  oc apply -f .tekton/push.yaml

Create Default Helm Template

  helm create testapp-chart

Testing Helm Chart by installing it manually

  helm upgrade --install testapp ./helm/testapp-chart/

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published