Skip to content

Commit e91c27e

Browse files
authored
fix(orchestrator): openapi files hash generation use nodejs script (#1328)
Fix openapi files hash generation Do not require sha1sum bin, use nodejs script instead. Signed-off-by: Gloria Ciavarrini <[email protected]>
1 parent 3cd1f7d commit e91c27e

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

plugins/orchestrator-common/openapitools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
2+
"$schema": "../../node_modules/@openapitools/openapi-generator-cli/config.schema.json",
33
"spaces": 2,
44
"generator-cli": {
55
"version": "7.3.0"

plugins/orchestrator-common/scripts/openapi.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ EOF
2424
rm ./src/openapi/openapi.json
2525
yarn openapi:prettier:fix
2626
NEW_SHA=$(openapi_checksum)
27-
openapi_update ${NEW_SHA}
27+
openapi_update "${NEW_SHA}"
2828
}
2929

30-
openapi_checksum(){
31-
cat ${DEFINITION_FILE} ${SCHEMA_FILE} ${OPENAPI_SPEC_FILE} | sha1sum | awk '{print $1}' | tr -d '[:space:]'
30+
openapi_checksum() {
31+
CONCATENATED_CONTENT=$(cat ${DEFINITION_FILE} ${SCHEMA_FILE} ${OPENAPI_SPEC_FILE})
32+
node -e $'console.log(crypto.createHash("sha1").update(`$CONCATENATED_CONTENT`).digest("hex"))'
3233
}
3334

3435
openapi_update() {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
d82937d6ce2c454759c0aad81c0d8206daa8e425
1+
dd90834d9e4e6e4dbf3790a913378063fda5b25a

0 commit comments

Comments
 (0)