@docupace/pipeline 1.0.5-4.ervins → 1.0.5-alpha.0

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.
Files changed (46) hide show
  1. package/.prettierrc.cjs +12 -12
  2. package/bin/next-changeset-validate.sh +8 -8
  3. package/eslint.config.js +1 -1
  4. package/next/changeset.sh +75 -75
  5. package/next/copy.sh +34 -34
  6. package/next/deploy.sh +40 -40
  7. package/next/execute.sh +117 -123
  8. package/next/sonar.sh +23 -23
  9. package/package.json +35 -50
  10. package/src/changeset/cli.js +254 -200
  11. package/src/changeset/validate.js +47 -84
  12. package/src/next/cli.js +72 -228
  13. package/src/next/config.js +0 -96
  14. package/src/next/copy.js +30 -61
  15. package/src/next/deploy.js +249 -595
  16. package/src/next/publish.js +48 -71
  17. package/src/next/pull.js +7 -7
  18. package/src/next/sonar.js +23 -23
  19. package/README.md +0 -136
  20. package/bin/azuread_update_callbacks_for_app.sh +0 -58
  21. package/src/auth0/alias.js +0 -72
  22. package/src/auth0/cli.js +0 -76
  23. package/src/auth0/configure.js +0 -783
  24. package/src/auth0/export.js +0 -43
  25. package/src/auth0/metadata.js +0 -132
  26. package/src/auth0/vault.js +0 -107
  27. package/src/changeset/changeset-config.js +0 -34
  28. package/src/changeset/create.js +0 -205
  29. package/src/changeset/package-util.js +0 -86
  30. package/src/changeset/util.js +0 -43
  31. package/src/changeset/version.js +0 -102
  32. package/src/jenkins/setParams.groovy +0 -58
  33. package/src/next/alias.js +0 -53
  34. package/src/next/apache.js +0 -73
  35. package/src/next/connect.js +0 -227
  36. package/src/next/haproxy.js +0 -71
  37. package/src/next/jenkins.js +0 -123
  38. package/src/next/jira.js +0 -84
  39. package/src/next/logger.js +0 -17
  40. package/src/next/pipline.js +0 -114
  41. package/src/next/util.js +0 -93
  42. package/src/next/vault.js +0 -45
  43. package/terraform/apply.sh +0 -37
  44. package/terraform/init.sh +0 -72
  45. package/terraform/plan.sh +0 -76
  46. package/terraform/validate.sh +0 -17
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/eslint.config.js CHANGED
@@ -10,7 +10,7 @@ export default [
10
10
  globals: {
11
11
  ...globals.browser,
12
12
  ...globals.node, // Add Node.js globals
13
- },g
13
+ },
14
14
  },
15
15
  },
16
16
  pluginJs.configs.recommended,
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,123 +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
- SLUG_SUFFIX=""
57
- if [ -n "$APP_NAME" ]; then
58
- SLUG_SUFFIX="-${APP_NAME}"
59
- fi
60
-
61
- BUILD_IMAGE_NAME="${BITBUCKET_REPO_SLUG}${SLUG_SUFFIX}:build-${BITBUCKET_BUILD_NUMBER}"
62
- IMAGE_NAME="${BITBUCKET_REPO_SLUG}${SLUG_SUFFIX}:sha-${GIT_SHA}"
63
-
64
- export DOCKER_HOST=""
65
-
66
- echo "Publishing Docker image ${IMAGE_NAME}..."
67
-
68
- loginRegistry
69
-
70
- # Check if the image already exists in the registry
71
- if docker manifest inspect ${JF_REGISTRY_FULL_URL}/${IMAGE_NAME} >/dev/null 2>&1; then
72
- echo "Tag sha-${GIT_SHA} already exists in the remote repository. Skipping push."
73
- else
74
- docker tag ${IMAGE_NAME} "${JF_REGISTRY_FULL_URL}/${IMAGE_NAME}"
75
- docker push "${JF_REGISTRY_FULL_URL}/${IMAGE_NAME}"
76
- fi
77
-
78
- # Tag and push the build image
79
- docker tag ${IMAGE_NAME} "${JF_REGISTRY_FULL_URL}/${BUILD_IMAGE_NAME}"
80
- docker push "${JF_REGISTRY_FULL_URL}/${BUILD_IMAGE_NAME}"
81
-
82
- # Tag and push each Git tag as a Docker tag
83
- GIT_TAGS=$(git tag --points-at HEAD)
84
- for GIT_TAG in ${GIT_TAGS}; do
85
- docker tag ${IMAGE_NAME} "${JF_REGISTRY_FULL_URL}/${BITBUCKET_REPO_SLUG}:${GIT_TAG}"
86
- docker push "${JF_REGISTRY_FULL_URL}/${BITBUCKET_REPO_SLUG}:${GIT_TAG}"
87
- done
88
-
89
- # Logout from Docker registry
90
- loginRegistry
91
- }
92
-
93
- # Function to deploy
94
- # application - ui|graphql
95
- # site
96
- deploy() {
97
- echo "Deploying $PARAM1 application for site $PARAM2..."
98
- DIR="$(dirname "$0")"
99
- bash $DIR/deploy.sh $PARAM1 $PARAM2
100
- }
101
-
102
- # Main logic to call the appropriate function
103
- case "$1" in
104
- build)
105
- build
106
- ;;
107
- sonar)
108
- sonar
109
- ;;
110
- publish)
111
- publish
112
- ;;
113
- deploy)
114
- deploy
115
- ;;
116
- copy)
117
- copy
118
- ;;
119
- *)
120
- echo "Usage: $0 {build|sonar|publish|deploy|copy} <BITBUCKET_REPO_SLUG>"
121
- exit 1
122
- ;;
123
- 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