@docupace/pipeline 1.0.47 → 1.0.48

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 (43) hide show
  1. package/.prettierrc.cjs +12 -12
  2. package/README.md +135 -135
  3. package/bin/azuread_update_callbacks_for_app.sh +58 -58
  4. package/bin/next-changeset-validate.sh +8 -8
  5. package/next/changeset.sh +75 -75
  6. package/next/copy.sh +34 -34
  7. package/next/deploy.sh +40 -40
  8. package/next/execute.sh +123 -123
  9. package/next/sonar.sh +23 -23
  10. package/package.json +1 -1
  11. package/src/auth0/alias.js +72 -72
  12. package/src/auth0/configure.js +783 -783
  13. package/src/auth0/export.js +43 -43
  14. package/src/auth0/metadata.js +132 -131
  15. package/src/auth0/vault.js +107 -107
  16. package/src/changeset/changeset-config.js +34 -34
  17. package/src/changeset/cli.js +188 -188
  18. package/src/changeset/create.js +205 -205
  19. package/src/changeset/package-util.js +86 -86
  20. package/src/changeset/util.js +43 -43
  21. package/src/changeset/validate.js +84 -84
  22. package/src/changeset/version.js +95 -95
  23. package/src/jenkins/setParams.groovy +58 -58
  24. package/src/next/alias.js +53 -53
  25. package/src/next/apache.js +73 -68
  26. package/src/next/cli.js +220 -220
  27. package/src/next/config.js +136 -135
  28. package/src/next/connect.js +227 -189
  29. package/src/next/copy.js +61 -61
  30. package/src/next/deploy.js +553 -553
  31. package/src/next/haproxy.js +71 -67
  32. package/src/next/jira.js +80 -80
  33. package/src/next/logger.js +17 -17
  34. package/src/next/pipline.js +114 -114
  35. package/src/next/publish.js +71 -71
  36. package/src/next/pull.js +7 -7
  37. package/src/next/sonar.js +23 -23
  38. package/src/next/util.js +93 -93
  39. package/src/next/vault.js +45 -45
  40. package/terraform/apply.sh +37 -37
  41. package/terraform/init.sh +72 -72
  42. package/terraform/plan.sh +76 -76
  43. package/terraform/validate.sh +17 -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
+ };
package/README.md CHANGED
@@ -1,136 +1,136 @@
1
- # Pipeline Shared Scripts
2
-
3
- A collection of CLI tools for Docupace's CI/CD pipelines and deployment workflows.
4
-
5
- ## Overview
6
-
7
- This package provides a set of command-line interfaces (CLIs) to facilitate various DevOps operations in the Docupace ecosystem:
8
-
9
- - `dp-next-cli`: Deployment and pipeline management for Next applications
10
- - `dp-changeset-cli`: Versioning and changeset management
11
- - `dp-auth0-cli`: Auth0 tenant configuration and management
12
-
13
- ## Installation
14
-
15
- ```bash
16
- npm install @docupace/pipeline
17
- ```
18
-
19
- Or with pnpm:
20
-
21
- ```bash
22
- pnpm add @docupace/pipeline
23
- ```
24
-
25
- ## Command Line Interfaces
26
-
27
- ### dp-next-cli
28
-
29
- Manages deployment, Docker image handling, and infrastructure configuration.
30
-
31
- ```bash
32
- dp-next-cli [command] [options]
33
- ```
34
-
35
- **Commands:**
36
-
37
- - `pull <imageName>`: Pull a Docker image from the registry
38
- - `sonar`: Run Sonar analysis
39
- - `addApacheSite`: Add site to apache
40
- - `connectClone`: Clone connect site
41
- - `haproxySync`: Sync haproxy config
42
- - `vaultAddSiteData`: Add m2m auth0 data to vault
43
- - `-s, --site-name <siteName>`: Site name
44
- - `-p, --site-config-remote-path <path>`: Site config remote path
45
- - `publish`: Publish a Docker image
46
- - `deploy-from-site`: Deploy an application for a specific site
47
- - `-f, --from-env <fromEnv>`: Source environment
48
- - `-t, --to-env <toEnv>`: Target environment
49
- - `-F, --from-site <fromSite>`: Source site
50
- - `-T, --to-site <toSite>`: Target site
51
- - `-c, --deploy-core <deployCore>`: Deploy Core (default: "false")
52
- - `-C, --deploy-connect <deployConnect>`: Deploy Connect (default: "false")
53
- - `deploy-template`: Deploy an application for a specific site
54
- - `deploy-app <application>`: Deploy an application for a specific site
55
- - `deploy-core <env> <site>`: Deploy Core
56
- - `-l, --liquibase <liquibase>`: Application name (default: "true")
57
- - `-b, --branch <branch>`: Branch (default: "master")
58
- - `deploy-connect <env> <site>`: Deploy Connect
59
- - `-l, --liquibase <liquibase>`: Application name (default: "true")
60
- - `-b, --branch <branch>`: Branch (default: "master")
61
- - `deploy-core-pipeline <env> <site>`: Deploy Core via pipeline
62
- - `-l, --liquibase <liquibase>`: Application name (default: "true")
63
- - `-b, --branch <branch>`: Branch (default: "master")
64
- - `copy`: Copy a Docker image between registries
65
- - `-a, --application <application>`: Application name
66
- - `-f, --from-env <fromEnv>`: Source environment
67
- - `-t, --to-env <toEnv>`: Target environment
68
- - `-g, --tag <tag>`: Image tag
69
- - `run-pipeline`: Trigger a pipeline by name
70
- - `-r, --repository <repository>`: Repository name
71
- - `-p, --pipeline-name <pipelineName>`: Pipeline name
72
- - `-b, --branch <branch>`: Branch name
73
- - `-v, --variables <key=value>`: Pipeline variable as key=value pair
74
- - `-w, --wait`: Wait for the pipeline to complete (default: false)
75
-
76
- ### dp-changeset-cli
77
-
78
- Manages versioning and changesets for mono-repos and single-package repos.
79
-
80
- ```bash
81
- dp-changeset-cli [command] [options]
82
- ```
83
-
84
- **Commands:**
85
-
86
- - `validate`: Validate changesets for the provided PR
87
- - `version`: Run Changeset versioning
88
- - `commit-tag`: Commit and tag the new version
89
- - `version-commit-tag`: Run versioning and commit-and-tag in sequence
90
- - `close-version`: Close a version and create a release branch
91
- - `create-changeset`: Create a changeset based on the current branch and Jira ticket information
92
-
93
- ### dp-auth0-cli
94
-
95
- Manages Auth0 tenant configuration across environments.
96
-
97
- ```bash
98
- dp-auth0-cli [command] [options]
99
- ```
100
-
101
- **Commands:**
102
-
103
- - `configureFromSite <fromSite> <toSite> <fromEnv> <toEnv> <deployUI> <deployGraphQLServer> <useNewDomain> <useS3>`: Configure Auth0 tenants
104
- - `getVaultSecrets <vaultPath>`: Get secrets from Vault
105
- - `configureAlias <site> <env> <username> <password> <realm>`: Configure Core Alias for the given site
106
- - `exportConf <site> <env>`: Export Auth0 configuration for the given site
107
- - `getAuth0Metadata <site> <env>`: Get Auth0 metadata for the given site
108
-
109
- ## Environment Configuration
110
-
111
- The CLI tools look for environment configuration in the following locations:
112
- - `.env.pipeline.local`
113
- - `config/.env.pipeline.local`
114
-
115
- ## Examples
116
-
117
- ```bash
118
- # Deploy from one site to another
119
- dp-next-cli deploy-from-site --from-env dev --to-env dev --from-site financialdev --to-site template --deploy-core true
120
-
121
- # Run a pipeline
122
- dp-next-cli run-pipeline -r docupace-next-e2e -b master -p run-tests-qa
123
-
124
- # Validate changesets
125
- dp-changeset-cli validate
126
-
127
- # Create a new changeset
128
- dp-changeset-cli create-changeset
129
-
130
- # Configure Auth0 for a site
131
- dp-auth0-cli configureFromSite sourceSite targetSite dev prod true true true false
132
- ```
133
-
134
- ## License
135
-
1
+ # Pipeline Shared Scripts
2
+
3
+ A collection of CLI tools for Docupace's CI/CD pipelines and deployment workflows.
4
+
5
+ ## Overview
6
+
7
+ This package provides a set of command-line interfaces (CLIs) to facilitate various DevOps operations in the Docupace ecosystem:
8
+
9
+ - `dp-next-cli`: Deployment and pipeline management for Next applications
10
+ - `dp-changeset-cli`: Versioning and changeset management
11
+ - `dp-auth0-cli`: Auth0 tenant configuration and management
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install @docupace/pipeline
17
+ ```
18
+
19
+ Or with pnpm:
20
+
21
+ ```bash
22
+ pnpm add @docupace/pipeline
23
+ ```
24
+
25
+ ## Command Line Interfaces
26
+
27
+ ### dp-next-cli
28
+
29
+ Manages deployment, Docker image handling, and infrastructure configuration.
30
+
31
+ ```bash
32
+ dp-next-cli [command] [options]
33
+ ```
34
+
35
+ **Commands:**
36
+
37
+ - `pull <imageName>`: Pull a Docker image from the registry
38
+ - `sonar`: Run Sonar analysis
39
+ - `addApacheSite`: Add site to apache
40
+ - `connectClone`: Clone connect site
41
+ - `haproxySync`: Sync haproxy config
42
+ - `vaultAddSiteData`: Add m2m auth0 data to vault
43
+ - `-s, --site-name <siteName>`: Site name
44
+ - `-p, --site-config-remote-path <path>`: Site config remote path
45
+ - `publish`: Publish a Docker image
46
+ - `deploy-from-site`: Deploy an application for a specific site
47
+ - `-f, --from-env <fromEnv>`: Source environment
48
+ - `-t, --to-env <toEnv>`: Target environment
49
+ - `-F, --from-site <fromSite>`: Source site
50
+ - `-T, --to-site <toSite>`: Target site
51
+ - `-c, --deploy-core <deployCore>`: Deploy Core (default: "false")
52
+ - `-C, --deploy-connect <deployConnect>`: Deploy Connect (default: "false")
53
+ - `deploy-template`: Deploy an application for a specific site
54
+ - `deploy-app <application>`: Deploy an application for a specific site
55
+ - `deploy-core <env> <site>`: Deploy Core
56
+ - `-l, --liquibase <liquibase>`: Application name (default: "true")
57
+ - `-b, --branch <branch>`: Branch (default: "master")
58
+ - `deploy-connect <env> <site>`: Deploy Connect
59
+ - `-l, --liquibase <liquibase>`: Application name (default: "true")
60
+ - `-b, --branch <branch>`: Branch (default: "master")
61
+ - `deploy-core-pipeline <env> <site>`: Deploy Core via pipeline
62
+ - `-l, --liquibase <liquibase>`: Application name (default: "true")
63
+ - `-b, --branch <branch>`: Branch (default: "master")
64
+ - `copy`: Copy a Docker image between registries
65
+ - `-a, --application <application>`: Application name
66
+ - `-f, --from-env <fromEnv>`: Source environment
67
+ - `-t, --to-env <toEnv>`: Target environment
68
+ - `-g, --tag <tag>`: Image tag
69
+ - `run-pipeline`: Trigger a pipeline by name
70
+ - `-r, --repository <repository>`: Repository name
71
+ - `-p, --pipeline-name <pipelineName>`: Pipeline name
72
+ - `-b, --branch <branch>`: Branch name
73
+ - `-v, --variables <key=value>`: Pipeline variable as key=value pair
74
+ - `-w, --wait`: Wait for the pipeline to complete (default: false)
75
+
76
+ ### dp-changeset-cli
77
+
78
+ Manages versioning and changesets for mono-repos and single-package repos.
79
+
80
+ ```bash
81
+ dp-changeset-cli [command] [options]
82
+ ```
83
+
84
+ **Commands:**
85
+
86
+ - `validate`: Validate changesets for the provided PR
87
+ - `version`: Run Changeset versioning
88
+ - `commit-tag`: Commit and tag the new version
89
+ - `version-commit-tag`: Run versioning and commit-and-tag in sequence
90
+ - `close-version`: Close a version and create a release branch
91
+ - `create-changeset`: Create a changeset based on the current branch and Jira ticket information
92
+
93
+ ### dp-auth0-cli
94
+
95
+ Manages Auth0 tenant configuration across environments.
96
+
97
+ ```bash
98
+ dp-auth0-cli [command] [options]
99
+ ```
100
+
101
+ **Commands:**
102
+
103
+ - `configureFromSite <fromSite> <toSite> <fromEnv> <toEnv> <deployUI> <deployGraphQLServer> <useNewDomain> <useS3>`: Configure Auth0 tenants
104
+ - `getVaultSecrets <vaultPath>`: Get secrets from Vault
105
+ - `configureAlias <site> <env> <username> <password> <realm>`: Configure Core Alias for the given site
106
+ - `exportConf <site> <env>`: Export Auth0 configuration for the given site
107
+ - `getAuth0Metadata <site> <env>`: Get Auth0 metadata for the given site
108
+
109
+ ## Environment Configuration
110
+
111
+ The CLI tools look for environment configuration in the following locations:
112
+ - `.env.pipeline.local`
113
+ - `config/.env.pipeline.local`
114
+
115
+ ## Examples
116
+
117
+ ```bash
118
+ # Deploy from one site to another
119
+ dp-next-cli deploy-from-site --from-env dev --to-env dev --from-site financialdev --to-site template --deploy-core true
120
+
121
+ # Run a pipeline
122
+ dp-next-cli run-pipeline -r docupace-next-e2e -b master -p run-tests-qa
123
+
124
+ # Validate changesets
125
+ dp-changeset-cli validate
126
+
127
+ # Create a new changeset
128
+ dp-changeset-cli create-changeset
129
+
130
+ # Configure Auth0 for a site
131
+ dp-auth0-cli configureFromSite sourceSite targetSite dev prod true true true false
132
+ ```
133
+
134
+ ## License
135
+
136
136
  ISC
@@ -1,58 +1,58 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- ENV=$1
5
-
6
- if [ -z "$ENV" ]; then
7
- echo "Usage: $0 <environment>"
8
- exit 1
9
- fi
10
-
11
- TENANT_ID="docupace.onmicrosoft.com"
12
- CLIENT_ID=$ARM_CLIENT_ID
13
- CLIENT_SECRET=$ARM_CLIENT_SECRET
14
- NEW_REDIRECT="https://docupace-$ENV-$SITE_NAME.us.auth0.com/login/callback"
15
- APP_ID="auth0-$ENV-docupace"
16
- APP_SCOPE="https://graph.microsoft.com/.default"
17
- GRAPH_API="https://graph.microsoft.com/v1.0"
18
-
19
- ACCESS_TOKEN=$(curl -s -X POST \
20
- -H "Content-Type: application/x-www-form-urlencoded" \
21
- -d "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET&scope=$APP_SCOPE" \
22
- https://login.microsoftonline.com/$TENANT_ID/oauth2/v2.0/token | jq -r '.access_token')
23
-
24
- APP_DETAILS=$(curl -s -G "https://graph.microsoft.com/v1.0/applications" \
25
- -H "Authorization: Bearer $ACCESS_TOKEN" \
26
- -H "Content-Type: application/json" \
27
- --data-urlencode "\$filter=appId eq '$CLIENT_ID'")
28
-
29
- APP_ID=$(echo "$APP_DETAILS" | jq -r '.value[0].id')
30
- echo "Application ID: $APP_ID"
31
-
32
- CURRENT_REDIRECTS=$(echo "$APP_DETAILS" | jq -r '.value[0].web.redirectUris // []')
33
- echo "Current redirect URIs: $CURRENT_REDIRECTS"
34
-
35
- if echo "$CURRENT_REDIRECTS" | jq -e --arg uri "$NEW_REDIRECT" 'index($uri)' > /dev/null; then
36
- echo "Redirect URI '$NEW_REDIRECT' already exists. No update needed."
37
- else
38
- UPDATED_REDIRECTS=$(echo "$CURRENT_REDIRECTS" | jq --arg uri "$NEW_REDIRECT" '. + [$uri]')
39
- echo "Updated redirect URIs: $UPDATED_REDIRECTS"
40
-
41
- UPDATE_REDIRECTS=$(curl -fs -X PATCH \
42
- -H "Authorization: Bearer $ACCESS_TOKEN" \
43
- -H "Content-Type: application/json" \
44
- -d "{
45
- \"web\": {
46
- \"redirectUris\": $UPDATED_REDIRECTS
47
- }
48
- }" \
49
- "https://graph.microsoft.com/v1.0/applications/$APP_ID")
50
-
51
- if [ $? -eq 0 ]; then
52
- echo "Successfully updated redirect URIs"
53
- echo $UPDATE_REDIRECTS
54
- else
55
- echo "Failed to update redirect URIs"
56
- echo $UPDATE_REDIRECTS
57
- fi
58
- fi
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ ENV=$1
5
+
6
+ if [ -z "$ENV" ]; then
7
+ echo "Usage: $0 <environment>"
8
+ exit 1
9
+ fi
10
+
11
+ TENANT_ID="docupace.onmicrosoft.com"
12
+ CLIENT_ID=$ARM_CLIENT_ID
13
+ CLIENT_SECRET=$ARM_CLIENT_SECRET
14
+ NEW_REDIRECT="https://docupace-$ENV-$SITE_NAME.us.auth0.com/login/callback"
15
+ APP_ID="auth0-$ENV-docupace"
16
+ APP_SCOPE="https://graph.microsoft.com/.default"
17
+ GRAPH_API="https://graph.microsoft.com/v1.0"
18
+
19
+ ACCESS_TOKEN=$(curl -s -X POST \
20
+ -H "Content-Type: application/x-www-form-urlencoded" \
21
+ -d "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET&scope=$APP_SCOPE" \
22
+ https://login.microsoftonline.com/$TENANT_ID/oauth2/v2.0/token | jq -r '.access_token')
23
+
24
+ APP_DETAILS=$(curl -s -G "https://graph.microsoft.com/v1.0/applications" \
25
+ -H "Authorization: Bearer $ACCESS_TOKEN" \
26
+ -H "Content-Type: application/json" \
27
+ --data-urlencode "\$filter=appId eq '$CLIENT_ID'")
28
+
29
+ APP_ID=$(echo "$APP_DETAILS" | jq -r '.value[0].id')
30
+ echo "Application ID: $APP_ID"
31
+
32
+ CURRENT_REDIRECTS=$(echo "$APP_DETAILS" | jq -r '.value[0].web.redirectUris // []')
33
+ echo "Current redirect URIs: $CURRENT_REDIRECTS"
34
+
35
+ if echo "$CURRENT_REDIRECTS" | jq -e --arg uri "$NEW_REDIRECT" 'index($uri)' > /dev/null; then
36
+ echo "Redirect URI '$NEW_REDIRECT' already exists. No update needed."
37
+ else
38
+ UPDATED_REDIRECTS=$(echo "$CURRENT_REDIRECTS" | jq --arg uri "$NEW_REDIRECT" '. + [$uri]')
39
+ echo "Updated redirect URIs: $UPDATED_REDIRECTS"
40
+
41
+ UPDATE_REDIRECTS=$(curl -fs -X PATCH \
42
+ -H "Authorization: Bearer $ACCESS_TOKEN" \
43
+ -H "Content-Type: application/json" \
44
+ -d "{
45
+ \"web\": {
46
+ \"redirectUris\": $UPDATED_REDIRECTS
47
+ }
48
+ }" \
49
+ "https://graph.microsoft.com/v1.0/applications/$APP_ID")
50
+
51
+ if [ $? -eq 0 ]; then
52
+ echo "Successfully updated redirect URIs"
53
+ echo $UPDATE_REDIRECTS
54
+ else
55
+ echo "Failed to update redirect URIs"
56
+ echo $UPDATE_REDIRECTS
57
+ fi
58
+ fi
@@ -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
+