Skip to content

Commit 2a8138b

Browse files
Added script to add qiita root-ca to environment.
Added script to add the root-ca used to sign Qiita's server.crt to qiita_client's environment. The functionality in this small script may be more useful if it becomes part of qiita_client itself.
1 parent 167c916 commit 2a8138b

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

.github/workflows/qiita-ci.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
jobs:
88
# derived from https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml
99
main:
10+
# 7/16/24: confirm current ubuntu-latest is still 22.04.
1011
runs-on: ubuntu-latest
1112

1213
strategy:
@@ -84,7 +85,6 @@ jobs:
8485
8586
export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/ci_server.crt
8687
export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg
87-
pip --quiet install -U pip
8888
8989
pip --quiet install https://github.com/qiita-spots/qtp-job-output-folder/archive/refs/heads/main.zip
9090
@@ -136,9 +136,14 @@ jobs:
136136
run: |
137137
conda activate qiita_client
138138
export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/ci_server.crt
139+
export QIITA_ROOT_CA=`pwd`/qiita-dev/qiita_core/support_files/ci_rootca.crt
139140
export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg
140-
export QP_KLP_CONFIG_FP=`pwd`/configuration.json
141141
export PYTHONWARNINGS="ignore:Certificate for localhost has no \`subjectAltName\`"
142+
143+
# before starting nosetests, add the root ca used to sign qiita's ci_server.crt file
144+
# to the environment's certifi store. This will prevent CERTIFICATE_VERIFY_FAILED
145+
# errors.
146+
python rootca_insert.py $QIITA_ROOT_CA
142147
nosetests --with-doctest --with-coverage -v --cover-package=qiita_client
143148
- uses: codecov/codecov-action@v3
144149
with:

rootca_insert.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import certifi
2+
from sys import argv
3+
4+
5+
def main(ca_fp):
6+
with open(ca_fp, 'rb') as f:
7+
my_ca = f.read()
8+
9+
ca_file = certifi.where()
10+
11+
with open(ca_file, 'ab') as f:
12+
f.write(my_ca)
13+
14+
print("%s updated" % ca_file)
15+
16+
17+
if __name__ == '__main__':
18+
main(argv[1])

0 commit comments

Comments
 (0)