@docupace/pipeline 1.0.40 → 1.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.prettierrc.cjs CHANGED
@@ -1,12 +1,12 @@
1
- module.exports = {
2
- parser: 'typescript',
3
- trailingComma: 'all',
4
- tabWidth: 2,
5
- semi: true,
6
- singleQuote: true,
7
- printWidth: 80,
8
- tabs: false,
9
- jsxSingleQuote: false,
10
- bracketSameLine: true,
11
- arrowParens: 'always',
12
- };
1
+ module.exports = {
2
+ parser: 'typescript',
3
+ trailingComma: 'all',
4
+ tabWidth: 2,
5
+ semi: true,
6
+ singleQuote: true,
7
+ printWidth: 80,
8
+ tabs: false,
9
+ jsxSingleQuote: false,
10
+ bracketSameLine: true,
11
+ arrowParens: 'always',
12
+ };
@@ -1,8 +1,8 @@
1
- #!/bin/bash
2
- # bin/next-changeset-validate
3
-
4
- DIR="$(cd "$(dirname "$0")" && pwd)/../@docupace/pipeline"
5
-
6
- # Pass all arguments to the actual script
7
-
8
- bash $DIR/next/changeset.sh validate $2
1
+ #!/bin/bash
2
+ # bin/next-changeset-validate
3
+
4
+ DIR="$(cd "$(dirname "$0")" && pwd)/../@docupace/pipeline"
5
+
6
+ # Pass all arguments to the actual script
7
+
8
+ bash $DIR/next/changeset.sh validate $2
package/next/changeset.sh CHANGED
@@ -1,75 +1,75 @@
1
- #!/bin/bash
2
- set -e
3
-
4
-
5
- DIR="$(cd "$(dirname "$0")" && pwd)"
6
-
7
- # Function: Validate changeset presence
8
- validate_changesets() {
9
- if [ ! -z "$PR_ID" ]; then
10
- echo "🔍 Validating changesets..."
11
- pnpm node $DIR/validateChangeset.cjs $1 || {
12
- if [ $? -eq 1 ]; then
13
- echo "❌ No changeset found. Please add a changeset to this PR. Please see more information at https://docupacellc.atlassian.net/wiki/spaces/PM/pages/1350893571/Creating+changesets+for+Docupace+Next"
14
- exit 1
15
- else
16
- echo "✅ Changeset validation passed."
17
- fi
18
- }
19
- fi
20
- }
21
-
22
- setGitInfo() {
23
- git config --global user.email "gitops@docupace.com"
24
- git config --global user.name "Gitops"
25
- git remote set-url origin https://x-token-auth:${BITBUCKET_TOKEN}@bitbucket.org/dp-cloud/docupace-graphql-server.git
26
- }
27
-
28
- # Function: Handle versioning and changelog generation
29
- version_application() {
30
- setGitInfo
31
- echo "📦 Running Changeset versioning..."
32
- pnpm changeset version
33
- echo "Complete"
34
- }
35
-
36
- # Function: Commit and tag the new version
37
- commit_and_tag() {
38
- setGitInfo
39
- echo "📌 Committing and tagging the new version..."
40
- git add .
41
- git commit -m "chore: version bump and changelog"
42
- git push origin
43
-
44
- # Create and push a new tag
45
- local new_version
46
- new_version=$(node -p "require('./package.json').version")
47
- git tag "v$new_version"
48
- git push origin --tags
49
- echo "✅ Version $new_version tagged and pushed."
50
- }
51
-
52
- # Parse the provided command
53
- case "$1" in
54
- validate)
55
- validate_changesets $2
56
- ;;
57
- build)
58
- build_application
59
- ;;
60
- version)
61
- version_application
62
- ;;
63
- commit-and-tag)
64
- commit_and_tag
65
- ;;
66
- all)
67
- version_application
68
- commit_and_tag
69
- ;;
70
- *)
71
- echo "❓ Unknown command: $1"
72
- echo "Available commands: validate, build, version, commit-and-tag, all"
73
- exit 1
74
- ;;
75
- esac
1
+ #!/bin/bash
2
+ set -e
3
+
4
+
5
+ DIR="$(cd "$(dirname "$0")" && pwd)"
6
+
7
+ # Function: Validate changeset presence
8
+ validate_changesets() {
9
+ if [ ! -z "$PR_ID" ]; then
10
+ echo "🔍 Validating changesets..."
11
+ pnpm node $DIR/validateChangeset.cjs $1 || {
12
+ if [ $? -eq 1 ]; then
13
+ echo "❌ No changeset found. Please add a changeset to this PR. Please see more information at https://docupacellc.atlassian.net/wiki/spaces/PM/pages/1350893571/Creating+changesets+for+Docupace+Next"
14
+ exit 1
15
+ else
16
+ echo "✅ Changeset validation passed."
17
+ fi
18
+ }
19
+ fi
20
+ }
21
+
22
+ setGitInfo() {
23
+ git config --global user.email "gitops@docupace.com"
24
+ git config --global user.name "Gitops"
25
+ git remote set-url origin https://x-token-auth:${BITBUCKET_TOKEN}@bitbucket.org/dp-cloud/docupace-graphql-server.git
26
+ }
27
+
28
+ # Function: Handle versioning and changelog generation
29
+ version_application() {
30
+ setGitInfo
31
+ echo "📦 Running Changeset versioning..."
32
+ pnpm changeset version
33
+ echo "Complete"
34
+ }
35
+
36
+ # Function: Commit and tag the new version
37
+ commit_and_tag() {
38
+ setGitInfo
39
+ echo "📌 Committing and tagging the new version..."
40
+ git add .
41
+ git commit -m "chore: version bump and changelog"
42
+ git push origin
43
+
44
+ # Create and push a new tag
45
+ local new_version
46
+ new_version=$(node -p "require('./package.json').version")
47
+ git tag "v$new_version"
48
+ git push origin --tags
49
+ echo "✅ Version $new_version tagged and pushed."
50
+ }
51
+
52
+ # Parse the provided command
53
+ case "$1" in
54
+ validate)
55
+ validate_changesets $2
56
+ ;;
57
+ build)
58
+ build_application
59
+ ;;
60
+ version)
61
+ version_application
62
+ ;;
63
+ commit-and-tag)
64
+ commit_and_tag
65
+ ;;
66
+ all)
67
+ version_application
68
+ commit_and_tag
69
+ ;;
70
+ *)
71
+ echo "❓ Unknown command: $1"
72
+ echo "Available commands: validate, build, version, commit-and-tag, all"
73
+ exit 1
74
+ ;;
75
+ esac
package/next/copy.sh CHANGED
@@ -1,34 +1,34 @@
1
-
2
- set -e # Enable command tracing
3
- # JF_REGISTRY_USER_DEV=$1
4
- # JF_REGISTRY_PASSWORD_DEV=$2
5
-
6
- # JF_REGISTRY_USER_QA=$1
7
- # JF_REGISTRY_PASSWORD_QA=$2
8
-
9
- JF_REGISTRY_URL="registry.paperout.com"
10
-
11
- SOURCE_REGISTRY=$JF_REGISTRY_URL/${BITBUCKET_REPO_SLUG}-dev-docker-local
12
- TARGET_REGISTRY=$JF_REGISTRY_URL/${BITBUCKET_REPO_SLUG}-$TARGET_ENV-docker-local
13
-
14
- IMAGE_NAME="${BITBUCKET_REPO_SLUG}:${PUBLISH_TAG}"
15
-
16
- SOURCE_FULL_IMAGE_NAME="${SOURCE_REGISTRY}/${IMAGE_NAME}"
17
- TARGET_FULL_IMAGE_NAME="${TARGET_REGISTRY}/${IMAGE_NAME}"
18
-
19
- # JFROG
20
- jfr_login() {
21
- echo $2 | docker login --username $1 --password-stdin $JF_REGISTRY_URL
22
- }
23
-
24
- # dev login
25
- jfr_login $JF_REGISTRY_USER_DEV $JF_REGISTRY_PASSWORD_DEV
26
-
27
- docker pull $SOURCE_FULL_IMAGE_NAME
28
- docker tag $SOURCE_FULL_IMAGE_NAME $TARGET_FULL_IMAGE_NAME
29
-
30
- # qa login
31
- jfr_login $JF_REGISTRY_USER_QA $JF_REGISTRY_PASSWORD_QA
32
-
33
- docker push $TARGET_FULL_IMAGE_NAME
34
-
1
+
2
+ set -e # Enable command tracing
3
+ # JF_REGISTRY_USER_DEV=$1
4
+ # JF_REGISTRY_PASSWORD_DEV=$2
5
+
6
+ # JF_REGISTRY_USER_QA=$1
7
+ # JF_REGISTRY_PASSWORD_QA=$2
8
+
9
+ JF_REGISTRY_URL="registry.paperout.com"
10
+
11
+ SOURCE_REGISTRY=$JF_REGISTRY_URL/${BITBUCKET_REPO_SLUG}-dev-docker-local
12
+ TARGET_REGISTRY=$JF_REGISTRY_URL/${BITBUCKET_REPO_SLUG}-$TARGET_ENV-docker-local
13
+
14
+ IMAGE_NAME="${BITBUCKET_REPO_SLUG}:${PUBLISH_TAG}"
15
+
16
+ SOURCE_FULL_IMAGE_NAME="${SOURCE_REGISTRY}/${IMAGE_NAME}"
17
+ TARGET_FULL_IMAGE_NAME="${TARGET_REGISTRY}/${IMAGE_NAME}"
18
+
19
+ # JFROG
20
+ jfr_login() {
21
+ echo $2 | docker login --username $1 --password-stdin $JF_REGISTRY_URL
22
+ }
23
+
24
+ # dev login
25
+ jfr_login $JF_REGISTRY_USER_DEV $JF_REGISTRY_PASSWORD_DEV
26
+
27
+ docker pull $SOURCE_FULL_IMAGE_NAME
28
+ docker tag $SOURCE_FULL_IMAGE_NAME $TARGET_FULL_IMAGE_NAME
29
+
30
+ # qa login
31
+ jfr_login $JF_REGISTRY_USER_QA $JF_REGISTRY_PASSWORD_QA
32
+
33
+ docker push $TARGET_FULL_IMAGE_NAME
34
+
package/next/deploy.sh CHANGED
@@ -1,40 +1,40 @@
1
- #!/bin/bash
2
-
3
- set -e # Enable command tracing
4
- # Variables
5
- REPO_NAME="gitops-dev"
6
- REPO_URL="https://x-token-auth:$GITOPS_REP_TOKEN@bitbucket.org/dp-cloud/${REPO_NAME}.git"
7
- FILE_PATH="dp/$2/$1.values.yaml"
8
- BUILD_NUMBER=$BITBUCKET_BUILD_NUMBER
9
- GITOPS_BRANCH=master
10
- if [ -n "$VERSION_TAG" ]; then
11
- DEPLOY_TAG=$VERSION_TAG
12
- else
13
- DEPLOY_TAG="build-$BUILD_NUMBER"
14
- fi
15
-
16
-
17
-
18
- # Clone the repository
19
-
20
- git config user.email qxebpukjnzljnwty1knte7ym53aogk@bots.bitbucket.org
21
- git clone $REPO_URL
22
- cd ${REPO_NAME} || exit
23
-
24
- # Checkout the branch
25
-
26
- # Modify the YAML file
27
- sed -i "s/tag: .*/tag: $DEPLOY_TAG/" $FILE_PATH
28
-
29
- # Add changes to git
30
- git add $FILE_PATH
31
-
32
- # Commit changes
33
- git commit -m "Update image tag to $DEPLOY_TAG"
34
-
35
- # Push changes
36
- git push origin $GITOPS_BRANCH
37
-
38
- # Clean up
39
- cd ..
40
- rm -rf ${REPO_NAME}
1
+ #!/bin/bash
2
+
3
+ set -e # Enable command tracing
4
+ # Variables
5
+ REPO_NAME="gitops-dev"
6
+ REPO_URL="https://x-token-auth:$GITOPS_REP_TOKEN@bitbucket.org/dp-cloud/${REPO_NAME}.git"
7
+ FILE_PATH="dp/$2/$1.values.yaml"
8
+ BUILD_NUMBER=$BITBUCKET_BUILD_NUMBER
9
+ GITOPS_BRANCH=master
10
+ if [ -n "$VERSION_TAG" ]; then
11
+ DEPLOY_TAG=$VERSION_TAG
12
+ else
13
+ DEPLOY_TAG="build-$BUILD_NUMBER"
14
+ fi
15
+
16
+
17
+
18
+ # Clone the repository
19
+
20
+ git config user.email qxebpukjnzljnwty1knte7ym53aogk@bots.bitbucket.org
21
+ git clone $REPO_URL
22
+ cd ${REPO_NAME} || exit
23
+
24
+ # Checkout the branch
25
+
26
+ # Modify the YAML file
27
+ sed -i "s/tag: .*/tag: $DEPLOY_TAG/" $FILE_PATH
28
+
29
+ # Add changes to git
30
+ git add $FILE_PATH
31
+
32
+ # Commit changes
33
+ git commit -m "Update image tag to $DEPLOY_TAG"
34
+
35
+ # Push changes
36
+ git push origin $GITOPS_BRANCH
37
+
38
+ # Clean up
39
+ cd ..
40
+ rm -rf ${REPO_NAME}
package/next/execute.sh CHANGED
@@ -1,117 +1,117 @@
1
- #!/bin/bash
2
-
3
- # Usage: ./pipeline.sh <function> <BITBUCKET_REPO_SLUG>
4
- # Example: ./pipeline.sh build docupace-ui-main
5
-
6
- set -e # Enable command tracing
7
- GIT_SHA=$(git log --pretty=format:'%h' -n 1)
8
- JF_REGISTRY_FULL_URL="${JF_REGISTRY_URL}/${JF_REGISTRY_REPO_NAME}"
9
- PARAM1=$2
10
- PARAM2=$3
11
-
12
- pull() {
13
- IMAGE_NAME=$2
14
- docker pull "${JF_REGISTRY_FULL_URL}/${IMAGE_NAME}"
15
- }
16
-
17
- # Function to run Sonar analysis
18
- sonar() {
19
- export DOCKER_HOST=""
20
- IMAGE_NAME="${BITBUCKET_REPO_SLUG}:sha-${GIT_SHA}"
21
- SONAR_CONTAINER_NAME="${BITBUCKET_REPO_SLUG}-${GIT_SHA}"
22
-
23
- echo "Running Sonar analysis on Docker image ${IMAGE_NAME}..."
24
-
25
- # Remove any existing container with the same name
26
- if [ "$(docker ps -a --filter "name=$SONAR_CONTAINER_NAME" --format "{{.Names}}")" ]; then
27
- docker rm -f $SONAR_CONTAINER_NAME
28
- fi
29
-
30
- cd "$ROOT_DIR"
31
- docker run --rm \
32
- -e BRANCH=$BITBUCKET_BRANCH \
33
- -e PR_ID=$BITBUCKET_PR_ID \
34
- -e PR_DESTINATION_BRANCH=$BITBUCKET_PR_DESTINATION_BRANCH \
35
- -e SONAR_TOKEN=$SONAR_TOKEN \
36
- --name $SONAR_CONTAINER_NAME $IMAGE_NAME pnpm sonar
37
- }
38
-
39
- # Function to publish the Docker image
40
-
41
-
42
- loginRegistry() {
43
- echo ${JF_REGISTRY_PASSWORD_DEV} | docker login --username ${JF_REGISTRY_USER_DEV} --password-stdin ${JF_REGISTRY_URL}
44
- }
45
-
46
- logoutRegistry() {
47
- docker logout ${JF_REGISTRY_URL}
48
- }
49
-
50
- copy() {
51
- DIR="$(dirname "$0")"
52
- bash $DIR/copy.sh
53
- }
54
-
55
- publish() {
56
- BUILD_IMAGE_NAME="${BITBUCKET_REPO_SLUG}:build-${BITBUCKET_BUILD_NUMBER}"
57
- IMAGE_NAME="${BITBUCKET_REPO_SLUG}:sha-${GIT_SHA}"
58
- export DOCKER_HOST=""
59
-
60
- echo "Publishing Docker image ${IMAGE_NAME}..."
61
-
62
- loginRegistry
63
-
64
- # Check if the image already exists in the registry
65
- if docker manifest inspect ${JF_REGISTRY_FULL_URL}/${IMAGE_NAME} >/dev/null 2>&1; then
66
- echo "Tag sha-${GIT_SHA} already exists in the remote repository. Skipping push."
67
- else
68
- docker tag ${IMAGE_NAME} "${JF_REGISTRY_FULL_URL}/${IMAGE_NAME}"
69
- docker push "${JF_REGISTRY_FULL_URL}/${IMAGE_NAME}"
70
- fi
71
-
72
- # Tag and push the build image
73
- docker tag ${IMAGE_NAME} "${JF_REGISTRY_FULL_URL}/${BUILD_IMAGE_NAME}"
74
- docker push "${JF_REGISTRY_FULL_URL}/${BUILD_IMAGE_NAME}"
75
-
76
- # Tag and push each Git tag as a Docker tag
77
- GIT_TAGS=$(git tag --points-at HEAD)
78
- for GIT_TAG in ${GIT_TAGS}; do
79
- docker tag ${IMAGE_NAME} "${JF_REGISTRY_FULL_URL}/${BITBUCKET_REPO_SLUG}:${GIT_TAG}"
80
- docker push "${JF_REGISTRY_FULL_URL}/${BITBUCKET_REPO_SLUG}:${GIT_TAG}"
81
- done
82
-
83
- # Logout from Docker registry
84
- loginRegistry
85
- }
86
-
87
- # Function to deploy
88
- # application - ui|graphql
89
- # site
90
- deploy() {
91
- echo "Deploying $PARAM1 application for site $PARAM2..."
92
- DIR="$(dirname "$0")"
93
- bash $DIR/deploy.sh $PARAM1 $PARAM2
94
- }
95
-
96
- # Main logic to call the appropriate function
97
- case "$1" in
98
- build)
99
- build
100
- ;;
101
- sonar)
102
- sonar
103
- ;;
104
- publish)
105
- publish
106
- ;;
107
- deploy)
108
- deploy
109
- ;;
110
- copy)
111
- copy
112
- ;;
113
- *)
114
- echo "Usage: $0 {build|sonar|publish|deploy|copy} <BITBUCKET_REPO_SLUG>"
115
- exit 1
116
- ;;
117
- esac
1
+ #!/bin/bash
2
+
3
+ # Usage: ./pipeline.sh <function> <BITBUCKET_REPO_SLUG>
4
+ # Example: ./pipeline.sh build docupace-ui-main
5
+
6
+ set -e # Enable command tracing
7
+ GIT_SHA=$(git log --pretty=format:'%h' -n 1)
8
+ JF_REGISTRY_FULL_URL="${JF_REGISTRY_URL}/${JF_REGISTRY_REPO_NAME}"
9
+ PARAM1=$2
10
+ PARAM2=$3
11
+
12
+ pull() {
13
+ IMAGE_NAME=$2
14
+ docker pull "${JF_REGISTRY_FULL_URL}/${IMAGE_NAME}"
15
+ }
16
+
17
+ # Function to run Sonar analysis
18
+ sonar() {
19
+ export DOCKER_HOST=""
20
+ IMAGE_NAME="${BITBUCKET_REPO_SLUG}:sha-${GIT_SHA}"
21
+ SONAR_CONTAINER_NAME="${BITBUCKET_REPO_SLUG}-${GIT_SHA}"
22
+
23
+ echo "Running Sonar analysis on Docker image ${IMAGE_NAME}..."
24
+
25
+ # Remove any existing container with the same name
26
+ if [ "$(docker ps -a --filter "name=$SONAR_CONTAINER_NAME" --format "{{.Names}}")" ]; then
27
+ docker rm -f $SONAR_CONTAINER_NAME
28
+ fi
29
+
30
+ cd "$ROOT_DIR"
31
+ docker run --rm \
32
+ -e BRANCH=$BITBUCKET_BRANCH \
33
+ -e PR_ID=$BITBUCKET_PR_ID \
34
+ -e PR_DESTINATION_BRANCH=$BITBUCKET_PR_DESTINATION_BRANCH \
35
+ -e SONAR_TOKEN=$SONAR_TOKEN \
36
+ --name $SONAR_CONTAINER_NAME $IMAGE_NAME pnpm sonar
37
+ }
38
+
39
+ # Function to publish the Docker image
40
+
41
+
42
+ loginRegistry() {
43
+ echo ${JF_REGISTRY_PASSWORD_DEV} | docker login --username ${JF_REGISTRY_USER_DEV} --password-stdin ${JF_REGISTRY_URL}
44
+ }
45
+
46
+ logoutRegistry() {
47
+ docker logout ${JF_REGISTRY_URL}
48
+ }
49
+
50
+ copy() {
51
+ DIR="$(dirname "$0")"
52
+ bash $DIR/copy.sh
53
+ }
54
+
55
+ publish() {
56
+ BUILD_IMAGE_NAME="${BITBUCKET_REPO_SLUG}:build-${BITBUCKET_BUILD_NUMBER}"
57
+ IMAGE_NAME="${BITBUCKET_REPO_SLUG}:sha-${GIT_SHA}"
58
+ export DOCKER_HOST=""
59
+
60
+ echo "Publishing Docker image ${IMAGE_NAME}..."
61
+
62
+ loginRegistry
63
+
64
+ # Check if the image already exists in the registry
65
+ if docker manifest inspect ${JF_REGISTRY_FULL_URL}/${IMAGE_NAME} >/dev/null 2>&1; then
66
+ echo "Tag sha-${GIT_SHA} already exists in the remote repository. Skipping push."
67
+ else
68
+ docker tag ${IMAGE_NAME} "${JF_REGISTRY_FULL_URL}/${IMAGE_NAME}"
69
+ docker push "${JF_REGISTRY_FULL_URL}/${IMAGE_NAME}"
70
+ fi
71
+
72
+ # Tag and push the build image
73
+ docker tag ${IMAGE_NAME} "${JF_REGISTRY_FULL_URL}/${BUILD_IMAGE_NAME}"
74
+ docker push "${JF_REGISTRY_FULL_URL}/${BUILD_IMAGE_NAME}"
75
+
76
+ # Tag and push each Git tag as a Docker tag
77
+ GIT_TAGS=$(git tag --points-at HEAD)
78
+ for GIT_TAG in ${GIT_TAGS}; do
79
+ docker tag ${IMAGE_NAME} "${JF_REGISTRY_FULL_URL}/${BITBUCKET_REPO_SLUG}:${GIT_TAG}"
80
+ docker push "${JF_REGISTRY_FULL_URL}/${BITBUCKET_REPO_SLUG}:${GIT_TAG}"
81
+ done
82
+
83
+ # Logout from Docker registry
84
+ loginRegistry
85
+ }
86
+
87
+ # Function to deploy
88
+ # application - ui|graphql
89
+ # site
90
+ deploy() {
91
+ echo "Deploying $PARAM1 application for site $PARAM2..."
92
+ DIR="$(dirname "$0")"
93
+ bash $DIR/deploy.sh $PARAM1 $PARAM2
94
+ }
95
+
96
+ # Main logic to call the appropriate function
97
+ case "$1" in
98
+ build)
99
+ build
100
+ ;;
101
+ sonar)
102
+ sonar
103
+ ;;
104
+ publish)
105
+ publish
106
+ ;;
107
+ deploy)
108
+ deploy
109
+ ;;
110
+ copy)
111
+ copy
112
+ ;;
113
+ *)
114
+ echo "Usage: $0 {build|sonar|publish|deploy|copy} <BITBUCKET_REPO_SLUG>"
115
+ exit 1
116
+ ;;
117
+ esac
package/next/sonar.sh CHANGED
@@ -1,23 +1,23 @@
1
- #!/bin/bash
2
-
3
- # Initialize sonar-scanner command with common parameters
4
- SONAR_CMD="npx sonarqube-scanner"
5
-
6
- echo "PR_ID=$PR_ID"
7
- echo "BRANCH=$BRANCH"
8
- echo "PR_DESTINATION_BRANCH=$PR_DESTINATION_BRANCH"
9
-
10
- # Determine the type of scan based on environment variables
11
- if [[ ! -z "$PR_ID" ]]; then
12
- SONAR_CMD+=" \
13
- -Dsonar.pullrequest.key=$PR_ID \
14
- -Dsonar.pullrequest.branch=$BRANCH \
15
- -Dsonar.pullrequest.base=$PR_DESTINATION_BRANCH"
16
- else
17
- SONAR_CMD+=" \
18
- -Dsonar.branch.name=$BRANCH"
19
- fi
20
-
21
- # Execute the sonar-scanner command
22
- echo "Running: $SONAR_CMD"
23
- $SONAR_CMD
1
+ #!/bin/bash
2
+
3
+ # Initialize sonar-scanner command with common parameters
4
+ SONAR_CMD="npx sonarqube-scanner"
5
+
6
+ echo "PR_ID=$PR_ID"
7
+ echo "BRANCH=$BRANCH"
8
+ echo "PR_DESTINATION_BRANCH=$PR_DESTINATION_BRANCH"
9
+
10
+ # Determine the type of scan based on environment variables
11
+ if [[ ! -z "$PR_ID" ]]; then
12
+ SONAR_CMD+=" \
13
+ -Dsonar.pullrequest.key=$PR_ID \
14
+ -Dsonar.pullrequest.branch=$BRANCH \
15
+ -Dsonar.pullrequest.base=$PR_DESTINATION_BRANCH"
16
+ else
17
+ SONAR_CMD+=" \
18
+ -Dsonar.branch.name=$BRANCH"
19
+ fi
20
+
21
+ # Execute the sonar-scanner command
22
+ echo "Running: $SONAR_CMD"
23
+ $SONAR_CMD
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docupace/pipeline",
3
- "version": "1.0.40",
3
+ "version": "1.0.43",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",