/jvm-build-service

System for rebuilding Java dependencies from source

Primary LanguageJava

Build Status Badge

HACBS JVM Build Service

This repository contains components used to deploy the HACBS JVM build service.

See each component’s directory for specific documentation.

KCP setup in anticipation of workspace resource controller

Working out of your clone of this repository, you have two paths for initializing everything to try and run a test build againast a KCP enabled environment.

Specifically for our make dev based developer flow:

  • continue to set QUAY_USERNAME, QUAY_E2E_ORGANIZATION and QUAY_TOKEN like we currently do in our developer flow.

  • admittedly, QUAY_USERNAME and QUAY_E2E_ORGANIZAION may be the same in the developer flow i.e. your personal quay repository

  • also set QUAY_TAG to dev

  • image references will become quay.io/$QUAY_USERNAME/hacbs-jvm-<controller|cache|build-request-processor>:dev

Specifically testing against levels of the quay.io/redhat-appstudio/hacbs-jvm-* images from merged PRs:

  • either unset QUAY_USERNAME or set it to redhat-appstudio

  • set QUAY_TAG to the specific image/commit sha you want to test against

  • leave QUAY_E2E_ORGANIZATION and QUAY_TOKEN the same, pointing to your personal quay repo, so that the artifact cache can still push its updates

  • image references will become quay.io/redhat-appstudio/hacbs-jvm-<controller|cache|build-request-processor>:$QUAY_TAG

Common steps regardless of using developer images you build yourself or official quay.io/redhat-appstudio images:

  • artifact cache images will be pushed to quay.io/$QUAY_E2E_ORGANIZATION/…​. using QUAY_TOKEN to authenticate on the push

  • download helm via curl -L https://mirror.openshift.com/pub/openshift-v4/clients/helm/latest/helm-linux-amd64 -o /usr/local/bin/helm

  • mimic the setting of CLUSTER_KUBECONFIG and KCP_KUBECONFIG as you have them set in your infra-deployments preview.env file

  • from KCP, enter the hacbs workspace in the infra-deployments bootstrapped env, i.e. oc ws hacbs

  • from KCP, create a test namespace i.e. oc create ns jvm-bld-test

  • from KCP, enter that new test namespace i.e. oc project jvm-bld-test or kubectl config set-context --current --namespace=jvm-bld-test

  • run ./deploy/init-hacbs-user-workspace-sa-rbac.sh out of your clone of this repo against your compute/workload cluster where you have set HACBS_WORKSPACE_NAMESPACE to your KCP test namesapce i.e. jvm-build-test

  • run ./deploy/init-hacbs-user-workspace.sh out of your clone of this repo to initialize you KCP test namespace with the artifact cache and Tasks needed to run our test Pipelines and PipelineRuns

  • then go to ./hack/examples and pick which Pipeline and PipelineRun test to run.

Testing

Test JVM Build Service on an OpenShift cluster

The OpenShift E2E test is programmed to run a test with following steps:

  1. Create a new project in targeted OpenShift cluster and run the build pipeline which contains a Maven task from this repo to build the simple java test project

  2. Make sure the pipeline succeeds and all related artifactbuilds and dependecybuilds (triggered after pipeline completion) finish successfully

  3. Check that all "contaminated" builds are resolved

  4. Verify that triggering a second build accesses dependencies that are cached from a previous build

  5. Verify that the correct JDK version is identified in dependencybuilds

  6. Check that maven/gradle logs/sources are found in rebuilt artifacts

Before running the test, you need to export couple of env vars that reference container images for the operator, cache and reqprocessor. Some existing images can be found at redhat-appstudio quay.io org (search for keyword "jvm")

Also you need to specify your quay.io username that will be used for pushing rebuilt dependencies in a format: quay.io/$QUAY_USERNAME/test-images. Make sure the repo "test-images" exists in your account and is publicly available.

export QUAY_USERNAME=<your-quay-io-account-username>
export JVM_BUILD_SERVICE_IMAGE=
export JVM_BUILD_SERVICE_CACHE_IMAGE=
export JVM_BUILD_SERVICE_REQPROCESSOR_IMAGE=
./deploy/openshift-ci.sh
make openshift-e2e