Advertisement
kmajumder

Untitled

Jul 12th, 2021
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.30 KB | None | 0 0
  1. kmajumde@localhost:git/ocs-osd-deployer ‹master*›$ bash -v tools/deploy-with-olm.sh quay.io/ezio_auditore
  2. #!/bin/bash
  3.  
  4. # enable !! command completion
  5. set -o history -o histexpand
  6.  
  7. source "$(dirname ${0})/colors.sh"
  8. #!/bin/bash
  9.  
  10. BLACK='\033[0;30m' # Black
  11. RED='\033[0;31m' # Red
  12. GREEN='\033[0;32m' # Green
  13. YELLOW='\033[0;33m' # Yellow
  14. BLUE='\033[0;34m' # Blue
  15. PURPLE='\033[0;35m' # Purple
  16. CYAN='\033[0;36m' # Cyan
  17. WHITE='\033[0;37m' # White
  18. NC='\033[0m' # No Color
  19.  
  20. function black {
  21. _colored_echo "${1}" ${BLACK}
  22. }
  23.  
  24. function red {
  25. _colored_echo "${1}" ${RED}
  26. }
  27.  
  28. function green {
  29. _colored_echo "${1}" ${GREEN}
  30. }
  31.  
  32. function yellow {
  33. _colored_echo "${1}" ${YELLOW}
  34. }
  35.  
  36. function blue {
  37. _colored_echo "${1}" ${BLUE}
  38. }
  39.  
  40. function purple {
  41. _colored_echo "${1}" ${PURPLE}
  42. }
  43.  
  44. function cyan {
  45. _colored_echo "${1}" ${CYAN}
  46. }
  47.  
  48. function white {
  49. _colored_echo "${1}" ${WHITE}
  50. }
  51.  
  52. function _colored_echo {
  53. echo -e "${2}${1}${NC}"
  54. }
  55.  
  56. # Allow controlled exit on error
  57. function exit_on_err() {
  58. "$@"
  59. EXIT_CODE=$?
  60. if [ ${EXIT_CODE} -ne 0 ]; then
  61. >&2 echo "\"${@}\" command failed with exit code ${EXIT_CODE}."
  62. exit ${EXIT_CODE}
  63. fi
  64. }
  65.  
  66. # tools definitions
  67. K8S_CLIENT=${K8S_CLIENT:-kubectl}
  68. OP_SDK=${OP_SDK:-operator-sdk}
  69.  
  70. # Bundle definition
  71. IMAGE_REPO=${IMAGE_REPO:-${1}}
  72. if [[ -z ${IMAGE_REPO} ]]; then
  73. red "Error: target repository was not set via a command line argument or the IMAGE_REPO environment variable"
  74. exit 1
  75. fi
  76.  
  77. # Bundle image
  78. BUNDLE_NAME=${BUNDLE_NAME:-ocs-osd-deployer-bundle}
  79. BUNDLE_VERSION=${BUNDLE_VERSION:-latest}
  80. BUNDLE_IMAGE=${BUNDLE_IMAGE:-${IMAGE_REPO}/${BUNDLE_NAME}:${BUNDLE_VERSION}}
  81.  
  82. # Deployer image
  83. DEPLOYER_NAME=${DEPLOYER_NAME:-ocs-osd-deployer}
  84. DEPLOYER_VERSION=${DEPLOYER_VERSION:-latest}
  85. DEPLOYER_IMAGE=${DEPLOYER_IMAGE:-${IMAGE_REPO}/${DEPLOYER_NAME}:${DEPLOYER_VERSION}}
  86.  
  87. # Deploy target
  88. TARGET_NAMESPACE=${TARGET_NAMESPACE:-openshift-storage}
  89.  
  90. # CSV environment variables
  91. ADDON_NAME=${ADDON_NAME:-ocs-converged}
  92. BUNDLE_FILE=bundle/manifests/ocs-osd-deployer.clusterserviceversion.yaml
  93. CLUSTER_SIZE=${CLUSTER_SIZE:-1}
  94.  
  95. # Generate the deployer image
  96. blue "Generate deployer image: ${DEPLOYER_IMAGE}"
  97. Generate deployer image: quay.io/ezio_auditore/ocs-osd-deployer:latest
  98. exit_on_err make docker-build IMG=${DEPLOYER_IMAGE}
  99. //home/kmajumde/go/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
  100. go fmt ./...
  101. go vet ./...
  102. //home/kmajumde/go/bin/controller-gen "crd:trivialVersions=true" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
  103. mkdir -p /home/kmajumde/work/git/ocs-osd-deployer/testbin
  104. test -f /home/kmajumde/work/git/ocs-osd-deployer/testbin/setup-envtest.sh || curl -sSLo /home/kmajumde/work/git/ocs-osd-deployer/testbin/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.6.3/hack/setup-envtest.sh
  105. source /home/kmajumde/work/git/ocs-osd-deployer/testbin/setup-envtest.sh; fetch_envtest_tools /home/kmajumde/work/git/ocs-osd-deployer/testbin; setup_envtest_env /home/kmajumde/work/git/ocs-osd-deployer/testbin; go test ./... -coverprofile cover.out
  106. Using cached envtest tools from /home/kmajumde/work/git/ocs-osd-deployer/testbin
  107. setting up env vars
  108. ? github.com/openshift/ocs-osd-deployer [no test files]
  109. ? github.com/openshift/ocs-osd-deployer/api/v1alpha1 [no test files]
  110. ok github.com/openshift/ocs-osd-deployer/controllers 80.733s coverage: 85.5% of statements
  111. ? github.com/openshift/ocs-osd-deployer/readinessProbe [no test files]
  112. ok github.com/openshift/ocs-osd-deployer/readinessProbe/readiness 8.190s coverage: 73.3% of statements
  113. ? github.com/openshift/ocs-osd-deployer/templates [no test files]
  114. ? github.com/openshift/ocs-osd-deployer/testutils [no test files]
  115. ? github.com/openshift/ocs-osd-deployer/utils [no test files]
  116. docker build . -t quay.io/ezio_auditore/ocs-osd-deployer:latest
  117. Sending build context to Docker daemon 292.8MB
  118. Step 1/19 : FROM golang:1.13 as builder
  119. ---> d6f3656320fe
  120. Step 2/19 : WORKDIR /workspace
  121. ---> Using cache
  122. ---> 78e87533e952
  123. Step 3/19 : COPY go.mod go.mod
  124. ---> Using cache
  125. ---> 84d196607dd4
  126. Step 4/19 : COPY go.sum go.sum
  127. ---> Using cache
  128. ---> b223eb7178db
  129. Step 5/19 : RUN go mod download
  130. ---> Using cache
  131. ---> f917f6528304
  132. Step 6/19 : COPY main.go main.go
  133. ---> Using cache
  134. ---> e503be6c48b4
  135. Step 7/19 : COPY api/ api/
  136. ---> Using cache
  137. ---> adc342f4a17e
  138. Step 8/19 : COPY controllers/ controllers/
  139. ---> Using cache
  140. ---> 9d1c213170ed
  141. Step 9/19 : COPY utils/ utils/
  142. ---> Using cache
  143. ---> 794d70f1d8c0
  144. Step 10/19 : COPY templates/ templates/
  145. ---> Using cache
  146. ---> 5bb9c674dc8c
  147. Step 11/19 : COPY readinessProbe/ readinessProbe/
  148. ---> Using cache
  149. ---> 09fdc18b161f
  150. Step 12/19 : RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
  151. ---> Using cache
  152. ---> 98dc8fba37b4
  153. Step 13/19 : RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o readinessServer readinessProbe/main.go
  154. ---> Using cache
  155. ---> eff03e96bae3
  156. Step 14/19 : FROM gcr.io/distroless/static:nonroot
  157. ---> fb7b4da47366
  158. Step 15/19 : WORKDIR /
  159. ---> Using cache
  160. ---> f9b077cbf9db
  161. Step 16/19 : COPY --from=builder /workspace/manager .
  162. ---> Using cache
  163. ---> 9c19f54f736c
  164. Step 17/19 : COPY --from=builder /workspace/readinessServer .
  165. ---> Using cache
  166. ---> 27a0729e1ae0
  167. Step 18/19 : USER nonroot:nonroot
  168. ---> Using cache
  169. ---> 0ec106f689bc
  170. Step 19/19 : ENTRYPOINT ["/manager"]
  171. ---> Using cache
  172. ---> 00c90af8aa75
  173. Successfully built 00c90af8aa75
  174. Successfully tagged quay.io/ezio_auditore/ocs-osd-deployer:latest
  175. exit_on_err make docker-push IMG=${DEPLOYER_IMAGE}
  176. docker push quay.io/ezio_auditore/ocs-osd-deployer:latest
  177. The push refers to repository [quay.io/ezio_auditore/ocs-osd-deployer]
  178. e8d23e2cc9d7: Layer already exists
  179. a3e4d996485b: Layer already exists
  180. 417cb9b79ade: Layer already exists
  181. latest: digest: sha256:2e771cf0c20203f32755aa3bf2dbd1138d8c356da8223038b952b0ce026e487d size: 951
  182.  
  183. # Generate the olm bundle image
  184. blue "Generate and push the olm bundle image: ${BUNDLE_IMAGE}"
  185. Generate and push the olm bundle image: quay.io/ezio_auditore/ocs-osd-deployer-bundle:latest
  186. exit_on_err make bundle IMG=${DEPLOYER_IMAGE} OUTPUT_DIR=./tools/bundle
  187. //home/kmajumde/go/bin/controller-gen "crd:trivialVersions=true" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
  188. operator-sdk generate kustomize manifests -q
  189. cd config/manager && //home/kmajumde/go/bin/kustomize edit set image controller=quay.io/ezio_auditore/ocs-osd-deployer:latest
  190. //home/kmajumde/go/bin/kustomize build config/manifests | operator-sdk generate bundle -q --overwrite --version 0.0.1 --output-dir=./tools/bundle
  191. INFO[0001] Creating bundle.Dockerfile
  192. INFO[0001] Creating tools/bundle/metadata/annotations.yaml
  193. INFO[0001] Bundle metadata generated suceessfully
  194. cp config/metadata/* bundle/metadata/
  195. operator-sdk bundle validate ./bundle
  196. FATA[0000] unable to find a csv in bundle directory bundle/manifests
  197. make: *** [Makefile:168: bundle] Error 1
  198. "make bundle IMG=quay.io/ezio_auditore/ocs-osd-deployer:latest OUTPUT_DIR=./tools/bundle" command failed with exit code 2.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement