Skip to content
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

[zuul] Add job to build locally and do an index-based deployment #495

Merged
merged 41 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
4abc396
[stf-run-ci][create_catalog] Swap query for a command task
elfiesmelfie Jul 13, 2023
f264fb8
Merge branch 'master' into efoley-replace_query
elfiesmelfie Sep 18, 2023
486f4f3
Merge branch 'master' into efoley-replace_query
elfiesmelfie Sep 22, 2023
a48fc55
[stf-run-ci][create_catalog] Remove quoate from task names for consis…
elfiesmelfie Sep 22, 2023
24ac2d7
[zuul] Add job to build locally and do an index-based deployment
elfiesmelfie Jun 2, 2023
391a19a
Merge branch 'master' into efoley-replace_query
elfiesmelfie Sep 28, 2023
881ccdc
[zuul] use 'service-telemetry' as namespace
elfiesmelfie Sep 29, 2023
7475a79
Merge branch 'master' into efoley-zuul-fix-namespace
elfiesmelfie Sep 29, 2023
49bc2e8
Merge branch 'efoley-zuul-fix-namespace' into efoley-zuul-local_build…
elfiesmelfie Sep 29, 2023
5a21e7c
Merge branch 'master' into efoley-zuul-local_build-index_deploy
elfiesmelfie Sep 29, 2023
246f949
Merge branch 'efoley-replace_query' into efoley-zuul-local_build-inde…
elfiesmelfie Sep 29, 2023
bbcb60e
Merge branch 'master' into efoley-replace_query
elfiesmelfie Oct 5, 2023
13c387f
Merge branch 'efoley-replace_query' into efoley-zuul-local_build-inde…
elfiesmelfie Oct 5, 2023
fbfac97
Merge branch 'master' into efoley-replace_query
elfiesmelfie Oct 5, 2023
acdfa07
Merge branch 'efoley-replace_query' into efoley-zuul-local_build-inde…
elfiesmelfie Oct 5, 2023
f720203
Update the check in create_catalog and kill first build.
elfiesmelfie Oct 5, 2023
b07e345
[stf-run-ci] create_catalog: Update image for operator registry
elfiesmelfie Jul 17, 2023
aa39654
[stf-run-ci] create_catalog: Remove check for imagestream before crea…
elfiesmelfie Oct 6, 2023
d228db2
[stf-run-ci] Generate extra logs if preflight checks fail
elfiesmelfie Oct 9, 2023
0c0a413
Update preflight checks
elfiesmelfie Oct 10, 2023
7ce2a7a
Merge branch 'efoley-preflight-add_logs_on_failure' into efoley-repla…
elfiesmelfie Oct 10, 2023
613ff9e
Merge branch 'efoley-replace_query' into efoley-zuul-local_build-inde…
elfiesmelfie Oct 10, 2023
c00050c
Merge branch 'master' into efoley-zuul-local_build-index_deploy
elfiesmelfie Oct 11, 2023
d776cc2
Merge branch 'master' into efoley-zuul-local_build-index_deploy
elfiesmelfie Oct 13, 2023
30c3b25
Merge branch 'master' into efoley-zuul-local_build-index_deploy
elfiesmelfie Oct 17, 2023
c709422
Merge branch 'master' into efoley-zuul-local_build-index_deploy
elfiesmelfie Oct 19, 2023
ab16832
Merge branch 'master' into efoley-zuul-local_build-index_deploy
elfiesmelfie Oct 24, 2023
15a9f39
Update create_catalog so the builds aren't deleted
elfiesmelfie Oct 24, 2023
f5ee138
Removed comments and clean up change
elfiesmelfie Oct 24, 2023
9af7c2f
Merge branch 'master' into efoley-zuul-local_build-index_deploy
elfiesmelfie Oct 24, 2023
501a4a2
Fix bundle check test
leifmadsen Oct 25, 2023
8761e10
Merge branch 'fixup/fix-bundle-check-test' into efoley-zuul-local_bui…
elfiesmelfie Oct 25, 2023
dffeb66
Merge branch 'master' into efoley-zuul-local_build-index_deploy
elfiesmelfie Nov 6, 2023
e052192
address review comments
elfiesmelfie Nov 6, 2023
3b93abf
Merge branch 'master' into efoley-zuul-local_build-index_deploy
elfiesmelfie Nov 8, 2023
8ebf45a
[stf-collect-logs] Add ignore_errors to task
elfiesmelfie Nov 7, 2023
e5b251b
Merge branch 'master' into efoley-fix-logs
elfiesmelfie Nov 17, 2023
b4412d9
Merge branch 'master' into efoley-zuul-local_build-index_deploy
elfiesmelfie Nov 17, 2023
1502b52
Merge branch 'efoley-fix-logs' into efoley-zuul-local_build-index_deploy
elfiesmelfie Nov 17, 2023
d315b5b
Merge branch 'master' into efoley-zuul-local_build-index_deploy
elfiesmelfie Nov 17, 2023
b2fbf8f
Merge branch 'master' into efoley-zuul-local_build-index_deploy
elfiesmelfie Nov 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions .zuul.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@
vars:
scenario: "local_build"

- job:
name: stf-crc-local_build-index_deploy
parent: stf-base
abstract: true
description: |
Build STF locally and deploy from index
vars:
scenario: "local_build-index_deploy"

- job:
name: stf-crc-ocp_412-nightly_bundles
parent: stf-crc-nightly_bundles
Expand Down Expand Up @@ -81,6 +90,22 @@
vars:
crc_ocp_bundle: 'https://mirror.openshift.com/pub/openshift-v4/clients/crc/bundles/openshift/4.13.14/crc_libvirt_4.13.14_amd64.crcbundle'

- job:
name: stf-crc-ocp_412-local_build-index_deploy
parent: stf-crc-local_build-index_deploy
description: |
Build STF locally and deploy from index on OCP 4.12
vars:
crc_ocp_bundle: 'https://mirror.openshift.com/pub/openshift-v4/clients/crc/bundles/openshift/4.12.13/crc_libvirt_4.12.13_amd64.crcbundle'

- job:
name: stf-crc-ocp_413-local_build-index_deploy
parent: stf-crc-local_build-index_deploy
description: |
Build STF locally and deploy from index on OCP 4.13
vars:
crc_ocp_bundle: 'https://mirror.openshift.com/pub/openshift-v4/clients/crc/bundles/openshift/4.13.14/crc_libvirt_4.13.14_amd64.crcbundle'

- project-template:
name: stf-crc-jobs
description: |
Expand All @@ -89,10 +114,12 @@
jobs:
- stf-crc-ocp_412-nightly_bundles
- stf-crc-ocp_412-local_build
- stf-crc-ocp_412-local_build-index_deploy
- stf-crc-ocp_413-nightly_bundles
- stf-crc-ocp_413-local_build

- stf-crc-ocp_413-local_build-index_deploy

- project:
name: infrawatch/service-telemetry-operator
templates:
- stf-crc-jobs
- stf-crc-jobs
73 changes: 46 additions & 27 deletions build/stf-run-ci/tasks/create_catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
register: index_dockercfg_secret
ignore_errors: true

# There's an error when the requested resource doesn't exist, so check the rc
- when: index_dockercfg_secret.rc != 0
block:
- block:
- name: Create config.json to import as Secret
ansible.builtin.template:
variable_start_string: "<<"
Expand All @@ -58,9 +56,32 @@
register: ose_op_registry_is
ignore_errors: true

- name: Create ImageStream for ose-operator-registry
ansible.builtin.command: oc import-image -n {{ namespace }} ose-operator-registry:{{ default_operator_registry_image_tag }} --from={{ default_operator_registry_image_base }}:{{ default_operator_registry_image_tag }} --confirm
- name: Set the operator_registry_image
ansible.builtin.set_fact:
operator_registry_image: "{{ default_operator_registry_image_base }}:{{ default_operator_registry_image_tag }}"

# --show-multiarch=true is used because you get an error (and rc!=0) when you query a multi-arch image without specifying the arch, even when the image exists
- name: "Try to get the image info for the operator registry image"
ansible.builtin.command:
cmd: oc image info --show-multiarch=true "{{ operator_registry_image }}"
ignore_errors: true
register: image_info

- name: Test alternative operator image
ansible.builtin.set_fact:
operator_registry_image: "quay.io/openshift/origin-operator-registry:4.13"
when: image_info.rc != 0

- name: Create ImageStream for ose-operator-registry, if it doesn't already exist
ansible.builtin.command:
cmd: |
oc import-image -n {{ namespace }} ose-operator-registry:{{ default_operator_registry_image_tag }} --from={{ operator_registry_image }} --confirm
when: ose_op_registry_is.rc != 0
register: create_ose_is

- name: Show the image stream
ansible.builtin.debug:
var: create_ose_is

- name: Delete the existing imagestream, if it exists
ansible.builtin.command: oc delete imagestream -n {{ namespace }} service-telemetry-framework-index
Expand All @@ -75,8 +96,16 @@
register: stf_index_imagestream
ignore_errors: true

- when: stf_index_imagestream.rc != 0
name: Create BuildConfig for service-telemetry-framework-index
- name: Show STF index image stream
ansible.builtin.debug:
var: stf_index_imagestream

- name: Create index.yaml base for index image
ansible.builtin.template:
src: index-yaml.j2
dest: "{{ base_dir }}/working/service-telemetry-framework-index/index.yaml"

- name: Create BuildConfig for service-telemetry-framework-index
kubernetes.core.k8s:
definition:
apiVersion: build.openshift.io/v1
Expand All @@ -102,7 +131,8 @@
dockerfile: |
# The base image is expected to contain
# /bin/opm (with a serve subcommand) and /bin/grpc_health_probe
FROM {{default_operator_registry_image_base}}:{{default_operator_registry_image_tag}}

FROM {{ operator_registry_image }}

COPY --chmod=666 index.yaml /configs/

Expand All @@ -121,7 +151,7 @@
dockerStrategy:
from:
kind: ImageStreamTag
name: "ose-operator-registry:{{default_operator_registry_image_tag}}"
name: "ose-operator-registry:{{ default_operator_registry_image_tag }}"
volumes:
- mounts:
- destinationPath: /opt/app-root/auth
Expand All @@ -134,24 +164,13 @@
type: Docker
successfulBuildsHistoryLimit: 5

- name: Get builds of service-telemetry-framework-index
kubernetes.core.k8s_info:
api_version: build.openshift.io/v1
kind: Build
namespace: "{{ namespace }}"
label_selectors:
- "build=service-telemetry-framework-index"
register: index_builds

- when: index_builds.resources | length == 0
block:
- name: Create index.yaml base for index image
ansible.builtin.template:
src: index-yaml.j2
dest: "{{ base_dir }}/working/service-telemetry-framework-index/index.yaml"

- name: Build service-telemetry-framework-index
ansible.builtin.command: oc start-build -n "{{ namespace }}" service-telemetry-framework-index --wait --from-dir {{ base_dir }}/working/service-telemetry-framework-index
- name: Build service-telemetry-framework-index
ansible.builtin.command: oc start-build -n "{{ namespace }}" service-telemetry-framework-index --wait --follow --from-dir {{ base_dir }}/working/service-telemetry-framework-index
register: build_result
ignore_errors: true
retries: 3
delay: 10
until: build_result.rc == 0

- name: Create CloudOps CatalogSource
kubernetes.core.k8s:
Expand Down
6 changes: 6 additions & 0 deletions ci/vars-local_build-index_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
#ansible-playbook --extra-vars __local_build_enabled=true -e __deploy_from_index_enabled=true --extra-vars working_branch="$(git rev-parse --abbrev-ref HEAD)" --extra-vars __service_telemetry_storage_ephemeral_enabled=true --extra-vars __service_telemetry_observability_strategy=use_redhat ./run-ci.yaml
__local_build_enabled: true
__deploy_from_index_enabled: true
__service_telemetry_ephemeral_enabled: true
__service_telemetry_observability_strategy: use_redhat