Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69b94ecc8f |
No files matched your search
@@ -220,6 +220,16 @@ whole-branch changes, tags, errors, defaults and source/packed parity. The hoste
|
|||||||
pipeline-contract-test runs the source suite and shared Maven behavioral tests;
|
pipeline-contract-test runs the source suite and shared Maven behavioral tests;
|
||||||
the full local target additionally extracts and executes the actual packed command.
|
the full local target additionally extracts and executes the actual packed command.
|
||||||
|
|
||||||
|
## Node snapshot versions
|
||||||
|
|
||||||
|
The shared Node publisher calculates develop snapshots as
|
||||||
|
`MAJOR.MINOR.NEXT_PATCH-SNAPSHOT.CIRCLE_BUILD_NUM`. A positive CircleCI job number
|
||||||
|
is required, so independent publication jobs receive distinct npm coordinates.
|
||||||
|
The package version is changed only in the build workspace and published under
|
||||||
|
the `snapshot` dist-tag. No snapshot version commit is pushed: the branch remains
|
||||||
|
at the source revision whose required checks ran, avoiding unchecked `[skip ci]`
|
||||||
|
heads and recursive publication. Stable, RC and hotfix version policies are unchanged.
|
||||||
|
|
||||||
## Android and MCP policy profiles
|
## Android and MCP policy profiles
|
||||||
|
|
||||||
`android` and `mcp-policy` accept only profile, orb_version and default_branch.
|
`android` and `mcp-policy` accept only profile, orb_version and default_branch.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ description: >
|
|||||||
- Adds SSH keys for Git operations
|
- Adds SSH keys for Git operations
|
||||||
- Sets up Git identity for version commits
|
- Sets up Git identity for version commits
|
||||||
- Synchronizes NPM version
|
- Synchronizes NPM version
|
||||||
- Commits version changes if modified (skipped for feature branches)
|
- Commits version changes if modified (skipped for feature and snapshot builds)
|
||||||
|
|
||||||
parameters:
|
parameters:
|
||||||
branch_type:
|
branch_type:
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ echo "Publishing version: $VERSION"
|
|||||||
if [[ "$VERSION" =~ -RC\.[0-9]+$ ]]; then
|
if [[ "$VERSION" =~ -RC\.[0-9]+$ ]]; then
|
||||||
NPM_TAG="rc"
|
NPM_TAG="rc"
|
||||||
echo "Detected RC version - using tag: $NPM_TAG"
|
echo "Detected RC version - using tag: $NPM_TAG"
|
||||||
elif [[ "$VERSION" =~ -SNAPSHOT$ ]]; then
|
elif [[ "$VERSION" =~ -SNAPSHOT(\.[1-9][0-9]*)?$ ]]; then
|
||||||
NPM_TAG="snapshot"
|
NPM_TAG="snapshot"
|
||||||
echo "Detected SNAPSHOT version - using tag: $NPM_TAG"
|
echo "Detected SNAPSHOT version - using tag: $NPM_TAG"
|
||||||
elif [[ "$VERSION" =~ -(alpha|beta) ]]; then
|
elif [[ "$VERSION" =~ -(alpha|beta) ]]; then
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
## It also pushes the changes back to the current branch.
|
## It also pushes the changes back to the current branch.
|
||||||
##
|
##
|
||||||
## Process:
|
## Process:
|
||||||
## 1. Skips for feature branches (ephemeral versions)
|
## 1. Skips for feature and snapshot builds (ephemeral versions)
|
||||||
## 2. Checks if package.json has been modified
|
## 2. Checks if package.json has been modified
|
||||||
## 3. Extracts the new version from package.json
|
## 3. Extracts the new version from package.json
|
||||||
## 4. Commits the changes with skip ci flag
|
## 4. Commits the changes with skip ci flag
|
||||||
@@ -22,12 +22,12 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
## Skip version commit for feature branches ##
|
## Skip version commit for feature and snapshot builds ##
|
||||||
## Feature versions are ephemeral and don't need to be ##
|
## These versions are ephemeral and don't need to be ##
|
||||||
## persisted back to the repository ##
|
## persisted back to the repository ##
|
||||||
################################################################
|
################################################################
|
||||||
if [[ "$BRANCH_TYPE" == "feature" ]]; then
|
if [[ "$BRANCH_TYPE" == "feature" || "$BRANCH_TYPE" == "snapshot" ]]; then
|
||||||
echo "Skipping version commit for feature branch (ephemeral versions)"
|
echo "Skipping version commit for $BRANCH_TYPE build (ephemeral version)"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -28,13 +28,17 @@ if [[ "$CURRENT_BRANCH" == "main" ]]; then
|
|||||||
TARGET_VERSION="$MAJOR_MINOR.0"
|
TARGET_VERSION="$MAJOR_MINOR.0"
|
||||||
echo "Main branch detected - targeting release version: $TARGET_VERSION"
|
echo "Main branch detected - targeting release version: $TARGET_VERSION"
|
||||||
elif [[ "$CURRENT_BRANCH" == "develop" ]]; then
|
elif [[ "$CURRENT_BRANCH" == "develop" ]]; then
|
||||||
# Develop branch - should be a snapshot version (e.g., 1.0.127-SNAPSHOT)
|
# Snapshot coordinates are unique per CI job without pushing a version commit.
|
||||||
# Increment patch version for develop
|
# The source head stays the head whose required checks are being reported.
|
||||||
|
if [[ ! "${CIRCLE_BUILD_NUM:-}" =~ ^[1-9][0-9]*$ ]]; then
|
||||||
|
echo "ERROR: Snapshot publication requires a positive CIRCLE_BUILD_NUM" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
MAJOR_MINOR_PATCH="${NPM_VERSION%-*}"
|
MAJOR_MINOR_PATCH="${NPM_VERSION%-*}"
|
||||||
MAJOR_MINOR="${MAJOR_MINOR_PATCH%.*}"
|
MAJOR_MINOR="${MAJOR_MINOR_PATCH%.*}"
|
||||||
PATCH="${MAJOR_MINOR_PATCH##*.}"
|
PATCH="${MAJOR_MINOR_PATCH##*.}"
|
||||||
NEW_PATCH=$((PATCH + 1))
|
NEW_PATCH=$((PATCH + 1))
|
||||||
TARGET_VERSION="$MAJOR_MINOR.$NEW_PATCH-SNAPSHOT"
|
TARGET_VERSION="$MAJOR_MINOR.$NEW_PATCH-SNAPSHOT.$CIRCLE_BUILD_NUM"
|
||||||
echo "Develop branch detected - targeting snapshot version: $TARGET_VERSION"
|
echo "Develop branch detected - targeting snapshot version: $TARGET_VERSION"
|
||||||
elif [[ "$CURRENT_BRANCH" == release/* ]]; then
|
elif [[ "$CURRENT_BRANCH" == release/* ]]; then
|
||||||
# Release branch - should be a release candidate (e.g., 1.0.0-RC.1, 1.0.0-RC.2, etc.)
|
# Release branch - should be a release candidate (e.g., 1.0.0-RC.1, 1.0.0-RC.2, etc.)
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ sys.exit(subprocess.run([os.environ['TEST_REAL_NODE'], *sys.argv[1:]], input=sou
|
|||||||
def test_tags_and_legacy_authentication(self):
|
def test_tags_and_legacy_authentication(self):
|
||||||
for trusted in [True, False]:
|
for trusted in [True, False]:
|
||||||
for version, tag in [('1.0.0-RC.1', 'rc'), ('1.0.0-SNAPSHOT', 'snapshot'),
|
for version, tag in [('1.0.0-RC.1', 'rc'), ('1.0.0-SNAPSHOT', 'snapshot'),
|
||||||
|
('1.0.0-SNAPSHOT.101', 'snapshot'),
|
||||||
('1.0.0-alpha.1', 'next'), ('1.0.0-beta.1', 'next'), ('1.0.0', 'latest')]:
|
('1.0.0-alpha.1', 'next'), ('1.0.0-beta.1', 'next'), ('1.0.0', 'latest')]:
|
||||||
with self.subTest(trusted=trusted, version=version):
|
with self.subTest(trusted=trusted, version=version):
|
||||||
result, args, oidc = self.run_publish(version, trusted)
|
result, args, oidc = self.run_publish(version, trusted)
|
||||||
@@ -133,5 +134,38 @@ sys.exit(subprocess.run([os.environ['TEST_REAL_NODE'], *sys.argv[1:]], input=sou
|
|||||||
self.assertNotIn('Successfully published', result.stdout)
|
self.assertNotIn('Successfully published', result.stdout)
|
||||||
|
|
||||||
|
|
||||||
|
class SnapshotVersionTests(unittest.TestCase):
|
||||||
|
def test_snapshot_jobs_keep_source_head_and_publish_distinct_versions(self):
|
||||||
|
with tempfile.TemporaryDirectory() as directory:
|
||||||
|
root = Path(directory)
|
||||||
|
def git(*args):
|
||||||
|
return subprocess.check_output(['git', *args], cwd=root, text=True).strip()
|
||||||
|
git('init', '-q', '-b', 'develop')
|
||||||
|
source = '{"name": "snapshot-test", "version": "0.40.27-SNAPSHOT"}\n'
|
||||||
|
package = root / 'package.json'
|
||||||
|
package.write_text(source)
|
||||||
|
git('add', 'package.json')
|
||||||
|
git('-c', 'user.name=Test', '-c', 'user.email=test@example.invalid',
|
||||||
|
'-c', 'commit.gpgsign=false', 'commit', '-qm', 'initial source')
|
||||||
|
head = git('rev-parse', 'HEAD')
|
||||||
|
for number in ('101', '102'):
|
||||||
|
package.write_text(source)
|
||||||
|
env = dict(os.environ, CIRCLE_BUILD_NUM=number, BRANCH_TYPE='snapshot')
|
||||||
|
subprocess.run(['bash', str(SCRIPT.parent / 'sync-npm-version.sh')],
|
||||||
|
cwd=root, env=env, check=True, capture_output=True)
|
||||||
|
self.assertEqual(json.loads(package.read_text())['version'], '0.40.28-SNAPSHOT.' + number)
|
||||||
|
subprocess.run(['bash', str(SCRIPT.parent / 'node_version_commit.sh')],
|
||||||
|
cwd=root, env=env, check=True, capture_output=True)
|
||||||
|
self.assertEqual(git('rev-parse', 'HEAD'), head)
|
||||||
|
self.assertEqual(git('diff', '--cached', '--name-only'), '')
|
||||||
|
for number in ('', '0', '01', '-1', 'abc'):
|
||||||
|
package.write_text(source)
|
||||||
|
result = subprocess.run(['bash', str(SCRIPT.parent / 'sync-npm-version.sh')],
|
||||||
|
cwd=root, env=dict(os.environ, CIRCLE_BUILD_NUM=number),
|
||||||
|
capture_output=True)
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
self.assertEqual(package.read_text(), source)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
Reference in new issue
Block a user