@@ -10,18 +10,23 @@ jobs:
1010 env :
1111 SF_AUTOUPDATE_DISABLE : true
1212 NO_COLOR : ' 1'
13- # Path the mock server writes its self-signed TLS cert to. The CA-trust
14- # env vars (NODE_EXTRA_CA_CERTS / REQUESTS_CA_BUNDLE) are set per-step on
15- # only the run/deploy steps — setting them job-wide would point pip/poetry
16- # at a cert file that does not exist yet during setup, breaking installs.
13+ # Mock server's TLS cert/key pair.
1714 MOCK_SF_CERT_FILE : ${{ github.workspace }}/mock_sf_cert.pem
15+ MOCK_SF_KEY_FILE : ${{ github.workspace }}/mock_sf_key.pem
1816
1917 steps :
2018 # ── Setup ─────────────────────────────────────────────────────────────────
2119
2220 - name : Checkout code
2321 uses : actions/checkout@v4
2422
23+ - name : Generate mock server TLS cert
24+ run : |
25+ openssl req -x509 -newkey rsa:2048 -nodes \
26+ -keyout "$MOCK_SF_KEY_FILE" -out "$MOCK_SF_CERT_FILE" \
27+ -days 1 -subj "/CN=localhost" \
28+ -addext "subjectAltName=DNS:localhost,IP:127.0.0.1"
29+
2530 - name : Set up Python 3.11
2631 uses : actions/setup-python@v5
2732 with :
6166 # ── Mock Salesforce server + fake org auth ────────────────────────────────
6267
6368 - name : Start mock Salesforce server
64- run : |
65- python scripts/mock_sf_server.py &
66- # Wait for the TLS cert the server writes at startup so clients can trust it.
67- for _ in $(seq 1 30); do
68- [ -f "$MOCK_SF_CERT_FILE" ] && break
69- sleep 0.2
70- done
71- test -f "$MOCK_SF_CERT_FILE" || { echo "::error::mock server never wrote $MOCK_SF_CERT_FILE"; exit 1; }
69+ run : python scripts/mock_sf_server.py &
7270 env :
7371 MOCK_SF_PORT : ' 8888'
7472
@@ -177,8 +175,8 @@ jobs:
177175
178176 - name : ' [script] run — sf data-code-extension script run --entrypoint testScript/payload/entrypoint.py -o dev1'
179177 env :
180- NODE_EXTRA_CA_CERTS : ${{ github.workspace }}/mock_sf_cert.pem
181- REQUESTS_CA_BUNDLE : ${{ github.workspace }}/mock_sf_cert.pem
178+ NODE_EXTRA_CA_CERTS : ${{ env.MOCK_SF_CERT_FILE }}
179+ REQUESTS_CA_BUNDLE : ${{ env.MOCK_SF_CERT_FILE }}
182180 run : |
183181 sf data-code-extension script run \
184182 --entrypoint testScript/payload/entrypoint.py \
@@ -191,8 +189,8 @@ jobs:
191189
192190 - name : ' [script] deploy — sf data-code-extension script deploy'
193191 env :
194- NODE_EXTRA_CA_CERTS : ${{ github.workspace }}/mock_sf_cert.pem
195- REQUESTS_CA_BUNDLE : ${{ github.workspace }}/mock_sf_cert.pem
192+ NODE_EXTRA_CA_CERTS : ${{ env.MOCK_SF_CERT_FILE }}
193+ REQUESTS_CA_BUNDLE : ${{ env.MOCK_SF_CERT_FILE }}
196194 run : |
197195 sf data-code-extension script deploy \
198196 --name test-script-deploy \
@@ -281,8 +279,8 @@ jobs:
281279
282280 - name : ' [function] run — sf data-code-extension function run --entrypoint testFunction/payload/entrypoint.py --test-with testFunction/payload/tests/test.json -o dev1'
283281 env :
284- NODE_EXTRA_CA_CERTS : ${{ github.workspace }}/mock_sf_cert.pem
285- REQUESTS_CA_BUNDLE : ${{ github.workspace }}/mock_sf_cert.pem
282+ NODE_EXTRA_CA_CERTS : ${{ env.MOCK_SF_CERT_FILE }}
283+ REQUESTS_CA_BUNDLE : ${{ env.MOCK_SF_CERT_FILE }}
286284 run : |
287285 sf data-code-extension function run \
288286 --entrypoint testFunction/payload/entrypoint.py \
@@ -295,8 +293,8 @@ jobs:
295293
296294 - name : ' [function] deploy — sf data-code-extension function deploy'
297295 env :
298- NODE_EXTRA_CA_CERTS : ${{ github.workspace }}/mock_sf_cert.pem
299- REQUESTS_CA_BUNDLE : ${{ github.workspace }}/mock_sf_cert.pem
296+ NODE_EXTRA_CA_CERTS : ${{ env.MOCK_SF_CERT_FILE }}
297+ REQUESTS_CA_BUNDLE : ${{ env.MOCK_SF_CERT_FILE }}
300298 run : |
301299 sf data-code-extension function deploy \
302300 --name test-function-deploy \
0 commit comments