WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 0f17f24

Browse files
committed
feat: Build fragment images with only changed content
Previously we always added all FBC operators to fragment image. This however showed a downside when pipeline is manually restarted. Due to a restart the pipeline can include content to fragment that is outdated or even removed. This change detects which catalog operators have been updated and only add these to the fragment. It reduces a image size and avoid race condition when pipeline is manually rebooted. JIRA: ISV-6459 Signed-off-by: Ales Raszka <[email protected]>
1 parent babd162 commit 0f17f24

33 files changed

+1248
-1173
lines changed

.github/workflows/build-and-test.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on: # yamllint disable-line rule:truthy
55
push:
66
branches:
77
- main
8+
- ISV-6495
89
pull_request:
910
types: [opened, synchronize, reopened, labeled]
1011
workflow_dispatch:
@@ -92,7 +93,7 @@ jobs:
9293
- isv-fbc-catalog
9394

9495
fail-fast: false
95-
runs-on: ubuntu-latest
96+
runs-on: ubuntu-22.04
9697
steps:
9798
- uses: actions/checkout@v5
9899

@@ -105,6 +106,8 @@ jobs:
105106
run: |
106107
# Install python packages needed from ansible
107108
pipx inject ansible-core jmespath openshift pygithub
109+
pipx list
110+
ansible --version
108111
109112
# Add certificates to trusted list
110113
sudo cp operator-pipeline-images/certs/* /usr/local/share/ca-certificates
@@ -134,7 +137,7 @@ jobs:
134137
ansible/vaults/integration-tests/ci-pipeline-github-ssh-key
135138
136139
- name: Run the integration tests ansible playbook
137-
uses: dawidd6/action-ansible-playbook@v4
140+
uses: dawidd6/action-ansible-playbook@v5
138141
with:
139142
playbook: playbooks/operator-pipeline-integration-tests.yml
140143
directory: ./ansible

.github/workflows/deploy.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
# Install python packages needed from ansible
3838
pipx inject ansible-core jmespath openshift pygithub
3939
- name: Deploy dev environment
40-
uses: dawidd6/action-ansible-playbook@v4
40+
uses: dawidd6/action-ansible-playbook@v5
4141
with:
4242
playbook: playbooks/deploy.yml
4343
directory: ./ansible
@@ -67,7 +67,7 @@ jobs:
6767
# Install python packages needed from ansible
6868
pipx inject ansible-core jmespath openshift pygithub
6969
- name: Deploy qa environment
70-
uses: dawidd6/action-ansible-playbook@v4
70+
uses: dawidd6/action-ansible-playbook@v5
7171
with:
7272
playbook: playbooks/deploy.yml
7373
directory: ./ansible
@@ -98,7 +98,7 @@ jobs:
9898
# Install python packages needed from ansible
9999
pipx inject ansible-core jmespath openshift pygithub
100100
- name: Deploy stage environment
101-
uses: dawidd6/action-ansible-playbook@v4
101+
uses: dawidd6/action-ansible-playbook@v5
102102
with:
103103
playbook: playbooks/deploy.yml
104104
directory: ./ansible
@@ -128,7 +128,7 @@ jobs:
128128
# Install python packages needed from ansible
129129
pipx inject ansible-core jmespath openshift pygithub
130130
- name: Deploy prod environment
131-
uses: dawidd6/action-ansible-playbook@v4
131+
uses: dawidd6/action-ansible-playbook@v5
132132
with:
133133
playbook: playbooks/deploy.yml
134134
directory: ./ansible

ansible/roles/operator-pipeline/tasks/index-img-bootstrap-signing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
metadata:
1212
name: "{{ oc_index_bootstrap_namespace }}"
1313
annotations:
14-
operator.tekton.dev/prune.keep: "{{ tekton_pruner_keep | string }}"
14+
operator.tekton.dev/prune.keep: "{{ tekton_pruner_keep | int }}"
1515

1616
- name: Create Tekton access role
1717
tags:

ansible/roles/operator-pipeline/tasks/index-img-signing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
metadata:
1212
name: "{{ oc_signing_namespace }}"
1313
annotations:
14-
operator.tekton.dev/prune.keep: "{{ tekton_pruner_keep | string }}"
14+
operator.tekton.dev/prune.keep: "{{ tekton_pruner_keep | int }}"
1515

1616
- name: Include signing secrets
1717
ansible.builtin.include_tasks: tasks/index-img-signing-secrets.yml

ansible/roles/operator-pipeline/tasks/ocp_namespace.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
metadata:
1111
name: "{{ oc_namespace }}"
1212
annotations:
13-
operator.tekton.dev/prune.keep: "{{ tekton_pruner_keep | string }}"
13+
operator.tekton.dev/prune.keep: "{{ tekton_pruner_keep | int }}"

ansible/roles/operator-pipeline/tasks/webhook-dispatcher.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
delay: 3
4545

4646
- name: Create a webhook dispatcher service account
47-
ansible.builtin.include_tasks: tasks/webhook-dispatcher-sa.yml
47+
ansible.builtin.import_tasks: tasks/webhook-dispatcher-sa.yml
4848

4949
- name: Create a webhook dispatcher config map
5050
kubernetes.core.k8s:
@@ -78,6 +78,7 @@
7878
ansible.builtin.uri:
7979
url: "{{ operator_pipeline_webhook_dispatcher_base_url }}/api/v1/status/db"
8080
method: GET
81+
status_code: 200
8182
register: webhook_dispatcher_status
8283
until: webhook_dispatcher_status.status == 200
8384
retries: 20

ansible/roles/operator-pipeline/templates/openshift/pipelines/operator-hosted-pipeline.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,8 @@ spec:
463463
value: "$(params.pipeline_image)"
464464
- name: commit_sha
465465
value: $(params.git_commit)
466-
- name: affected_catalogs
467-
value: "$(tasks.detect-changes.results.catalogs_with_added_or_modified_operators)"
466+
- name: affected_catalog_operators
467+
value: "$(tasks.detect-changes.results.added_or_modified_catalog_operators)"
468468
- name: fragment_repository
469469
value: "$(params.registry)/$(params.image_namespace)/catalog"
470470
workspaces:

ansible/roles/operator-pipeline/templates/openshift/pipelines/operator-release-pipeline.yml

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -401,48 +401,6 @@ spec:
401401
- name: registry-credentials
402402
workspace: registry-serve-credentials
403403

404-
# Automatically add bundle to FBC based on operators release config file
405-
- name: add-bundle-to-fbc
406-
runAfter:
407-
- publish-pyxis-data
408-
taskRef:
409-
kind: Task
410-
name: add-bundle-to-fbc
411-
when:
412-
- input: "$(tasks.detect-changes.results.added_bundle)"
413-
operator: notin
414-
values: [""]
415-
params:
416-
- name: pipeline_image
417-
value: "$(params.pipeline_image)"
418-
- name: bundle_pullspec
419-
value: "$(tasks.copy-bundle-image-to-released-registry.results.image_pullspec)"
420-
- name: operator_name
421-
value: "$(tasks.detect-changes.results.added_operator)"
422-
- name: operator_version
423-
value: "$(tasks.detect-changes.results.added_bundle)"
424-
- name: git_base_branch
425-
value: "$(params.git_base_branch)"
426-
- name: github_origin_pr_url
427-
value: "$(params.git_pr_url)"
428-
- name: github_token_secret_name
429-
value: "$(params.github_token_secret_name)"
430-
- name: github_token_secret_key
431-
value: "$(params.github_token_secret_key)"
432-
- name: create_pull_request
433-
value: "true"
434-
workspaces:
435-
- name: source
436-
workspace: repository
437-
subPath: src
438-
- name: output
439-
workspace: results
440-
subPath: summary
441-
- name: ssh-directory
442-
workspace: ssh-dir
443-
- name: registry-credentials
444-
workspace: registry-pull-credentials
445-
446404
# Get the bundle versions to build index
447405
- name: get-supported-versions
448406
runAfter:
@@ -480,8 +438,8 @@ spec:
480438
value: "$(params.pipeline_image)"
481439
- name: commit_sha
482440
value: $(params.git_commit)
483-
- name: affected_catalogs
484-
value: "$(tasks.detect-changes.results.catalogs_with_added_or_modified_operators)"
441+
- name: affected_catalog_operators
442+
value: "$(tasks.detect-changes.results.added_or_modified_catalog_operators)"
485443
- name: fragment_repository
486444
value: "$(params.registry)/$(params.image_namespace)/catalog"
487445
workspaces:
@@ -650,6 +608,47 @@ spec:
650608
- name: results
651609
workspace: results
652610

611+
- name: add-bundle-to-fbc
612+
runAfter:
613+
- copy-bundle-image-to-released-registry
614+
taskRef:
615+
kind: Task
616+
name: add-bundle-to-fbc
617+
when:
618+
- input: "$(tasks.detect-changes.results.added_bundle)"
619+
operator: notin
620+
values: [""]
621+
params:
622+
- name: pipeline_image
623+
value: "$(params.pipeline_image)"
624+
- name: bundle_pullspec
625+
value: "$(tasks.copy-bundle-image-to-released-registry.results.image_pullspec)"
626+
- name: operator_name
627+
value: "$(tasks.detect-changes.results.added_operator)"
628+
- name: operator_version
629+
value: "$(tasks.detect-changes.results.added_bundle)"
630+
- name: git_base_branch
631+
value: "$(params.git_base_branch)"
632+
- name: github_origin_pr_url
633+
value: "$(params.git_pr_url)"
634+
- name: github_token_secret_name
635+
value: "$(params.github_token_secret_name)"
636+
- name: github_token_secret_key
637+
value: "$(params.github_token_secret_key)"
638+
- name: create_pull_request
639+
value: "true"
640+
workspaces:
641+
- name: source
642+
workspace: repository
643+
subPath: src
644+
- name: output
645+
workspace: results
646+
subPath: summary
647+
- name: ssh-directory
648+
workspace: ssh-dir
649+
- name: registry-credentials
650+
workspace: registry-pull-credentials
651+
653652
finally:
654653

655654
# Release the acquired resource

ansible/roles/operator-pipeline/templates/openshift/tasks/build-fragment-images.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ spec:
77
params:
88
- name: pipeline_image
99

10-
- name: affected_catalogs
11-
description: Comma separated list of updated catalogs
10+
- name: affected_catalog_operators
11+
description: Comma separated list of updated operator catalogs
1212

1313
- name: fragment_repository
1414
description: A repository where fragments are pushed
@@ -34,7 +34,7 @@ spec:
3434
#! /usr/bin/env bash
3535
set -xe
3636
37-
if [[ "$(params.affected_catalogs)" == "" ]]; then
37+
if [[ "$(params.affected_catalog_operators)" == "" ]]; then
3838
echo "No affected catalogs, skipping fragment image build"
3939
exit 0
4040
fi
@@ -45,7 +45,7 @@ spec:
4545
fi
4646
4747
build-fragment-images \
48-
--catalog-names "$(params.affected_catalogs)" \
48+
--catalog-operators "$(params.affected_catalog_operators)" \
4949
--repository-destination "$(params.fragment_repository)" \
5050
--tag-suffix "fragment-$(params.commit_sha)" \
5151
--verbose $EXTRA_ARGS

ansible/roles/operator-pipeline/templates/openshift/tasks/parse-repo-changes.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ spec:
3838
description: |
3939
Comma separated list of operators added/updated/deleted inside
4040
a catalogs directory structure
41+
- name: added_or_modified_catalog_operators
42+
description: |
43+
Comma separated list of operators added or modified inside a catalogs
44+
directory structure
4145
- name: deleted_catalog_operators
4246
description: |
4347
Comma separated list of operators deleted from the catalogs
@@ -102,5 +106,8 @@ spec:
102106
affected_catalog_operators="$(jq -r '.affected_catalog_operators | join(",")' < changes.json)"
103107
echo -n $affected_catalog_operators > "$(results.affected_catalog_operators.path)"
104108
109+
added_or_modified_catalog_operators="$(jq -r '.added_or_modified_catalog_operators | join(",")' < changes.json)"
110+
echo -n $added_or_modified_catalog_operators > "$(results.added_or_modified_catalog_operators.path)"
111+
105112
deleted_catalog_operators="$(jq -r '.deleted_catalog_operators | join(",")' < changes.json)"
106113
echo -n $deleted_catalog_operators > "$(results.deleted_catalog_operators.path)"

0 commit comments

Comments
 (0)