Skip to content

Commit ea62b81

Browse files
fix: cicd mpi issue and adding conditional encrypted log uploads (#4319)
* chore: empty commit * chore: adding changelog file 4319.fixed.md [dependabot-skip] * feat: add log upload options with encryption for local and remote testing workflows * chore: clean up whitespace in workflow YAML files * feat: add upload logs option for local and remote testing workflows * feat: add log encryption key to CI jobs for enhanced security * fix: set upload-logs to true in CI jobs for consistent logging * fix: remove unnecessary './' prefix from log file paths in display_logs_locals.sh * fix: update ubuntu version identifiers in build_matrix.sh for consistency * fix: enhance log display in display_logs_remote.sh for better debugging * fix: add MPI environment variable for CICD version in start_mapdl.sh * fix: add MPI switches for CICD version in test-local workflow * fix: quote MPI variable in docker run command for proper handling * fix: remove quotes around MPI variable in docker run command for proper execution * fix: remove quotes around MPI switches in CICD testing for proper environment variable handling * fix: remove quotes around LOG_NAMES variable in log display scripts for consistency * fix: reduce maxfail and reruns in pytest arguments for local and remote testing * fix: add MAPDL_IMAGE environment variable to start_mapdl.sh for Docker container * fix: update mapdl-version in CI configuration for consistency across builds * fix: update test_dpf condition to exclude version 24 in CI configuration * fix: remove MPI argument from docker run command in start_mapdl.sh * fix: remove 'v24.2-ubuntu-cicd' from version list in build_matrix.sh * fix: remove MPI argument for non-CICD versions in start_mapdl.sh * fix: add echo statement for default MPI version in entrypoint.sh * Revert display_logs scripts to match main * revert: "fix: remove 'v24.2-ubuntu-cicd' from version list in build_matrix.sh" This reverts commit 2de6ecc. * fix: remove 'v24.2-ubuntu-cicd' from version list in build_matrix.sh * fix: disable log uploads in CI for remote and local builds * chore: adding changelog file 4319.fixed.md [dependabot-skip] --------- Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent 8efc45e commit ea62b81

File tree

7 files changed

+128
-34
lines changed

7 files changed

+128
-34
lines changed

.ci/build_matrix.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ versions=(
1111
'latest-ubuntu-student'
1212
'v25.2.0'
1313
'v25.1.0'
14-
'v25.1-ubuntu'
14+
'v25.1-ubuntu-cicd'
1515
'v25.1-ubuntu-student'
1616
'v24.2.0'
17-
'v24.2-ubuntu'
1817
'v24.1.0'
1918
'v24.1-ubuntu'
2019
'v23.2.0'

.ci/entrypoint.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
23
export OMPI_ALLOW_RUN_AS_ROOT=1
34
export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
45

@@ -15,6 +16,7 @@ if [ -n "${ANSYS_DPF_ACCEPT_LA}" ]; then
1516
fi
1617
fi
1718

19+
1820
echo "RUN_DPF_SERVER: $RUN_DPF_SERVER"
1921

2022
if [ "$RUN_DPF_SERVER" == "true" ]; then
@@ -23,7 +25,16 @@ if [ "$RUN_DPF_SERVER" == "true" ]; then
2325
echo "DPF server started."
2426
fi
2527

28+
if [[ $MAPDL_VERSION == *"cicd"* ]] ; then
29+
echo "Using OpenMPI for CICD version"
30+
export MPI="-mpi openmpi"
31+
32+
else
33+
echo "Using default MPI version"
34+
export MPI=""
35+
fi;
36+
2637
echo "Starting MAPDL..."
2738
echo "Using executable path: ${EXEC_PATH}"
2839

29-
$EXEC_PATH -grpc -dir /jobs -"${DISTRIBUTED_MODE}" -np 2 -db -6000 -m -6000 -
40+
$EXEC_PATH -grpc -dir /jobs -"${DISTRIBUTED_MODE}" -np 2 -db -6000 -m -6000 "${MPI}" -

.ci/start_mapdl.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ if [[ $MAPDL_VERSION == *"cicd"* ]] ; then
7979

8080
echo "Overriding DISTRIBUTED_MODE to 'dmp' for CICD version"
8181
export DISTRIBUTED_MODE="dmp"
82+
8283
else
8384
export DPF_PORT_ARG=""
8485
export DB_INT_PORT=50055
@@ -108,6 +109,7 @@ run \
108109
-e DPF_PORT_INTERNAL=${DPF_PORT_INTERNAL} \
109110
-e EXEC_PATH=${EXEC_PATH} \
110111
-e DISTRIBUTED_MODE=${DISTRIBUTED_MODE} \
112+
-e MAPDL_IMAGE=${MAPDL_IMAGE} \
111113
--shm-size=2gb \
112114
-e I_MPI_SHM_LMT=shm \
113115
-e P_SCHEMA=${P_SCHEMA} \

.github/workflows/ci.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
permissions:
4545
pull-requests: write
4646
steps:
47-
- uses: actions-ecosystem/action-add-assignees@a5b84af721c4a621eb9c7a4a95ec20a90d0b88e9 #v1.0.1
47+
- uses: actions-ecosystem/action-add-assignees@a5b84af721c4a621eb9c7a4a95ec20a90d0b88e9 #v1.0.1
4848
if: |
4949
(
5050
github.event_name == 'pull_request' &&
@@ -238,10 +238,11 @@ jobs:
238238
codecov-token: ${{ secrets.CODECOV_TOKEN }}
239239
token: ${{ secrets.GITHUB_TOKEN }}
240240
username: ${{ github.actor }}
241+
log-encryption-key: ${{ secrets.LOG_ENCRYPTION_KEY }}
241242
with:
242243
mapdl-version: "${{ matrix.mapdl-version }}"
243244
file-name: "remote-${{ matrix.mapdl-version }}"
244-
245+
upload-logs: false
245246

246247
build-test-local-matrix:
247248
name: "Build test matrix for minimal and local"
@@ -282,14 +283,16 @@ jobs:
282283
codecov-token: ${{ secrets.CODECOV_TOKEN }}
283284
token: ${{ secrets.GITHUB_TOKEN }}
284285
username: ${{ github.actor }}
286+
log-encryption-key: ${{ secrets.LOG_ENCRYPTION_KEY }}
285287
with:
286288
testing-minimal: false
287289
pytest-arguments: '--reset_only_failed --add_missing_images'
288290
mapdl-version: ${{ matrix.mapdl-version }}
289291
file-name: "local-${{ matrix.mapdl-version }}"
290292
tags: "local"
291293
latest-version: "252"
292-
test_dpf: ${{ contains(matrix.mapdl-version, 'cicd') }}
294+
test_dpf: ${{ contains(matrix.mapdl-version, 'cicd') && !contains(matrix.mapdl-version, '24') }}
295+
upload-logs: false
293296

294297

295298
build-test-ubuntu-minimal:
@@ -303,12 +306,13 @@ jobs:
303306
strategy:
304307
fail-fast: false
305308
matrix:
306-
mapdl-version: ['v25.2-ubuntu-cicd', 'v25.1-ubuntu']
309+
mapdl-version: ['v25.2-ubuntu-cicd', 'v25.1-ubuntu-cicd']
307310
secrets:
308311
license-server: ${{ secrets.LICENSE_SERVER }}
309312
codecov-token: ${{ secrets.CODECOV_TOKEN }}
310313
token: ${{ secrets.GITHUB_TOKEN }}
311314
username: ${{ github.actor }}
315+
log-encryption-key: ${{ secrets.LOG_ENCRYPTION_KEY }}
312316
with:
313317
testing-minimal: true
314318
pytest-arguments: ''
@@ -317,6 +321,7 @@ jobs:
317321
tags: "local,minimal"
318322
latest-version: "252"
319323
test_dpf: false
324+
upload-logs: false
320325

321326

322327
build-test-ubuntu-console:
@@ -330,12 +335,13 @@ jobs:
330335
strategy:
331336
fail-fast: false
332337
matrix:
333-
mapdl-version: ['v25.2-ubuntu-cicd', 'v25.1-ubuntu']
338+
mapdl-version: ['v25.2-ubuntu-cicd', 'v25.1-ubuntu-cicd']
334339
secrets:
335340
license-server: ${{ secrets.LICENSE_SERVER }}
336341
codecov-token: ${{ secrets.CODECOV_TOKEN }}
337342
token: ${{ secrets.GITHUB_TOKEN }}
338343
username: ${{ github.actor }}
344+
log-encryption-key: ${{ secrets.LOG_ENCRYPTION_KEY }}
339345
with:
340346
latest-version: "252"
341347
mapdl-version: ${{ matrix.mapdl-version }}
@@ -345,7 +351,7 @@ jobs:
345351
file-name: "${{ matrix.mapdl-version }}-console"
346352
tags: "local,console"
347353
test_dpf: false
348-
354+
upload-logs: false
349355

350356
package:
351357
name: "Package library"

.github/workflows/test-local.yml

Lines changed: 53 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,28 @@ on:
3131
required: false
3232
type: boolean
3333
default: false
34-
34+
3535
test_dpf:
3636
description: |
3737
If true, the DPF tests will be run.
3838
required: false
3939
type: boolean
4040
default: true
41-
41+
4242
on-console:
4343
description: |
4444
If true, the tests will be run on console.
4545
required: false
4646
type: boolean
4747
default: false
4848

49+
upload-logs:
50+
description: |
51+
If true, logs will be uploaded encrypted. Set to false to disable log upload (for security).
52+
required: false
53+
type: boolean
54+
default: false
55+
4956
file-name:
5057
description: |
5158
Name of the file to save the logs.
@@ -72,7 +79,7 @@ on:
7279
required: false
7380
type: string
7481
default: ghcr.io/ansys/mapdl
75-
82+
7683
runner:
7784
description: |
7885
Runner to use.
@@ -86,7 +93,7 @@ on:
8693
required: false
8794
type: string
8895
default: "3.12"
89-
96+
9097
secrets:
9198
license-server:
9299
description: |
@@ -97,12 +104,17 @@ on:
97104
description: |
98105
Token for Codecov.
99106
required: true
100-
107+
108+
log-encryption-key:
109+
description: |
110+
Encryption key for sensitive log files.
111+
required: false
112+
101113
token:
102114
description: |
103115
Token for GitHub. Used also for login into ghcr.io.
104116
required: true
105-
117+
106118
username:
107119
description: |
108120
GitHub username for login into ghcr.io.
@@ -126,7 +138,7 @@ jobs:
126138
TESTING_MINIMAL: ${{ inputs.testing-minimal }}
127139
P_SCHEMA: "/ansys_inc/v241/ansys/ac4/schema"
128140
PYTEST_TIMEOUT: 120 # seconds. Limit the duration for each unit test
129-
PYTEST_ARGUMENTS: '-vvv -ra --color=yes --durations=30 --random-order --random-order-bucket=class --maxfail=10 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html --timeout=180 --profile-svg --profile --report-log-exclude-logs-on-passed-tests --strict-markers'
141+
PYTEST_ARGUMENTS: '-vvv -ra --color=yes --durations=30 --random-order --random-order-bucket=class --maxfail=2 --reruns 2 --reruns-delay 2 --cov=ansys.mapdl.core --cov-report=html --timeout=180 --profile-svg --profile --report-log-exclude-logs-on-passed-tests --strict-markers'
130142
OMPI_ALLOW_RUN_AS_ROOT: 1
131143
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
132144
DATAPROCESSING_DEBUG: /home/mapdl/dpf_logs
@@ -168,19 +180,20 @@ jobs:
168180
if [[ "${MAPDL_VERSION}" == *"cicd"* ]]; then
169181
echo "CICD MAPDL version detected, testing DPF backend for results module.";
170182
echo "TEST_DPF_BACKEND=true" >> $GITHUB_ENV;
183+
echo "PYMAPDL_ADDITIONAL_SWITCHES=-mpi openmpi" >> $GITHUB_ENV;
171184
fi
172185
173186
echo "ON_STUDENT: $ON_STUDENT"
174187
echo "TAG_STUDENT: $TAG_STUDENT"
175188
echo "ON_STUDENT=$(echo $ON_STUDENT)" >> $GITHUB_OUTPUT
176189
echo "TAG_STUDENT=$(echo $TAG_STUDENT)" >> $GITHUB_OUTPUT
177-
190+
178191
- name: "Install gcc"
179192
shell: bash
180193
if: ${{ contains(inputs.mapdl-version, 'cicd') }}
181194
run: |
182195
apt-get update && apt-get -y install gcc mono-mcs g++
183-
196+
184197
185198
- name: "Installing minimal OS packages"
186199
shell: bash
@@ -295,12 +308,37 @@ jobs:
295308
run: |
296309
.ci/collect_mapdl_logs_locals.sh
297310
298-
# - name: "Upload logs to GitHub"
299-
# if: always()
300-
# uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
301-
# with:
302-
# name: logs-${{ inputs.file-name }}.tgz
303-
# path: ./logs-${{ inputs.file-name }}.tgz
311+
- name: "Encrypt and upload logs to GitHub"
312+
if: always() && inputs.upload-logs == true
313+
env:
314+
ENCRYPTION_KEY: ${{ secrets.log-encryption-key }}
315+
FILE_NAME: ${{ inputs.file-name }}
316+
shell: bash
317+
run: |
318+
# Check if logs exist
319+
if [ -f "./logs-${FILE_NAME}.tgz" ]; then
320+
echo "Encrypting logs..."
321+
322+
# Encrypt using OpenSSL (already available in container)
323+
openssl enc -aes-256-cbc -salt -pbkdf2 \
324+
-in ./logs-${FILE_NAME}.tgz \
325+
-out ./logs-${FILE_NAME}.tgz.enc \
326+
-pass env:ENCRYPTION_KEY
327+
328+
echo "Logs encrypted successfully"
329+
echo "To decrypt locally, use:"
330+
echo "openssl enc -aes-256-cbc -d -pbkdf2 -in logs-${FILE_NAME}.tgz.enc -out logs-${FILE_NAME}.tgz -pass pass:YOUR_KEY"
331+
else
332+
echo "No log file found to encrypt"
333+
fi
334+
335+
- name: "Upload encrypted logs to GitHub"
336+
if: always() && inputs.upload-logs == true
337+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
338+
with:
339+
name: logs-${{ inputs.file-name }}-encrypted
340+
path: ./logs-${{ inputs.file-name }}.tgz.enc
341+
retention-days: 3
304342

305343
- name: "Display files structure"
306344
if: always()

.github/workflows/test-remote.yml

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ on:
1818
required: true
1919
type: string
2020

21+
upload-logs:
22+
description: |
23+
If true, logs will be uploaded encrypted. Set to false to disable log upload (for security).
24+
required: false
25+
type: boolean
26+
default: false
27+
2128
python-version:
2229
description: |
2330
Python version to use.
@@ -30,7 +37,7 @@ on:
3037
description: |
3138
Username for the GitHub container registry.
3239
required: true
33-
40+
3441
token:
3542
description: |
3643
Token for GitHub.
@@ -40,12 +47,17 @@ on:
4047
description: |
4148
License server for ANSYS MAPDL
4249
required: true
43-
50+
4451
codecov-token:
4552
description: |
4653
Token for Codecov.
4754
required: true
4855

56+
log-encryption-key:
57+
description: |
58+
Encryption key for sensitive log files.
59+
required: false
60+
4961
permissions: {}
5062

5163
jobs:
@@ -73,7 +85,7 @@ jobs:
7385
DPF_START_SERVER: False
7486
HAS_DPF: True
7587
TEST_DPF_BACKEND: false
76-
PYTEST_ARGUMENTS: '-vvv -ra --color=yes --durations=30 --random-order --random-order-bucket=class --maxfail=10 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html --timeout=180 --profile-svg --profile --report-log-exclude-logs-on-passed-tests --strict-markers'
88+
PYTEST_ARGUMENTS: '-vvv -ra --color=yes --durations=30 --random-order --random-order-bucket=class --maxfail=2 --reruns 2 --reruns-delay 2 --cov=ansys.mapdl.core --cov-report=html --timeout=180 --profile-svg --profile --report-log-exclude-logs-on-passed-tests --strict-markers'
7789
MAPDL_PACKAGE: ghcr.io/ansys/mapdl
7890

7991
steps:
@@ -154,7 +166,7 @@ jobs:
154166
echo "TAG_STUDENT: $TAG_STUDENT"
155167
echo "ON_STUDENT=$(echo $ON_STUDENT)" >> $GITHUB_OUTPUT
156168
echo "TAG_STUDENT=$(echo $TAG_STUDENT)" >> $GITHUB_OUTPUT
157-
169+
158170
- name: "Pull, launch, and validate MAPDL service"
159171
id: start_mapdl
160172
env:
@@ -320,12 +332,37 @@ jobs:
320332
run: |
321333
.ci/collect_mapdl_logs_remote.sh
322334
323-
# - name: "Upload logs to GitHub"
324-
# if: always()
325-
# uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
326-
# with:
327-
# name: logs-${{ inputs.file-name }}.tgz
328-
# path: ./logs-${{ inputs.file-name }}.tgz
335+
- name: "Encrypt and upload logs to GitHub"
336+
if: always() && inputs.upload-logs == true
337+
env:
338+
ENCRYPTION_KEY: ${{ secrets.log-encryption-key }}
339+
FILE_NAME: ${{ inputs.file-name }}
340+
shell: bash
341+
run: |
342+
# Check if logs exist
343+
if [ -f "./logs-${FILE_NAME}.tgz" ]; then
344+
echo "Encrypting logs..."
345+
346+
# Encrypt using OpenSSL
347+
openssl enc -aes-256-cbc -salt -pbkdf2 \
348+
-in ./logs-${FILE_NAME}.tgz \
349+
-out ./logs-${FILE_NAME}.tgz.enc \
350+
-pass env:ENCRYPTION_KEY
351+
352+
echo "Logs encrypted successfully"
353+
echo "To decrypt locally, use:"
354+
echo "openssl enc -aes-256-cbc -d -pbkdf2 -in logs-${FILE_NAME}.tgz.enc -out logs-${FILE_NAME}.tgz -pass pass:YOUR_KEY"
355+
else
356+
echo "No log file found to encrypt"
357+
fi
358+
359+
- name: "Upload encrypted logs to GitHub"
360+
if: always() && inputs.upload-logs == true
361+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
362+
with:
363+
name: logs-${{ inputs.file-name }}-encrypted
364+
path: ./logs-${{ inputs.file-name }}.tgz.enc
365+
retention-days: 3
329366

330367
- name: "Display files structure"
331368
if: always()

doc/changelog.d/4319.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Cicd mpi issue and adding conditional encrypted log uploads

0 commit comments

Comments
 (0)