Skip to content

Commit

Permalink
Revert "[ISV-4162] Remove the operator-pipeline-import-index-images.y…
Browse files Browse the repository at this point in the history
…ml file from the ansible playbooks. (#538)"

This reverts commit 0a95960.
  • Loading branch information
Allda committed Nov 10, 2023
1 parent 9017ab4 commit 0b006d9
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ansible/roles/operator-pipeline/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

- name: Import pipeline secrets
ansible.builtin.import_tasks: tasks/pipeline-secrets.yml
- name: Import index image stream
ansible.builtin.import_tasks: tasks/operator-pipeline-import-index-images.yml

- name: Add custom pipeline SCC and link it with pipeline SA
tags:
- pipeline-scc
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
# We can't use the k8s module here because it always tries to GET the resource
# prior to creation or patching. The ImageStreamImport API only supports POST.
- name: Import certified-operator-index imagestream
tags:
- import-index-images
no_log: true
ansible.builtin.uri:
url: "{{ ocp_host }}/apis/image.openshift.io/v1/namespaces/{{ oc_namespace }}/imagestreamimports"
method: POST
# The 'or' condition is needed to support Ansible versions < 2.13
validate_certs: "{{ lookup('env', 'K8S_AUTH_VERIFY_SSL', default='yes') or 'yes' }}"
status_code: 201
body_format: json
headers:
Authorization: "Bearer {{ ocp_token }}"
body:
apiVersion: image.openshift.io/v1
kind: ImageStreamImport
metadata:
name: certified-operator-index
labels:
app: operator-pipeline
suffix: "{{ suffix }}"
env: "{{ env }}"
spec:
import: true
repository:
from:
kind: DockerImage
name: "{{ certified_operator_index }}"
importPolicy:
insecure: "{{ insecure_index_import | default(false) }}"
scheduled: true
referencePolicy:
type: Local

- name: Import redhat-marketplace-index imagestream
tags:
- import-index-images
no_log: true
ansible.builtin.uri:
url: "{{ ocp_host }}/apis/image.openshift.io/v1/namespaces/{{ oc_namespace }}/imagestreamimports"
method: POST
# The 'or' condition is needed to support Ansible versions < 2.13
validate_certs: "{{ lookup('env', 'K8S_AUTH_VERIFY_SSL', default='yes') or 'yes' }}"
status_code: 201
body_format: json
headers:
Authorization: "Bearer {{ ocp_token }}"
body:
apiVersion: image.openshift.io/v1
kind: ImageStreamImport
metadata:
name: redhat-marketplace-index
labels:
app: operator-pipeline
suffix: "{{ suffix }}"
env: "{{ env }}"
spec:
import: true
repository:
from:
kind: DockerImage
name: "{{ redhat_marketplace_index }}"
importPolicy:
insecure: "{{ insecure_index_import | default(false) }}"
scheduled: true
referencePolicy:
type: Local

0 comments on commit 0b006d9

Please sign in to comment.