Skip to content

Commit

Permalink
fix(orchestrator): openapi files hash generation use nodejs script (j…
Browse files Browse the repository at this point in the history
…anus-idp#1328)

Fix openapi files hash generation

Do not require sha1sum bin, use nodejs script instead.

Signed-off-by: Gloria Ciavarrini <[email protected]>
  • Loading branch information
gciavarrini authored Mar 12, 2024
1 parent 3cd1f7d commit e91c27e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugins/orchestrator-common/openapitools.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"$schema": "../../node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "7.3.0"
Expand Down
7 changes: 4 additions & 3 deletions plugins/orchestrator-common/scripts/openapi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ EOF
rm ./src/openapi/openapi.json
yarn openapi:prettier:fix
NEW_SHA=$(openapi_checksum)
openapi_update ${NEW_SHA}
openapi_update "${NEW_SHA}"
}

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

openapi_update() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d82937d6ce2c454759c0aad81c0d8206daa8e425
dd90834d9e4e6e4dbf3790a913378063fda5b25a

0 comments on commit e91c27e

Please sign in to comment.