Skip to content

redhat-buildpacks/ubi-image-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Home project of: ubi-image-builder

The goal of this project is to build the builder image using the Java and Node.js Buildpacks released for the Universal Base Image or UBI. This is a first step toward to automate fully the process to release the needed images like the Buildpacks and/or extensions. To achieve this goal, it will be needed to transpose the existing GitHub workflows created by the Paketo community to different Tekton pipelines.

More information around the building mechanisms designed by Paketo are documented here

Some flows are available from the following projects:

Pre-requisites

To access remotely to the RHTAP AppStudio cluster, add first to your kubecfg config file the cluster URL, context and OIDC's user using the following bash script: ./appstudio_kubeconfig rh-buildpacks

NOTE: More information to log in to the cluster using OIDC is available here

Instructions

During the development of this project, you can either use a local kind cluster where Tekton has been deployed or use directly the AppStudio cluster.

NOTE: Some hacks will be needed ss some differences exist between the RHTAP Pipeline(Run) definition and the pack-builder-image.yml for local tests

Local tekton

To create a cluster and install Tekton, execute the following commands:

curl -s -L "https://raw.githubusercontent.com/snowdrop/k8s-infra/main/kind/kind.sh" | bash -s install --delete-kind-cluster                                   
curl -s -L "https://raw.githubusercontent.com/snowdrop/k8s-infra/main/kind/registry.sh" | bash -s install --registry-name kind-registry.local

kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
kubectl wait deployment -n tekton-pipelines tekton-pipelines-controller --for condition=Available=True --timeout=90s
kubectl wait deployment -n tekton-pipelines tekton-pipelines-webhookubectl --for condition=Available=True --timeout=90s

kubectl apply -f https://storage.googleapis.com/tekton-releases/dashboard/latest/release.yaml
VM_IP=127.0.0.1                                                                                                       
kubectl create ingress tekton-ui -n tekton-pipelines --class=nginx --rule="tekton-ui.$VM_IP.nip.io/*=tekton-dashboard:9097"

echo "Disabling the affinity-assistant to avoid the error: more than one PersistentVolumeClaim is bound to a TaskRun = pod"
kubectl patch cm feature-flags -n tekton-pipelines -p '{"data":{"disable-affinity-assistant":"true"}}'

Install the Pipeline, tasks and resources

Remark: To write the ubi builder image to a registry (quay.io, etc) , it is needed to create a secret including your credentials

kubectl create secret docker-registry quay-creds \
  --docker-username="<REGISTRY_USERNAME>" \
  --docker-password="<REGISTRY_PASSWORD>" \
  --docker-server="quay.io"

When done, you can install the yaml resources like the ubi pack builder pipeline:

kubectl delete -R -f tekton
kubectl apply -R -f tekton
tkn pipelinerun logs pack-build-builder-push-run -f

Test if the ubi builder image created is working

mvn io.quarkus.platform:quarkus-maven-plugin:3.12.2:create \
  -DprojectGroupId=dev.snowdrop \
  -DprojectArtifactId=quarkus-hello \
  -DprojectVersion=1.0 \
  -Dextensions='resteasy,kubernetes,buildpack'

cd quarkus-hello

REGISTRY_HOST="kind-registry.local:5000"
docker pull quay.io/snowdrop/ubi-builder:latest
pack build ${REGISTRY_HOST}/quarkus-hello:1.0 \
     --builder quay.io/snowdrop/ubi-builder \
     --volume $HOME/.m2:/home/cnb/.m2:rw \
     --env BP_JVM_VERSION=21 \
     --path .  
docker run -i --rm -p 8080:8080 kind-registry.local:5000/quarkus-hello:1.0
curl localhost:8080/hello # in a separate terminal

Tips

To convert the GitHub flows into bash scripts, use this export-to-bash project and the command

GIT_DIR=$(pwd)
pushd /path/to/export-github-flows/
./scripts/export-jobs.sh $GIT_DIR/github/paketo-builder-flow.yaml > $GIT_DIR/github/paketo-builder-push-bash.txt
popd

New build: 6 !

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages