Tekton with IBM Cloud Object Storage for Static Website

Ong Khai Wei
3 min readApr 10, 2022

--

Recently I was working on building a React application for internal usage. React application will be compiled as static file and being deployed into IBM Cloud Object Storage with static web hosting (https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-static-website-options). However, it is troublesome to manually remove all the contents in the bucket and upload the build, every time I make changes and I should automate it with CICD using IBM Cloud Continuous Delivery.

To create the Pipeline, can follow the steps in this documentation. For static web hosting, 2 steps will be needed: Repositories and Delivery Pipeline, pipeline type — Tekton.

Delivery Pipeline with Repository and Delivery pipeline (Tekton)

In Delivery Pipeline, there are a few configurations to take note:

Step 1: Definitions

Add a Tekton definition repository. By default definition repository will branch and path that contains Tekton yaml file.

Add Definition Repository

Once Definition Repository is added, press Validate button to identify errors and warnings that may cause problems for pipeline runs and press Save button to save the configuration.

Validate tekton definitions

Step 2: Worker

Add Delivery Pipeline worker, for this example I choose IBM Managed workers.

IBM Managed workers

Step 3: Triggers

Add Trigger. Trigger defines when the pipeline runs is being executed.

In Trigger definition, there are few important properties to define.

Add Trigger

AWS CLI with Docker will be used in Tekton Task to delete all the contents and upload based on new build. IBM Cloud Object Storage supports S3 protocol and AWS CLI by creating a HMAC credential.

  • repository: Git repository URL
  • revision: Branch name, default is main
  • aws-access-key-id: IBM Cloud Object Storage Credential HMAC — Access Key ID
  • aws-secret-access-key: IBM Cloud Object Storage Credential HMAC — Secret Access Key
  • aws-default-region: IBM Cloud Object Storage region
  • endpoint-url: IBM Cloud Object Storage endpoint URL
  • name: s3-bucket: IBM Cloud Object Storage bucket name
Properties of Add Trigger

Step 4: Run Pipeline

Pipeline can be triggered by commit of git repo or Manual. IBM Continuous Delivery will be executed based on Tekton yaml file.

Pipeline execution log

The sample Tekton definition is available at github — https://github.com/ongkhaiwei/tekton_icos

--

--