-
-
Notifications
You must be signed in to change notification settings - Fork 117
Move st2tests to a job #399
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
Changes from all commits
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 |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: {{ .Release.Name }}-st2tests | ||
| name: {{ .Release.Name }}-job-st2-tests | ||
|
Member
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 might need the helm annotations if you are planning to run this on a real st2 cluster instead of only running it in CI. I'm not sure the st2tests.sh is designed to run on a real instance of st2--there might be some unintended side effects. |
||
| labels: {{- include "stackstorm-ha.labels" (list $ "st2tests") | nindent 4 }} | ||
| data: | ||
| st2tests.sh: | | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| apiVersion: batch/v1 | ||
| kind: Job | ||
| metadata: | ||
| name: "{{ .Release.Name }}-job-st2-tests" | ||
|
Member
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. Name changed from |
||
| labels: {{- include "stackstorm-ha.labels" (list $ "st2tests") | nindent 4 }} | ||
| annotations: | ||
| "helm.sh/hook": test-success | ||
| "helm.sh/hook-delete-policy": hook-succeeded | ||
| spec: | ||
| template: | ||
| metadata: | ||
| name: "{{ .Release.Name }}-job-st2-tests" | ||
| labels: {{- include "stackstorm-ha.labels" (list $ "st2tests") | nindent 8 }} | ||
| annotations: | ||
| "helm.sh/hook": test-success | ||
| "helm.sh/hook-delete-policy": hook-succeeded | ||
|
Comment on lines
+14
to
+16
Member
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. I don't think the pod needs these helm annotations, just the top-level Job. Is that right? |
||
| spec: | ||
| initContainers: | ||
| {{- include "stackstorm-ha.init-containers-wait-for-auth" . | nindent 6 }} | ||
|
Member
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 is a new templated init container you've added to ensure the tests wait until st2 is up and running. |
||
| # Sidecar container to copy BATS framework to the main container | ||
| - name: bats-core | ||
| image: "bats/bats:1.8.2" | ||
| imagePullPolicy: {{ $.Values.image.pullPolicy }} | ||
| {{- with .Values.securityContext }} | ||
| securityContext: {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
|
Comment on lines
+23
to
+26
Member
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 is new. |
||
| command: | ||
| - bash | ||
| - -ec | ||
| - | | ||
| cp -R /opt/bats /tools/ | ||
| volumeMounts: | ||
| - name: tools | ||
| mountPath: /tools | ||
| - name: bats-addons | ||
| image: "alpine/git:2.36.3" | ||
| imagePullPolicy: {{ $.Values.image.pullPolicy }} | ||
| {{- with .Values.securityContext }} | ||
| securityContext: {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
|
Comment on lines
+37
to
+40
Member
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 is new. |
||
| command: | ||
| - ash | ||
| - -ec | ||
| - | | ||
| git clone --config advice.detachedHead=false --depth 1 --branch v0.3.0 \ | ||
| https://github.com/ztombol/bats-assert /tools/bats-assert | ||
| git clone --config advice.detachedHead=false --depth 1 --branch v0.2.0 \ | ||
| https://github.com/ztombol/bats-file /tools/bats-file | ||
| git clone --config advice.detachedHead=false --depth 1 --branch v0.3.0 \ | ||
| https://github.com/ztombol/bats-support /tools/bats-support | ||
| volumeMounts: | ||
| - name: tools | ||
| mountPath: /tools | ||
| # Run the actual BATS tests | ||
| containers: | ||
| - name: st2tests | ||
| image: '{{ template "stackstorm-ha.imageRepository" . }}/st2actionrunner:{{ tpl (.Values.st2actionrunner.image.tag | default .Values.image.tag) $ }}' | ||
| imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
| {{- with .Values.securityContext }} | ||
| securityContext: {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
|
Comment on lines
+59
to
+61
Member
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 is new. ( |
||
| envFrom: | ||
| - configMapRef: | ||
| name: {{ .Release.Name }}-st2-urls | ||
| - secretRef: | ||
| name: {{ include "stackstorm-ha.secrets.st2Auth" . }} | ||
| env: | ||
| - name: BATS_HELPERS_DIR | ||
| value: /tools | ||
| - name: ST2_VERSION | ||
| value: "{{ .Values.image.tag }}" | ||
| - name: ST2_RBAC_ENABLED | ||
| value: "{{ .Values.st2.rbac.enabled }}" | ||
| volumeMounts: | ||
| - name: tools | ||
| mountPath: /tools | ||
| - name: tests | ||
| mountPath: /tests | ||
| command: | ||
| - /tools/bats/bin/bats | ||
| - /tests/st2tests.sh | ||
| volumes: | ||
| - name: tools | ||
| emptyDir: {} | ||
| - name: tests | ||
| configMap: | ||
| name: {{ .Release.Name }}-job-st2-tests | ||
| restartPolicy: Never | ||
| backoffLimit: 0 | ||
|
Member
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. The |
||
This file was deleted.
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.
I don't see these vars in our values file:
ingress.fqdningress.classphaseCanarystackstorm-k8s/values.yaml
Lines 298 to 321 in 17e5fca
I also do not use the ingress, so these would never be defined for me.
user/pass is also only available in my cluster(s) during initial bootstrap. Once I switch to ldap, I exclusively use api tokens within helm.
Do you have any ideas on how to make this more generic?