DevSecOps and Automation on Power

 View Only

Cross-building ppc64le containers on remote VM using Tekton Pipeline

By Mayur Waghmode posted Tue September 27, 2022 11:00 AM

  

Tekton pipeline setup

  • An x86_64 Openshift cluster with version 4.9 or above
  • Enable Role-Based Access Control (RBAC) in the clusters.
  • Grant cluster-admin role to the current user on the cluster
oc login -u kubeadmin -p <kubepassword>
oc new-project tekton-pipelines
  1. Log into your cluster’s OpenShift Console with cluster-admin privileges
  2. Use the left-hand menu to navigate to Operators
  3. In the Operators, submenu click on OperatorHub
  4. Use the Filter/Search box to filter on OpenShift Pipelines
  5. Click the Red Hat OpenShift Pipelines tile
  6. In the flyout menu to the right-click the Install button near the top
  7. On the next screen “Install Operator” scroll to the bottom of the page and click Install
rpm -Uvh https://github.com/tektoncd/cli/releases/download/v0.26.0/tektoncd-cli-0.26.0_Linux-64bit.rpm
tkn version
oc apply -f https://github.com/tektoncd/dashboard/releases/download/v0.29.1/tekton-dashboard-release.yaml
oc get pods --namespace tekton-pipelines --watch
oc create route edge tekton-dashboard --service=tekton-dashboard --port=http --insecure-policy=Redirect -n tekton-pipelines
oc get pods --namespace tekton-pipelines --watch
NAME READY STATUS RESTARTS AGE
tekton-dashboard-545b99657d-xnmz7 1/1 Running 0 5d
oc get route

Build the Tekton pipeline

Step 1: Generate SSH key

cd ~/.sshssh-keygen -o -t rsa

Step 2: Add public ssh key to the authorized_keys file of the remote x86 VM

cat ~/.ssh/id_rsa.pub
vi ~/.ssh/authorized_keys

Step 3: Test SSH connection using the private key

ssh -i /root/.ssh/id_rsa username@hostname

Step 4. Clone the source code

git clone https://github.com/mayurwaghmode/Cross-Building-using-Tekton.git
cd Cross-Building-using-Tekton

Step 5. Configure the source code

Create the Secrets from the config/secrets.yaml file

cat ~/.ssh/id_rsa | base64 -w 0
oc create -f config/secrets.yaml

Create a TaskRun for remote ssh logging into the x86_64 machine

Parameters

  • HOST: The remote host to which you want to connect. (Required)
  • USERNAME: Connect as a user. (Required)
  • PORT: Port number to connect (default: 22).
  • SSH_SCRIPT: The shell script which you want to run on the remote host. (Required)

Setup quay repository with proper account permissions

Apply the Tasks and TaskRuns

oc apply -f task/
oc apply -f taskrun.yaml
tkn taskrun logs -f
podman run quay.io/Quay-User-Name/Quay-Repository-Name

Troubleshooting

container exited on segmentation fault
error building at STEP "RUN apt-get update -y": error while running runtime: exit status 1

Permalink