Skip to content

Commit cd85ccd

Browse files
[ISV-4630] Integration tests verifies a bundle was released to index image (#661)
1 parent 997baf8 commit cd85ccd

File tree

6 files changed

+230
-54
lines changed

6 files changed

+230
-54
lines changed

.github/workflows/integration-tests.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ jobs:
2727
# Install python dependencies
2828
pip install --user openshift pygithub
2929
30+
# Add certificates to trusted list
31+
sudo cp operator-pipeline-images/certs/* /usr/local/share/ca-certificates
32+
# Rename all .pem files to .crt to allow update-ca-certificates
33+
for file in /usr/local/share/ca-certificates/*.pem
34+
do
35+
sudo mv "$file" "${file%.pem}.crt"
36+
done
37+
sudo update-ca-certificates
38+
3039
echo "${{ secrets.VAULT_PASSWORD }}" > "$HOME"/.vault-password
3140
3241
# secret used also in hosted pipeline for enabling
@@ -76,6 +85,15 @@ jobs:
7685
# Install python dependencies
7786
pip install --user openshift pygithub
7887
88+
# Add certificates to trusted list
89+
sudo cp operator-pipeline-images/certs/* /usr/local/share/ca-certificates
90+
# Rename all .pem files to .crt to allow update-ca-certificates
91+
for file in /usr/local/share/ca-certificates/*.pem
92+
do
93+
sudo mv "$file" "${file%.pem}.crt"
94+
done
95+
sudo update-ca-certificates
96+
7997
echo "${{ secrets.VAULT_PASSWORD }}" > "$HOME"/.vault-password
8098
8199
# secret used also in hosted pipeline for enabling

ansible/playbooks/community-operators-integration-tests.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
operator_package_name: test-e2e-community-operator
1616
operator_pipeline_url: "https://community-operator-pipeline-{{ oc_namespace }}.apps.pipelines-stage.0ce8.p1.openshiftapps.com"
1717
git_base_branch: community # contains config.yaml containing pointer to community-operators index
18+
organization: community-operators
1819
environment:
1920
K8S_AUTH_API_KEY: '{{ ocp_token }}'
2021
K8S_AUTH_HOST: '{{ ocp_host }}'
@@ -98,6 +99,14 @@
9899
tags:
99100
- test-community-release-pipeline
100101

102+
- name: Verify the Bundle was released to image indices
103+
vars:
104+
registry_access_token: "{{ stage_operator_pipelines_test_service_account_access_token }}"
105+
ocp_versions_range: "v4.11-v4.14"
106+
include_role:
107+
name: integration_tests
108+
tasks_from: check_bundle_existence_in_index_image
109+
101110
always:
102111
- name: Cleanup test data
103112
tags:

ansible/playbooks/operator-pipeline-integration-tests.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
src_operator_git_branch: e2e-test-operator
1414
src_operator_bundle_version: 0.0.8
1515
operator_package_name: test-e2e-operator
16+
organization: certified-operators
1617
environment:
1718
K8S_AUTH_API_KEY: '{{ ocp_token }}'
1819
K8S_AUTH_HOST: '{{ ocp_host }}'
@@ -101,6 +102,14 @@
101102
tags:
102103
- test-release-pipeline
103104

105+
- name: Verify the Bundle was released to image indices
106+
vars:
107+
registry_access_token: "{{ stage_operator_pipelines_test_service_account_access_token }}"
108+
ocp_versions_range: "v4.10"
109+
include_role:
110+
name: integration_tests
111+
tasks_from: check_bundle_existence_in_index_image
112+
104113
always:
105114
- name: Cleanup test data
106115
tags:
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
- name: Verify that bundle was released to index image
3+
vars:
4+
bundle_name: "{{ operator_package_name }}.v{{ operator_bundle_version }}"
5+
tmp_folder: /tmp/check_bundle
6+
block:
7+
8+
- name: Verify that bundle was released to index image
9+
10+
block:
11+
- name: Create directory for image data
12+
ansible.builtin.file:
13+
path: "{{ tmp_folder }}"
14+
state: directory
15+
mode: 0777
16+
17+
- name: Create directory for registry credentials
18+
ansible.builtin.file:
19+
path: "{{ tmp_folder }}/registry_certs/"
20+
state: directory
21+
mode: 0777
22+
23+
- name: Save credentials to file
24+
no_log: true
25+
ansible.builtin.copy:
26+
dest: "{{ tmp_folder }}/registry_certs/config.json"
27+
mode: 0777
28+
content: |
29+
{
30+
"auths": {
31+
"registry.stage.redhat.io": {
32+
"auth": "{{ registry_access_token }}"
33+
}
34+
}
35+
}
36+
37+
- name: Fetch index image list from Pyxis
38+
ansible.builtin.shell:
39+
cmd: "set -o pipefail && curl -X 'GET' 'https://catalog.redhat.com/api/containers/v1/operators/indices?filter=organization=={{ organization }}&page=0&page_size=100&include=data.path&ocp_versions_range={{ ocp_versions_range }}' -H 'accept: application/json' | jq -r '.data[].path' > {{ tmp_folder }}/image_versions.txt" # noqa: yaml[line-length]
40+
creates: "{{ tmp_folder }}/image_versions.txt"
41+
args:
42+
executable: /bin/bash
43+
44+
- name: Fetch details about all image bundles # noqa no-changed-when
45+
ansible.builtin.shell:
46+
cmd: |
47+
set -o pipefail &&
48+
export PATH="{{ temp_tools_dir.path }}:$PATH"
49+
while read image_url; do
50+
version=$(echo "$image_url" | sed 's/^.*:v//' )
51+
# Add stage to registry address
52+
address="registry.stage."$(echo "$image_url" | sed 's/^registry.//' )
53+
opm render $address > "{{ tmp_folder }}/info_$version.json"
54+
done < "{{ tmp_folder }}/image_versions.txt"
55+
environment:
56+
DOCKER_CONFIG: "{{ tmp_folder }}/registry_certs/"
57+
args:
58+
executable: /bin/bash
59+
60+
- name: Check that correct operator bundle is present in all images # noqa no-changed-when
61+
ansible.builtin.shell:
62+
cmd: |
63+
for info_file in {{ tmp_folder }}/info_*.json; do
64+
echo "Finding bundle {{ bundle_name }} in: $info_file"
65+
set -o pipefail &&
66+
jq 'select(.schema == "olm.bundle" and .name == "{{ bundle_name }}").name' "$info_file" | grep ^
67+
done
68+
args:
69+
executable: /bin/bash
70+
71+
always:
72+
- name: Cleanup folder
73+
ansible.builtin.file:
74+
path: "{{ tmp_folder }}"
75+
state: absent

ansible/roles/integration_tests/tasks/tools.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,11 @@
1515
remote_src: true
1616
include:
1717
- tkn
18+
19+
- name: Download and extract the opm binary
20+
ansible.builtin.unarchive:
21+
src: https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/latest-4.15/opm-linux.tar.gz
22+
dest: "{{ temp_tools_dir.path }}"
23+
remote_src: true
24+
include:
25+
- opm
Lines changed: 111 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,112 @@
11
$ANSIBLE_VAULT;1.1;AES256
2-
37626430393165626635363737306334623438363535353833626563303639666438636535326364
3-
3539386162383061376161313262323135343166386635380a366531353363343063316465653736
4-
63373538333763643831666138313863613863623439303133373636373931613734653337383437
5-
3831313639613339390a613838323364383562356235353761613862363830666530303835363637
6-
36616234346431393163663333373163323737633133646265336162333865363135343332353065
7-
34353033633330633363376239376361613163636236363037393330383935363134646437633561
8-
38336333636163633431353063626136663563616664386163633663646337333334336135653862
9-
33323330366462663435363562363533356265376332633238383762313135616438643330613235
10-
65346263653038613734626666633664636334343230333237386133363836343035306663336234
11-
34653139303064356430386133663732303365373066386337386433343262663931363564373963
12-
34356666613436303462613634643066336330666536396333633764313062616163656266333532
13-
62393737613233633736376232353831663165616230346362633038393861356132303932636164
14-
64616166383661323230626337303664653331656139313339656463386136636131396466616264
15-
39373337633766383161653835613139326564333764623264613065646163316365646365333333
16-
39313234646635393732396161313364383837366633306165326637633064353734373036346662
17-
34303231636138393736393466643732316165343762383266653833333862623334306539613364
18-
63663061623931666435373763616466376539626561303462313131333865656363613163663230
19-
64376135323434656561373266333831666335616430356235366664383432663537393061323962
20-
30316333396530616563633336643633326338636264356530363235373034363762346466306163
21-
39376563353234393866633633303462616361343631636431633735303932666134356230633431
22-
66623833636536653233313936643736623937613837383264383535623539363963316164326132
23-
32626434396532303866333062643635313530353961636438333965633632333838653361326466
24-
64303839383031313731303566386164333665643163666465393033333832383830633634643737
25-
39363166613431356165616337393238343237353639336564616237363537373538663733613761
26-
31653936363631356235373935343466643466623533386462356236383931623963663665666435
27-
37613065346461663565656432643262373362633563306531343139343562613335306166626339
28-
35376265653939633034363730396235393634323035633066316631303638306264343837666535
29-
34383436353432323936333831306466336238376263303565343763376636663332386435333933
30-
30666562303064616436306436666332653461313131636537313639356531326465616361666431
31-
64356330346530626262333130613565373239653437396161633837363664616364326361646562
32-
35393465636631343735313030383832306235363932393262323631643931333664306566663435
33-
64316231633361363861623335623465666265396666656534383936373131396235366239336161
34-
64643738363434326338646433656462656661613339393063363838633235653134373636383933
35-
66366334343738383063613366643435616537376166363361666461323536383366663139336437
36-
62303032313132656563306537373232616632666665663933326135396166653636326337623132
37-
66343265623961653633646663336639393338653766376464616631626630633335396639313936
38-
66323739306631613835303031656466366661613534383135643162623962623233613864303137
39-
62366537623466653631366237366239626636636262356237383963386133316438663238636366
40-
35666439623065336461623334336432613466383136613831363636356336653436323831643332
41-
63313937646332323632383634396163643761313064346230323832316361333033623662663032
42-
33623863626233636230303831333138636431633861616637656366373937666264616233393066
43-
66323433643065666335366362653763343164656436346630366539663730666631326662646339
44-
61653531326463356139633761646431646562346161363463626161643838323436663466363334
45-
35306531323865366430343230323833386135343062393339306537363630386335323038383235
46-
66623532643536616664646465343733373361366665303139316166613466313163613336663139
47-
34616661633765656433646231396263343732303366393036653831323339633436316534333038
48-
64316333353462666533643464363031373464363535326632353466376234336563326366393131
49-
33323035626430653239353135613735616133663863333132613637313838396265333261383837
50-
61663438633064376131396633363336373261343866613732323061386363663236663939626662
51-
33326631396330326361356339346237326332313066313662396463316564383439353734646439
52-
31363238303332396336306262336430353038353633313036313035353964306537656330646137
53-
64613635616639376534353931623735333261353464363337333161646434366230333063366538
54-
34303531306133626432623432323966373833363564363830323138326264383032616362326530
55-
6661353664373239376131646263336164343863353739626236
2+
30376237636135663136626466626664313738373064373134666161636131663434363436616134
3+
3531646463313636613938343237653832643639373762330a383639353930636165393539323138
4+
66653533313038666535306636636131383163363762326431613039353731336531663035623537
5+
3230623739636537610a343433383939626438316433356630373566323465343763323566373564
6+
63366166663536623136393538376532303230386336313961386237373232643936626235343966
7+
37396661616436393063323138386237336461373163376530663436326261336537376635393163
8+
31386639373861663465643939306363376534633735613966613661336633656639643134653066
9+
31653634336161373538613531656162313230613866343466666334383239383761653332376235
10+
62323961313335313232373162306666616663636530656463383738306266353137316239306132
11+
36373565363230323333393438623431343134343234313135633566316434666633663664376639
12+
39663935633433356534336537326631303865326534386230383361313961366238613135393362
13+
34323733653432343536363336343930616434633766356633303036346363326137383862633965
14+
38623464376561623335383633393731613733653438303234306236383465363364306237363930
15+
64613533333335663037396235353138633331636335316263633664313364646537343166306564
16+
64386464386661613365646130363066393739373036386331396161626131623935326338626461
17+
37666331326264643630613763666531663834656530326132616336663731343461626666326466
18+
66643362613730346466383562653437316630613365313435616336373265326637333264663666
19+
35396263393139386539656434396536666438613361323165616466613338323265383235323836
20+
38633137636539306561336539333963393764373733366336356437363031343263663731386430
21+
38666238623532626634326131653466646261653361646439356665353163613264636333323336
22+
38313334376232643935643161393530303064313931623863323563363132636666333730653565
23+
35356634636232326133303733623464386534356530396236363338373737663065356262646331
24+
30653061653735303937326133646631626265353234383636663533323036363238346136303364
25+
31336463616131366236623966656634363033343064323739373639326262303231323064363232
26+
62666564363331326666666131373464383261613064646265376661623861353461326633343831
27+
61313165323964623965616630363065353336643132363139303033633832353232613863326234
28+
66383037343562623364346639356463353334363664386134613361303938326132616239373466
29+
34633234623437633061393966346261643134356638333239333361623663373465346662616666
30+
62656465633461333064666632383737626632666232636435303062346438626131616363323831
31+
62323630326635666434373537326333376430383631303562323761306566646361393231633937
32+
35626633333031636238643664623034633763316438373231393132666239626233383531323532
33+
39633736623231333230653033376534333838383766356337346530393936386561343032393233
34+
33346233623730373965333137323763646233316138613761303738313739316132393066383662
35+
62306562356263326361643866373134303138643861633964343361363332623636336138663661
36+
66323734653663306537636366643035303663653734393136323436316465333939326532376634
37+
32366430626638333930363637323164303835343236643065326439646463663536303732306361
38+
30626330636335336530363234633230393132323933333331366637633661303433623539336264
39+
31663335653233356333383631323931616130323135346533636461653531623338353637643030
40+
34373638646439393334353439623230653763313165383338366263373534646562613863323464
41+
32623330353539646364626366373037393262366139326238646563393735653563346234396335
42+
30633430643262653365623432353863633934373463306466313233343632333832636461353734
43+
31393936386566626161313837373036326461363266366634643031313435633238636537383834
44+
38323935366266313638343633346536666633356431306333653462363738333461313563643832
45+
63316461353531623132633263333064323831633532343161636366393735306461666135383834
46+
32613364303630323231626339613135356263356537646530303335313936343032643831653338
47+
32393333323463306237353133633838326537326132626234383566333364383762363832366438
48+
36323832363335633936373865373062363461366436623535353062346361646431646362373564
49+
31323861383138656333303534626138616337623066323934343066626337646438323766303763
50+
64653064303331313063343962336664393635373232653038306661363863636233366536633561
51+
62353863333235356562633466373437633166323530653433316537643863346131306261386338
52+
65633439366137343339353937336535386261653961316565366239363937363964376638613062
53+
36323662626265626262656666376333393036353535323738316264656232316533386539346537
54+
36616464626464373462613465323531346338306361336535353331336431306336623162613637
55+
32316239333839636236383733303063646530326534343266333963393862393262613839653133
56+
39653661613735306166313563616130343831383465383066373061323635303337623838666332
57+
34396136653961353135373461303837353734363135353463346533633831633665313432356639
58+
65363036366431633665393735333862366364623534346563326332636366653936393832323236
59+
37373765343631666537386264306166306637353937336362656333363563663463373639303334
60+
38393730363038303838393534336662613063393765633634323861303932373635376631383739
61+
36616463366136393739333138643830313333633239633535613932366466313239646563383063
62+
63666565303834386564343337633535643238303433303330396337303437306536366636653135
63+
39366236383233313661313035653933363134663135396664363163643935316466393131643134
64+
38353735393166623035326439623565373335363236323936353761653761613963313038643934
65+
37666664323631353637356235656162366633653437333261343837383934616662633564653466
66+
32393236373461366161663438383261346634323263313435616230383130663337303232386133
67+
66346436353134343161323162366136616330303237663832346462633232343263616532396636
68+
61336135383637623262383033393534356131366264616565656239303832323434353364663939
69+
34633439633436353062626138356665646239626465373937393830343232393634643762303938
70+
31343865393236633961393531306333306532653038353135323335646661386532373163666162
71+
64653135393136646361646233666435373066313965356565633565363630353037643030633461
72+
32633535373035323464653732643939663337323337363061363633663564653937373365353636
73+
36303262356636383130653737666434393366623739343564316537663362636161656338663562
74+
30383835623237323266376333356663386336646161393064636536356363376161633739623837
75+
39626236623038383637666561636638356264393861323632376431333535363062396166633366
76+
33323531326437613439613136363961366664323434346466303466386234653332653938343635
77+
34376431653662653361363061313637653363353163623066616238343631363366336566356461
78+
62373165343966323136313735623962333066333861313764383439313763653365346632646564
79+
38373239393731333434373336336537313063316535396565613762373930303436646666306532
80+
33346561313535633738313731643232643431616536613231353361656638313364656438396535
81+
65663561663931303262303438656366353939303066663736646438313032643134313031653562
82+
34653166376534343862653635383264633439343236363336663937633666646561343565663566
83+
65316531363238336466666636643131633733393136326135313436313734613634356337653536
84+
63663134306137306566663135303137303334656233653838626163613838356662616436653632
85+
64643330383039373636663033363737636136373563323236386439616165646166363162376162
86+
38373937623537643436346438343738633338633230303334383830393730336536636265626166
87+
65656637666163353462633335366137353136663265633439626164663965316531313837326666
88+
32373831363535383631353734366665656561363031646561346534326537646430306430353536
89+
63303236353733363236383661333864376234343733356436396435646637363138353837333736
90+
39386564306332633965393037626466333930313335613430386563376430326566613264383239
91+
62623066616661666263613866396639353561343165333962366662643434373162336435646339
92+
32646633643163623362373063646463353931373137333138353262323363653162323961303738
93+
64616663666662386537613430623238653334616565323130343166313863343561333561316238
94+
65633534303036303965383338653232386662326335393464323131633136666463643966326333
95+
35613832663435323162313166643432383835383534336239386237366630393030343033306361
96+
66376638353364393762343332356666646339316331623636656539313431656162376531663938
97+
34323865653538353838386130316234393137393062666433353132633730313136633633363738
98+
31323238303661616535656563333536313663376632326161613565373631386533633464383235
99+
36353538653766393439313963306562363137383162343935313933616365373837343137363862
100+
36383334313763356166383663623363376264633765343130373930333065346439636432343866
101+
30653834373939636365623035623562343431623339616136393436616536323837356439363366
102+
36343965376662333931376137396666396562656230396466643066363630333735636434626666
103+
32633338626134333132613364313130343664393034653439383231363138626431353562333935
104+
66383633356130333061303832353862623563313737393034353161383132623664643936626461
105+
35623263623134346332343131363637623431663362616265353264313162313666323030623234
106+
35363339333533366661633436613433323134623339613830373634386266653933643662666465
107+
34383161373863323366313832636362376266396466656266303233666164343130666465313238
108+
33643031333632376162653137373235333234666239383337366563326166323834393335393632
109+
35346435636330633231613539626330373365356465366561386332333736386461613435396165
110+
39303163373037366634386333343437316134383934343636663538663866643839303165386366
111+
61306439353233393233303164313639663439306532376532643238373862653838323637323037
112+
323535383031333435306239306265663761

0 commit comments

Comments
 (0)