Skip to content

Commit d6c7636

Browse files
committed
Merge branch 'devel' of github.com:ORNL/DataFed into devel
2 parents ee0f50d + 9586f3f commit d6c7636

File tree

16 files changed

+708
-44
lines changed

16 files changed

+708
-44
lines changed

.github/workflows/javascript-format.yml

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,48 @@ jobs:
88
# Step 1: Checkout the repository
99
- name: Checkout Code
1010
uses: actions/checkout@v4
11+
with:
12+
token: ${{ secrets.GITHUB_TOKEN }}
13+
ref: ${{ github.head_ref || github.ref }}
1114

1215
# Step 2: Set up Node.js environment
1316
- name: Set up Node.js
1417
uses: actions/setup-node@v4
1518
with:
16-
node-version: "18" # Specify your Node.js version
19+
node-version: "18"
1720

18-
# Step 3: Install Prettier and ESLint globally
21+
# Step 3: Install Prettier
1922
- name: Install Prettier
20-
run: |
21-
npm install -g prettier
23+
run: npm install -g prettier
2224

2325
# Step 4: Run Prettier to format code
24-
- name: Run prettier
26+
- name: Format JavaScript files
2527
run: |
28+
echo "Auto-formatting JavaScript files..."
2629
prettier "**/*.js" --write
27-
git diff
28-
git reset --hard
29-
prettier --check "**/*.js"
30+
echo "Formatting complete"
31+
32+
# Step 5: Check for changes and commit if needed
33+
- name: Commit changes
34+
run: |
35+
# Get the original commit author info
36+
AUTHOR_NAME=$(git log -1 --pretty=format:'%an')
37+
AUTHOR_EMAIL=$(git log -1 --pretty=format:'%ae')
38+
39+
# Use original author for the formatting commit
40+
git config --local user.email "$AUTHOR_EMAIL"
41+
git config --local user.name "$AUTHOR_NAME"
3042
31-
# Step 5: Report status
32-
- name: Complete
33-
run: echo "Formatting completed successfully!"
43+
# Check if there are any changes
44+
if [[ -n $(git status -s) ]]; then
45+
echo "Formatting changes detected, creating commit..."
46+
echo "Committing as: $AUTHOR_NAME <$AUTHOR_EMAIL>"
47+
git add -A
48+
git commit -m "chore: Auto-format JavaScript files with Prettier"
49+
50+
# Push changes
51+
git push
52+
echo "Changes committed and pushed"
53+
else
54+
echo "No formatting changes needed"
55+
fi

.github/workflows/shell-format.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,43 @@ jobs:
1515
steps:
1616
- name: Checkout repository
1717
uses: actions/checkout@v4
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
ref: ${{ github.head_ref || github.ref }}
1821

1922
- name: Install shfmt
2023
run: |
2124
sudo apt-get update
2225
sudo apt-get install -y shfmt
2326
24-
- name: Check shell script formatting
27+
- name: Format shell scripts
2528
run: |
29+
echo "Auto-formatting shell scripts..."
2630
# Run in check mode: if reformatting would be needed, it will fail
2731
# Use indentation space of 2 spaces
28-
shfmt -i 2 -d .
29-
echo "To fix run: shfmt -i 2 -w -d ."
32+
shfmt -i 2 -w .
33+
echo "Formatting complete"
34+
35+
- name: Commit changes
36+
run: |
37+
# Get the original commit author info
38+
AUTHOR_NAME=$(git log -1 --pretty=format:'%an')
39+
AUTHOR_EMAIL=$(git log -1 --pretty=format:'%ae')
40+
41+
# Use original author for the formatting commit
42+
git config --local user.email "$AUTHOR_EMAIL"
43+
git config --local user.name "$AUTHOR_NAME"
44+
45+
# Check if there are any changes
46+
if [[ -n $(git status -s) ]]; then
47+
echo "Formatting changes detected, creating commit..."
48+
echo "Committing as: $AUTHOR_NAME <$AUTHOR_EMAIL>"
49+
git add -A
50+
git commit -m "chore: Auto-format shell scripts with shfmt"
51+
52+
# Push changes
53+
git push
54+
echo "Changes committed and pushed"
55+
else
56+
echo "No formatting changes needed"
57+
fi

.gitlab/build/build_foxx_image.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ build-foxx:
2626
- core/CMakeLists.txt
2727
- common/proto/**/*
2828
- .gitlab-ci.yml
29+
- .gitlab/**/*
2930
- CMakeLists.txt
3031
when: on_success
3132

@@ -49,6 +50,7 @@ retag-image:
4950
- core/CMakeLists.txt
5051
- common/proto/**/*
5152
- .gitlab-ci.yml
53+
- .gitlab/**/*
5254
- CMakeLists.txt
5355
when: never
5456
- when: on_success

.gitlab/end_to_end.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ end-to-end-foxx-setup:
3939
- ./scripts/generate_datafed.sh
4040
- env > env_file
4141
- mkdir foxx_tmp
42+
- chmod 774 foxx_tmp
4243
- ls -la foxx_tmp
4344
- if [ -f foxx_tmp/.foxx_is_installed ]; then rm foxx_tmp/.foxx_is_installed; fi
4445
- docker login "${REGISTRY}" -u "${HARBOR_USER}" -p "${HARBOR_DATAFED_GITLAB_CI_REGISTRY_TOKEN}"
@@ -50,14 +51,15 @@ end-to-end-foxx-setup:
5051
- echo "#!/bin/bash" > "${RUN_FILE}"
5152
- echo "docker run -d \\" >> "${RUN_FILE}"
5253
- echo "--name \"${CONTAINER_NAME}\" \\" >> "${RUN_FILE}"
54+
- echo "--user \"${USER_ID}:0\" \\" >> "${RUN_FILE}"
55+
- echo "--security-opt no-new-privileges \\" >> "${RUN_FILE}"
5356
- echo "-e DATAFED_ZEROMQ_SYSTEM_SECRET=\"$CI_DATAFED_ZEROMQ_SYSTEM_SECRET\" \\" >> "${RUN_FILE}"
5457
- echo "-e ENABLE_FOXX_TESTS=\"TRUE\" \\" >> "${RUN_FILE}"
5558
- echo "-e DATAFED_DOMAIN=\"$CI_DATAFED_DOMAIN\" \\" >> "${RUN_FILE}"
5659
- echo "-e DATAFED_DATABASE_PASSWORD=\"$CI_DATAFED_DATABASE_PASSWORD\" \\" >> "${RUN_FILE}"
5760
- echo "-e DATAFED_DATABASE_IP_ADDRESS_PORT=\"$CI_DATAFED_DATABASE_IP_ADDRESS_PORT\" \\" >> "${RUN_FILE}"
5861
- echo "-e DATAFED_DATABASE_HOST=\"$CI_DATAFED_DATABASE_HOST\" \\" >> "${RUN_FILE}"
5962
- echo "-e DATAFED_DEFAULT_LOG_PATH=\"$CONTAINER_LOG_FILE_PATH\" \\" >> "${RUN_FILE}"
60-
- echo "-e UID=\"$USER_ID\" \\" >> "${RUN_FILE}"
6163
- echo "-v \"${HOST_LOG_FILE_PATH}:${CONTAINER_LOG_FILE_PATH}\" \\" >> "${RUN_FILE}"
6264
- echo "-v \"./foxx_tmp:/tmp\" \\" >> "${RUN_FILE}"
6365
- echo "-t \"${REGISTRY}/${PROJECT}/${COMPONENT}-${BRANCH_LOWER}:${CI_COMMIT_SHA}\"" >> "${RUN_FILE}"

CMakeLists.txt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,18 @@ if(CMAKE_MAKE_PROGRAM MATCHES "(make|gmake)")
108108
add_definitions( -Wall -Wextra )
109109
endif()
110110

111-
configure_file(
112-
"${CMAKE_CURRENT_SOURCE_DIR}/common/proto/common/Version.proto.in"
113-
"${CMAKE_CURRENT_SOURCE_DIR}/common/proto/common/Version.proto"
114-
@ONLY)
115111

116-
# Create file glob here because need to be made visible here as well
117-
file( GLOB ProtoFiles "${PROJECT_SOURCE_DIR}/common/proto/common/*.proto" )
112+
if ( BUILD_REPO_SERVER OR BUILD_CORE_SERVER OR BUILD_AUTHZ OR BUILD_COMMON OR BUILD_PYTHON_CLIENT OR BUILD_WEB_SERVER)
113+
configure_file(
114+
"${CMAKE_CURRENT_SOURCE_DIR}/common/proto/common/Version.proto.in"
115+
"${CMAKE_CURRENT_SOURCE_DIR}/common/proto/common/Version.proto"
116+
@ONLY)
117+
118+
# Create file glob here because need to be made visible here as well
119+
file( GLOB ProtoFiles "${PROJECT_SOURCE_DIR}/common/proto/common/*.proto" )
120+
include(./cmake/Protobuf.cmake)
121+
endif()
122+
118123

119124
if( BUILD_WEB_SERVER )
120125
include(./cmake/Web.cmake)
@@ -132,10 +137,6 @@ if( BUILD_AUTHZ_TESTS )
132137
include(./cmake/GlobusCommon.cmake)
133138
endif()
134139

135-
if ( BUILD_REPO_SERVER OR BUILD_CORE_SERVER OR BUILD_AUTHZ OR BUILD_COMMON OR BUILD_PYTHON_CLIENT)
136-
include(./cmake/Protobuf.cmake)
137-
endif()
138-
139140
if ( BUILD_REPO_SERVER OR BUILD_CORE_SERVER OR BUILD_AUTHZ OR BUILD_COMMON)
140141

141142
include_directories( "/usr/include/globus" )

common/proto/common/SDMS_Auth.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ message UserCreateRequest
149149
required string email = 4; // Email address
150150
repeated string uuid = 5; // UUID for primary Globus account
151151
optional string options = 6; // DataFed options (JSON string)
152-
required string secret = 7; // System secret
152+
optional string secret = 7; // System secret
153153
}
154154

155155
// Request to find DataFed user by one or more Globus UUIDs

compose/all/compose.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,15 @@ services:
6565
DATAFED_ZEROMQ_SYSTEM_SECRET: "${DATAFED_ZEROMQ_SYSTEM_SECRET}"
6666
DATAFED_DOMAIN: "${DATAFED_DOMAIN}"
6767
DATAFED_DEFAULT_LOG_PATH: "${DATAFED_CONTAINER_LOG_PATH}"
68-
UID: "${DATAFED_UID}"
6968
DATAFED_DATABASE_PASSWORD: "${DATAFED_DATABASE_PASSWORD}"
7069
DATAFED_DATABASE_IP_ADDRESS: "${DATAFED_DATABASE_IP_ADDRESS}"
7170
DATAFED_DATABASE_HOST: "arango"
7271
# NOTE enabling foxx tests will cause state changes in the database
7372
# do not run this unless you are ok with the database being wiped.
7473
ENABLE_FOXX_TESTS: "${DATAFED_ENABLE_FOXX_TESTS}"
74+
user: "${DATAFED_UID}:0"
75+
security_opt:
76+
- no-new-privileges:true
7577
healthcheck:
7678
test: ["CMD", "/bin/bash", "-c", "[ -f /tmp/.foxx_is_installed ]"]
7779
interval: 10s

compose/metadata/compose.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,15 @@ services:
6262
DATAFED_ZEROMQ_SYSTEM_SECRET: "${DATAFED_ZEROMQ_SYSTEM_SECRET}"
6363
DATAFED_DOMAIN: "${DATAFED_DOMAIN}"
6464
DATAFED_DEFAULT_LOG_PATH: "${DATAFED_CONTAINER_LOG_PATH}"
65-
UID: "${DATAFED_UID}"
6665
DATAFED_DATABASE_PASSWORD: "${DATAFED_DATABASE_PASSWORD}"
6766
DATAFED_DATABASE_IP_ADDRESS: "${DATAFED_DATABASE_IP_ADDRESS}"
6867
DATAFED_DATABASE_HOST: "arango"
6968
# NOTE enabling foxx tests will cause state changes in the database
7069
# do not run this unless you are ok with the database being wiped.
7170
ENABLE_FOXX_TESTS: "${DATAFED_ENABLE_FOXX_TESTS}"
71+
user: "${DATAFED_UID}:0"
72+
security_opt:
73+
- no-new-privileges:true
7274
healthcheck:
7375
test: ["CMD", "/bin/bash", "-c", "[ -f /tmp/.foxx_is_installed ]"]
7476
interval: 10s

core/server/CoreServer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,17 @@ void Server::loadKeys(const std::string &a_cred_dir) {
136136
void Server::waitForDB() {
137137
DL_INFO(m_log_context, "Waiting for DB...");
138138

139-
for (int i = 0; i < 10; i++) {
139+
for (int i = 0; i < 20; i++) {
140140
try {
141141
DatabaseAPI db_client(m_config.db_url, m_config.db_user,
142142
m_config.db_pass);
143143
db_client.serverPing(m_log_context);
144144
DL_INFO(m_log_context, "DB Ping Success");
145145
return;
146146
} catch (...) {
147-
DL_INFO(m_log_context, "DB connection error");
147+
DL_WARNING(m_log_context, "DB connection error.");
148148
}
149-
sleep(5);
149+
sleep(10);
150150
}
151151

152152
EXCEPT(1, "Unable to connect to DB");

doc_source/source/dev/testing.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ DATAFED_DATABASE_PASSWORD, and DATAFED_ZEROMQ_SYSTEM_SECRET can be anything but
6969
-e DATAFED_ZEROMQ_SYSTEM_SECRET="<secret>" \
7070
-e INSTALL_FOXX=ON \
7171
-e ENABLE_FOXX_TESTS=TRUE \
72+
--user $(id -u):0 \
7273
--network=host \
74+
--security-opt no-new-privileges \
7375
datafed-foxx:latest
7476
7577
This will deploy the Foxx microservices and automatically execute the unit tests against the ArangoDB instance.

0 commit comments

Comments
 (0)