|
1 | | -#!/bin/sh |
| 1 | +#!/bin/bash |
2 | 2 |
|
3 | 3 | DIR=`dirname $0` |
4 | | -kubectl apply -f https://storage.googleapis.com/tekton-releases/pipeline/previous/v0.59.2/release.yaml |
5 | | -timeout=600 #10 minutes in seconds |
6 | | -endTime=$(( $(date +%s) + timeout )) |
7 | 4 |
|
8 | | -while ! oc get pods -n tekton-pipelines | grep tekton-pipelines-controller | grep "1/1"; do |
9 | | - sleep 1 |
10 | | - if [ $(date +%s) -gt $endTime ]; then |
11 | | - exit 1 |
12 | | - fi |
13 | | -done |
14 | | -while ! oc get pods -n tekton-pipelines | grep tekton-pipelines-webhook | grep "1/1"; do |
15 | | - sleep 1 |
16 | | - if [ $(date +%s) -gt $endTime ]; then |
17 | | - exit 1 |
18 | | - fi |
19 | | -done |
20 | | -#we need to make sure the tekton webhook has its rules installed |
21 | | -kubectl wait --for=jsonpath='{.webhooks[0].rules}' --timeout=300s mutatingwebhookconfigurations.admissionregistration.k8s.io webhook.pipeline.tekton.dev |
22 | | -echo "Tekton controller is running" |
23 | | - |
24 | | -#CRDS are sometimes racey |
25 | | -kubectl apply -k $DIR/crds/base |
26 | | -## Up to commit https://github.com/openshift/api/commit/60b796dbf3a2d90b6960bb04585a9f9289b0ca1f the flie has been changed, renamed and finally moved |
27 | | -## kubectl apply -f https://raw.githubusercontent.com/openshift/api/master/quota/v1/0000_03_quota-openshift_01_clusterresourcequota.crd.yaml |
28 | | -kubectl apply -f https://raw.githubusercontent.com/openshift/api/master/quota/v1/zz_generated.crd-manifests/0000_03_config-operator_01_clusterresourcequotas.crd.yaml |
29 | | -sleep 2 |
30 | | - |
31 | | -kubectl delete --ignore-not-found deployments.apps hacbs-jvm-operator -n jvm-build-service |
32 | | -kubectl delete --ignore-not-found deployments.apps jvm-build-workspace-artifact-cache |
33 | | - |
34 | | -echo "Using QUAY_USERNAME: $QUAY_USERNAME" |
35 | | -echo "Using JBS_WORKER_NAMESPACE: $JBS_WORKER_NAMESPACE" |
36 | | -export JBS_QUAY_IMAGE=$QUAY_USERNAME |
37 | | -export JVM_BUILD_SERVICE_IMAGE=quay.io/$QUAY_USERNAME/hacbs-jvm-controller |
38 | | -# Represents an empty dockerconfig.json |
39 | | -if [ -z "$JBS_BUILD_IMAGE_SECRET" ]; then |
40 | | - export JBS_BUILD_IMAGE_SECRET="ewogICAgImF1dGhzIjogewogICAgfQp9Cg==" # notsecret |
| 5 | +# DEV_IP is only set in .github/workflows/minikube.yaml and only used in CI |
| 6 | +if [ -n "$DEV_IP" ]; then |
| 7 | + echo "Altering templates to never pull images" |
| 8 | + #huge hack to deal with minikube local images, make sure they are never pulled |
| 9 | + find $DIR -path \*dev-template\*.yaml -exec sed -i s/Always/Never/ {} \; |
41 | 10 | fi |
42 | | -export JBS_S3_SYNC_ENABLED="\"false\"" |
43 | | -export JBS_CONTAINER_BUILDS=false |
44 | | -export JBS_MAX_MEMORY=4096 |
45 | | - |
46 | | -cat $DIR/base/namespace/namespace.yaml | envsubst '${JBS_WORKER_NAMESPACE}' | kubectl apply -f - |
47 | | -kubectl config set-context --current --namespace=${JBS_WORKER_NAMESPACE} |
48 | 11 |
|
49 | | -#huge hack to deal with minikube local images, make sure they are never pulled |
50 | | -find $DIR -path \*dev-template\*.yaml -exec sed -i s/Always/Never/ {} \; |
51 | | - |
52 | | -kustomize build $DIR/overlays/dev-template | envsubst ' |
53 | | -${AWS_ACCESS_KEY_ID} |
54 | | -${AWS_PROFILE} |
55 | | -${AWS_SECRET_ACCESS_KEY} |
56 | | -${GIT_DEPLOY_IDENTITY} |
57 | | -${GIT_DEPLOY_TOKEN} |
58 | | -${GIT_DEPLOY_URL} |
59 | | -${GIT_DISABLE_SSL_VERIFICATION} |
60 | | -${JBS_BUILD_IMAGE_SECRET} |
61 | | -${JBS_CONTAINER_BUILDS} |
62 | | -${JBS_GIT_CREDENTIALS} |
63 | | -${JBS_QUAY_IMAGE} |
64 | | -${JBS_MAX_MEMORY} |
65 | | -${JBS_RECIPE_DATABASE} |
66 | | -${JBS_S3_SYNC_ENABLED} |
67 | | -${JBS_WORKER_NAMESPACE} |
68 | | -${MAVEN_PASSWORD} |
69 | | -${MAVEN_REPOSITORY} |
70 | | -${MAVEN_USERNAME} |
71 | | -${QUAY_USERNAME}' \ |
72 | | - | kubectl apply -f - |
73 | | - |
74 | | -echo "Completed overlays" |
75 | | -#this tells JBS we are in test mode and won't have a secure registry |
76 | | -kubectl annotate --overwrite jbsconfigs.jvmbuildservice.io --all jvmbuildservice.io/test-registry=true |
| 12 | +$DIR/minikube-development.sh --clean |
77 | 13 |
|
78 | 14 | # Deleting the jvm-build-config as its created with different settings in util.go::setupMinikube |
79 | 15 | kubectl delete --ignore-not-found=true jbsconfigs.jvmbuildservice.io jvm-build-config |
80 | | -# Following are created in code |
81 | | -kubectl delete --ignore-not-found=true tasks.tekton.dev git-clone |
82 | | -kubectl delete --ignore-not-found=true tasks.tekton.dev maven |
83 | | -kubectl delete --ignore-not-found=true pipelines.tekton.dev sample-component-build |
84 | | -kubectl delete --ignore-not-found=true clusterrolebindings.rbac.authorization.k8s.io pipeline-test-jvm-namespace |
85 | | -kubectl delete --ignore-not-found=true artifactbuilds.jvmbuildservice.io --all |
86 | 16 |
|
87 | | -cat $DIR/minikube-rbac.yaml | envsubst '${JBS_WORKER_NAMESPACE}' | kubectl apply -f - |
88 | | - |
89 | | -#revert hack above to avoid edits in place |
90 | | -find $DIR -path \*dev-template\*.yaml -exec sed -i s/Never/Always/ {} \; |
| 17 | +# Revert hack above to avoid edits in place |
| 18 | +if [ -n "$DEV_IP" ]; then |
| 19 | + find $DIR -path \*dev-template\*.yaml -exec sed -i s/Never/Always/ {} \; |
| 20 | +fi |
0 commit comments