-
Notifications
You must be signed in to change notification settings - Fork 520
Modified the script to be compatible with new K8S version #1050
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
8b4f085
2f3972a
266830c
ec0bb1c
c1281f1
9d8fc53
81550b1
7200242
f036cea
214e91b
d8cf6e6
6ab210e
876c598
ad3f97b
a4b0a40
a46549a
798e5fa
5dcfd9a
7f6d0c9
3a9cda4
db32872
5a5ae6d
6c8a440
1cdaf4b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,39 +9,39 @@ steps: | |
| id: 'gcr-push' | ||
| args: ['push', 'gcr.io/$PROJECT_ID/init-actions-image:$BUILD_ID'] | ||
|
|
||
| # Run presubmit tests in parallel for 1.5 Debian image | ||
| - name: 'gcr.io/cloud-builders/kubectl' | ||
| id: 'dataproc-1.5-debian10-tests' | ||
| waitFor: ['gcr-push'] | ||
| entrypoint: 'bash' | ||
| args: ['cloudbuild/run-presubmit-on-k8s.sh', 'gcr.io/$PROJECT_ID/init-actions-image:$BUILD_ID', '$BUILD_ID', '1.5-debian10'] | ||
| env: | ||
| - 'COMMIT_SHA=$COMMIT_SHA' | ||
| - 'CLOUDSDK_COMPUTE_REGION=us-central1' | ||
| - 'CLOUDSDK_CONTAINER_CLUSTER=init-actions-presubmit' | ||
|
|
||
| # Run presubmit tests in parallel for 1.5 Rocky Linux image | ||
| - name: 'gcr.io/cloud-builders/kubectl' | ||
| id: 'dataproc-1.5-rocky8-tests' | ||
| waitFor: ['gcr-push'] | ||
| entrypoint: 'bash' | ||
| args: ['cloudbuild/run-presubmit-on-k8s.sh', 'gcr.io/$PROJECT_ID/init-actions-image:$BUILD_ID', '$BUILD_ID', '1.5-rocky8'] | ||
| env: | ||
| - 'COMMIT_SHA=$COMMIT_SHA' | ||
| - 'CLOUDSDK_COMPUTE_REGION=us-central1' | ||
| - 'CLOUDSDK_CONTAINER_CLUSTER=init-actions-presubmit' | ||
|
|
||
| # Run presubmit tests in parallel for 1.5 Ubuntu image | ||
| - name: 'gcr.io/cloud-builders/kubectl' | ||
| id: 'dataproc-1.5-ubuntu18-tests' | ||
| waitFor: ['gcr-push'] | ||
| entrypoint: 'bash' | ||
| args: ['cloudbuild/run-presubmit-on-k8s.sh', 'gcr.io/$PROJECT_ID/init-actions-image:$BUILD_ID', '$BUILD_ID', '1.5-ubuntu18'] | ||
| env: | ||
| - 'COMMIT_SHA=$COMMIT_SHA' | ||
| - 'CLOUDSDK_COMPUTE_REGION=us-central1' | ||
| - 'CLOUDSDK_CONTAINER_CLUSTER=init-actions-presubmit' | ||
|
|
||
| # # Run presubmit tests in parallel for 1.5 Debian image | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as the previous/next two comments. leave comments for one PR and remove them in the next to reduce file size and execution time. |
||
| # - name: 'gcr.io/cloud-builders/kubectl' | ||
| # id: 'dataproc-1.5-debian10-tests' | ||
| # waitFor: ['gcr-push'] | ||
| # entrypoint: 'bash' | ||
| # args: ['cloudbuild/run-presubmit-on-k8s.sh', 'gcr.io/$PROJECT_ID/init-actions-image:$BUILD_ID', '$BUILD_ID', '1.5-debian10'] | ||
| # env: | ||
| # - 'COMMIT_SHA=$COMMIT_SHA' | ||
| # - 'CLOUDSDK_COMPUTE_REGION=us-central1' | ||
| # - 'CLOUDSDK_CONTAINER_CLUSTER=init-actions-presubmit' | ||
| # | ||
| # # Run presubmit tests in parallel for 1.5 Rocky Linux image | ||
| # - name: 'gcr.io/cloud-builders/kubectl' | ||
| # id: 'dataproc-1.5-rocky8-tests' | ||
| # waitFor: ['gcr-push'] | ||
| # entrypoint: 'bash' | ||
| # args: ['cloudbuild/run-presubmit-on-k8s.sh', 'gcr.io/$PROJECT_ID/init-actions-image:$BUILD_ID', '$BUILD_ID', '1.5-rocky8'] | ||
| # env: | ||
| # - 'COMMIT_SHA=$COMMIT_SHA' | ||
| # - 'CLOUDSDK_COMPUTE_REGION=us-central1' | ||
| # - 'CLOUDSDK_CONTAINER_CLUSTER=init-actions-presubmit' | ||
| # | ||
| # # Run presubmit tests in parallel for 1.5 Ubuntu image | ||
| # - name: 'gcr.io/cloud-builders/kubectl' | ||
| # id: 'dataproc-1.5-ubuntu18-tests' | ||
| # waitFor: ['gcr-push'] | ||
| # entrypoint: 'bash' | ||
| # args: ['cloudbuild/run-presubmit-on-k8s.sh', 'gcr.io/$PROJECT_ID/init-actions-image:$BUILD_ID', '$BUILD_ID', '1.5-ubuntu18'] | ||
| # env: | ||
| # - 'COMMIT_SHA=$COMMIT_SHA' | ||
| # - 'CLOUDSDK_COMPUTE_REGION=us-central1' | ||
| # - 'CLOUDSDK_CONTAINER_CLUSTER=init-actions-presubmit' | ||
| # | ||
| # Run presubmit tests in parallel for 2.0 Debian image | ||
| - name: 'gcr.io/cloud-builders/kubectl' | ||
| id: 'dataproc-2.0-debian10-tests' | ||
|
|
@@ -53,60 +53,60 @@ steps: | |
| - 'CLOUDSDK_COMPUTE_REGION=us-central1' | ||
| - 'CLOUDSDK_CONTAINER_CLUSTER=init-actions-presubmit' | ||
|
|
||
| # Run presubmit tests in parallel for 2.0 Rocky Linux image | ||
| - name: 'gcr.io/cloud-builders/kubectl' | ||
| id: 'dataproc-2.0-rocky8-tests' | ||
| waitFor: ['gcr-push'] | ||
| entrypoint: 'bash' | ||
| args: ['cloudbuild/run-presubmit-on-k8s.sh', 'gcr.io/$PROJECT_ID/init-actions-image:$BUILD_ID', '$BUILD_ID', '2.0-rocky8'] | ||
| env: | ||
| - 'COMMIT_SHA=$COMMIT_SHA' | ||
| - 'CLOUDSDK_COMPUTE_REGION=us-central1' | ||
| - 'CLOUDSDK_CONTAINER_CLUSTER=init-actions-presubmit' | ||
|
|
||
| # Run presubmit tests in parallel for 2.0 Ubuntu image | ||
| - name: 'gcr.io/cloud-builders/kubectl' | ||
| id: 'dataproc-2.0-ubuntu18-tests' | ||
| waitFor: ['gcr-push'] | ||
| entrypoint: 'bash' | ||
| args: ['cloudbuild/run-presubmit-on-k8s.sh', 'gcr.io/$PROJECT_ID/init-actions-image:$BUILD_ID', '$BUILD_ID', '2.0-ubuntu18'] | ||
| env: | ||
| - 'COMMIT_SHA=$COMMIT_SHA' | ||
| - 'CLOUDSDK_COMPUTE_REGION=us-central1' | ||
| - 'CLOUDSDK_CONTAINER_CLUSTER=init-actions-presubmit' | ||
|
|
||
| # Run presubmit tests in parallel for 2.1 Debian image | ||
| - name: 'gcr.io/cloud-builders/kubectl' | ||
| id: 'dataproc-2.1-debian11-tests' | ||
| waitFor: ['gcr-push'] | ||
| entrypoint: 'bash' | ||
| args: ['cloudbuild/run-presubmit-on-k8s.sh', 'gcr.io/$PROJECT_ID/init-actions-image:$BUILD_ID', '$BUILD_ID', '2.1-debian11'] | ||
| env: | ||
| - 'COMMIT_SHA=$COMMIT_SHA' | ||
| - 'CLOUDSDK_COMPUTE_REGION=us-central1' | ||
| - 'CLOUDSDK_CONTAINER_CLUSTER=init-actions-presubmit' | ||
|
|
||
| # Run presubmit tests in parallel for 2.1 Rocky Linux image | ||
| - name: 'gcr.io/cloud-builders/kubectl' | ||
| id: 'dataproc-2.1-rocky8-tests' | ||
| waitFor: ['gcr-push'] | ||
| entrypoint: 'bash' | ||
| args: ['cloudbuild/run-presubmit-on-k8s.sh', 'gcr.io/$PROJECT_ID/init-actions-image:$BUILD_ID', '$BUILD_ID', '2.1-rocky8'] | ||
| env: | ||
| - 'COMMIT_SHA=$COMMIT_SHA' | ||
| - 'CLOUDSDK_COMPUTE_REGION=us-central1' | ||
| - 'CLOUDSDK_CONTAINER_CLUSTER=init-actions-presubmit' | ||
|
|
||
| # Run presubmit tests in parallel for 2.1 Ubuntu image | ||
| - name: 'gcr.io/cloud-builders/kubectl' | ||
| id: 'dataproc-2.1-ubuntu20-tests' | ||
| waitFor: ['gcr-push'] | ||
| entrypoint: 'bash' | ||
| args: ['cloudbuild/run-presubmit-on-k8s.sh', 'gcr.io/$PROJECT_ID/init-actions-image:$BUILD_ID', '$BUILD_ID', '2.1-ubuntu20'] | ||
| env: | ||
| - 'COMMIT_SHA=$COMMIT_SHA' | ||
| - 'CLOUDSDK_COMPUTE_REGION=us-central1' | ||
| - 'CLOUDSDK_CONTAINER_CLUSTER=init-actions-presubmit' | ||
| # # Run presubmit tests in parallel for 2.0 Rocky Linux image | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, leave the comments for posterity for one release and then remove them to reduce file size and execution time |
||
| # - name: 'gcr.io/cloud-builders/kubectl' | ||
| # id: 'dataproc-2.0-rocky8-tests' | ||
| # waitFor: ['gcr-push'] | ||
| # entrypoint: 'bash' | ||
| # args: ['cloudbuild/run-presubmit-on-k8s.sh', 'gcr.io/$PROJECT_ID/init-actions-image:$BUILD_ID', '$BUILD_ID', '2.0-rocky8'] | ||
| # env: | ||
| # - 'COMMIT_SHA=$COMMIT_SHA' | ||
| # - 'CLOUDSDK_COMPUTE_REGION=us-central1' | ||
| # - 'CLOUDSDK_CONTAINER_CLUSTER=init-actions-presubmit' | ||
| # | ||
| # # Run presubmit tests in parallel for 2.0 Ubuntu image | ||
| # - name: 'gcr.io/cloud-builders/kubectl' | ||
| # id: 'dataproc-2.0-ubuntu18-tests' | ||
| # waitFor: ['gcr-push'] | ||
| # entrypoint: 'bash' | ||
| # args: ['cloudbuild/run-presubmit-on-k8s.sh', 'gcr.io/$PROJECT_ID/init-actions-image:$BUILD_ID', '$BUILD_ID', '2.0-ubuntu18'] | ||
| # env: | ||
| # - 'COMMIT_SHA=$COMMIT_SHA' | ||
| # - 'CLOUDSDK_COMPUTE_REGION=us-central1' | ||
| # - 'CLOUDSDK_CONTAINER_CLUSTER=init-actions-presubmit' | ||
| # | ||
| ## Run presubmit tests in parallel for 2.1 Debian image | ||
| # - name: 'gcr.io/cloud-builders/kubectl' | ||
| # id: 'dataproc-2.1-debian11-tests' | ||
| # waitFor: ['gcr-push'] | ||
| # entrypoint: 'bash' | ||
| # args: ['cloudbuild/run-presubmit-on-k8s.sh', 'gcr.io/$PROJECT_ID/init-actions-image:$BUILD_ID', '$BUILD_ID', '2.1-debian11'] | ||
| # env: | ||
| # - 'COMMIT_SHA=$COMMIT_SHA' | ||
| # - 'CLOUDSDK_COMPUTE_REGION=us-central1' | ||
| # - 'CLOUDSDK_CONTAINER_CLUSTER=init-actions-presubmit' | ||
| # | ||
| ## Run presubmit tests in parallel for 2.1 Rocky Linux image | ||
| # - name: 'gcr.io/cloud-builders/kubectl' | ||
| # id: 'dataproc-2.1-rocky8-tests' | ||
| # waitFor: ['gcr-push'] | ||
| # entrypoint: 'bash' | ||
| # args: ['cloudbuild/run-presubmit-on-k8s.sh', 'gcr.io/$PROJECT_ID/init-actions-image:$BUILD_ID', '$BUILD_ID', '2.1-rocky8'] | ||
| # env: | ||
| # - 'COMMIT_SHA=$COMMIT_SHA' | ||
| # - 'CLOUDSDK_COMPUTE_REGION=us-central1' | ||
| # - 'CLOUDSDK_CONTAINER_CLUSTER=init-actions-presubmit' | ||
| # | ||
| ## Run presubmit tests in parallel for 2.1 Ubuntu image | ||
| # - name: 'gcr.io/cloud-builders/kubectl' | ||
| # id: 'dataproc-2.1-ubuntu20-tests' | ||
| # waitFor: ['gcr-push'] | ||
| # entrypoint: 'bash' | ||
| # args: ['cloudbuild/run-presubmit-on-k8s.sh', 'gcr.io/$PROJECT_ID/init-actions-image:$BUILD_ID', '$BUILD_ID', '2.1-ubuntu20'] | ||
| # env: | ||
| # - 'COMMIT_SHA=$COMMIT_SHA' | ||
| # - 'CLOUDSDK_COMPUTE_REGION=us-central1' | ||
| # - 'CLOUDSDK_CONTAINER_CLUSTER=init-actions-presubmit' | ||
|
|
||
| # Delete Docker image from GCR | ||
| - name: 'gcr.io/cloud-builders/gcloud' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| labels: | ||
| run: {{IMAGE_NAME}} | ||
| name: {{IMAGE_NAME}} | ||
| namespace: default | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: {{IMAGE_NAME}} | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: {{IMAGE_NAME}} | ||
| spec: | ||
| containers: | ||
| - command: | ||
| - bash | ||
| - /init-actions/cloudbuild/presubmit.sh | ||
| env: | ||
| - name: COMMIT_SHA | ||
| value: {{COMMIT_SHA}} | ||
| - name: IMAGE_VERSION | ||
| value: {{IMAGE_VERSION}} | ||
| name: {{IMAGE_NAME}} | ||
| image: {{IMAGE_BUILD_ID}} | ||
| resources: | ||
| limits: | ||
| cpu: 500m | ||
| ephemeral-storage: 1Gi | ||
| memory: 2Gi | ||
| requests: | ||
| cpu: 500m | ||
| ephemeral-storage: 1Gi | ||
| memory: 2Gi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,13 +12,22 @@ gcloud container clusters get-credentials "${CLOUDSDK_CONTAINER_CLUSTER}" | |
|
|
||
| LOGS_SINCE_TIME=$(date --iso-8601=seconds) | ||
|
|
||
| kubectl run "${POD_NAME}" \ | ||
| --image="${IMAGE}" \ | ||
| --requests='cpu=750m,memory=2Gi,ephemeral-storage=2Gi' \ | ||
| --restart=Never \ | ||
| --env="COMMIT_SHA=${COMMIT_SHA}" \ | ||
| --env="IMAGE_VERSION=${DATAPROC_IMAGE_VERSION}" \ | ||
| --command -- bash /init-actions/cloudbuild/presubmit.sh | ||
| #kubectl run "${POD_NAME}" \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should keep this old command in the previous commit in the main branch. Thank you for preserving the previous implementation in comments. I loathe the concept of removing the old implementation as well. We could leave this comment in for the next release for posterity and then remove them to reduce file size and execution time. |
||
| # --image="${IMAGE}" \ | ||
| # --restart=Never \ | ||
| # --env="COMMIT_SHA=${COMMIT_SHA}" \ | ||
| # --env="IMAGE_VERSION=${DATAPROC_IMAGE_VERSION}" \ | ||
| # --command -- bash /init-actions/cloudbuild/presubmit.sh | ||
| export IMAGE_NAME=${POD_NAME} | ||
| export COMMIT_SHA=${COMMIT_SHA} | ||
| export IMAGE_VERSION=${DATAPROC_IMAGE_VERSION} | ||
| export IMAGE_BUILD_ID=${BUILD_ID} | ||
| export IMAGE_BUILD_ID=gcr.io/cloud-dataproc-ci/init-actions-image:${BUILD_ID} | ||
|
|
||
| template=`cat cloudbuild/deployment.yaml | sed "s/{{IMAGE_NAME}}/${IMAGE_NAME}/g;s/{{COMMIT_SHA}}/${COMMIT_SHA}/g;s/{{IMAGE_VERSION}}/${IMAGE_VERSION}/g;s|{{IMAGE_BUILD_ID}}|${IMAGE_BUILD_ID}|g" ` | ||
| echo "$template" | ||
|
|
||
| echo "$template" | kubectl apply -f - | ||
|
|
||
| # Delete POD on exit and describe it before deletion if exit was unsuccessful | ||
| trap '[[ $? != 0 ]] && kubectl describe "pod/${POD_NAME}"; kubectl delete pods "${POD_NAME}"' EXIT | ||
|
|
@@ -30,6 +39,7 @@ while ! kubectl describe "pod/${POD_NAME}" | grep -q Terminated; do | |
| LOGS_SINCE_TIME=$(date --iso-8601=seconds) | ||
| done | ||
|
|
||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this new newline is probably not necessary |
||
| EXIT_CODE=$(kubectl get pod "${POD_NAME}" \ | ||
| -o go-template="{{range .status.containerStatuses}}{{.state.terminated.exitCode}}{{end}}") | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that seems fine. I don't see it being used below, but perhaps the kubectl apply depends on this for translation. Can you share why we included this package?