Skip to content

Commit be79238

Browse files
committed
Merged in issue/CONFSRVDEV-31627-configure-build-and-patch-vuln-fix (pull request spring-projects#1)
CONFSRVDEV-31627-adding bitbucket-pipline.yml file Approved-by: Ganesh Gautam Approved-by: Richard Atkins
2 parents a65ea79 + 5824e76 commit be79238

File tree

101 files changed

+184
-13897
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+184
-13897
lines changed

.java-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.8

bitbucket-pipelines.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# The workflow allows running tests, code checkstyle and security scans on the default branch.
2+
3+
# Prerequisites: appropriate project structure should exist in the repository.
4+
5+
image: gradle:8.7.0-jdk8
6+
7+
steps:
8+
- step: &build-test
9+
size: 4x
10+
name: Build and Test
11+
caches:
12+
- gradle
13+
script:
14+
- ./gradlew clean build
15+
after-script:
16+
- pipe: atlassian/checkstyle-report:0.3.0
17+
- step: &security-scan
18+
name: Security Scan
19+
script:
20+
# Run a security scan for sensitive data.
21+
# See more security tools at https://bitbucket.org/product/features/pipelines/integrations?&category=security
22+
- pipe: atlassian/git-secrets-scan:0.5.1
23+
- step: &release-version
24+
size: 4x
25+
name: Release custom milestone version
26+
trigger: manual
27+
caches:
28+
- maven
29+
- gradle
30+
script:
31+
# Artifactory sidekick enable "Authless pipelines", running this pipe automatically obtains a temporary set of credentials to packages.atlassian.com.
32+
# Run the pipe to generate the .artifactory directory
33+
- pipe: atlassian/artifactory-sidekick:v1
34+
# Install the config files to the home directory and add env vars
35+
- source .artifactory/activate.sh
36+
- echo "Final version release"
37+
- ./release-script.sh RELEASE
38+
pipelines:
39+
custom: # Pipelines that are triggered manually
40+
run-custom-release: # The name that is displayed in the list in the Bitbucket Cloud GUI
41+
- variables:
42+
- name: RELEASE_TYPE
43+
default: "RELEASE" # optionally provide a default variable value
44+
description: "Release type - CUSTOM, MILESTONE, RELEASE" # description for the variable
45+
- name: CUSTOM_VERSION
46+
default: "" # optionally provide a default variable value
47+
description: "Custom version to release. If release milestone, please give only m01, m02.." # description for the variable
48+
- step: &release-custom-version
49+
size: 4x
50+
name: Release custom milestone version
51+
caches:
52+
- maven
53+
- gradle
54+
script:
55+
# Artifactory sidekick enable "Authless pipelines", running this pipe automatically obtains a temporary set of credentials to packages.atlassian.com.
56+
# Run the pipe to generate the .artifactory directory
57+
- pipe: atlassian/artifactory-sidekick:v1
58+
# Install the config files to the home directory and add env vars
59+
- source .artifactory/activate.sh
60+
- echo "Releasing $RELEASE_TYPE version $CUSTOM_VERSION"
61+
- ./release-script.sh $RELEASE_TYPE $CUSTOM_VERSION
62+
default:
63+
- step:
64+
<<: *build-test
65+
- step:
66+
<<: *security-scan
67+
pull-requests:
68+
'**':
69+
- step:
70+
<<: *build-test
71+
- step:
72+
<<: *security-scan
73+
branches:
74+
'**':
75+
- step:
76+
<<: *build-test
77+
- step:
78+
<<: *security-scan
79+
release/*:
80+
- step:
81+
<<: *build-test
82+
- step:
83+
<<: *security-scan
84+
- step:
85+
<<: *release-version

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version=5.3.38-SNAPSHOT
1+
version=5.3.38-atlassian-1-02
22
org.gradle.jvmargs=-Xmx2048m
33
org.gradle.caching=true
44
org.gradle.parallel=true

gradle/publications.gradle

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,9 @@ publishing {
2121
}
2222
}
2323
scm {
24-
url = "https://github.com/spring-projects/spring-framework"
25-
connection = "scm:git:git://github.com/spring-projects/spring-framework"
26-
developerConnection = "scm:git:git://github.com/spring-projects/spring-framework"
27-
}
28-
developers {
29-
developer {
30-
id = "jhoeller"
31-
name = "Juergen Hoeller"
32-
33-
}
24+
url = "https://bitbucket.org/atlassian/spring-framework"
25+
connection = "scm:git:git://bitbucket.org/atlassian/spring-framework"
26+
developerConnection = "scm:git:git://bitbucket.org/atlassian/spring-framework"
3427
}
3528
issueManagement {
3629
system = "GitHub"
@@ -58,6 +51,10 @@ void configureDeploymentRepository(Project project) {
5851
publishing.repositories.maven {
5952
it.url = project.property("deploymentRepository")
6053
it.name = "deployment"
54+
credentials {
55+
username = project.ext.mavenUser
56+
password = project.ext.mavenPassword
57+
}
6158
}
6259
}
6360
}

release-script.sh

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/bin/bash
2+
set -e
3+
4+
function die_with() {
5+
echo "$*" >&2
6+
exit 1
7+
}
8+
9+
function rollback_and_die_with() {
10+
echo "$*" >&2
11+
12+
echo "Resetting release commit to return you to the same working state as before attempting a deploy"
13+
echo "> git reset --hard HEAD^1"
14+
git reset --hard HEAD^1 || echo "Git reset command failed!"
15+
16+
exit 1
17+
}
18+
19+
RELEASE_TYPE=$1
20+
CUSTOM_VERSION=$2
21+
22+
repository="https://packages.atlassian.com/maven/3rdparty"
23+
snapshotVersion=$( awk -F '=' '$1 == "version" { print $2 }' gradle.properties )
24+
stageVersion=$(awk -F"-" 'BEGIN{OFS-FS} $2 == "atlassian"{print $1"-"$2"-"$3+1}' gradle.properties > gradle.properties.tmp && awk -F '=' '$1 == "version" { print $2 }' gradle.properties.tmp && rm gradle.properties.tmp)
25+
nextVersion=$stageVersion"-SNAPSHOT"
26+
if [[ $RELEASE_TYPE = "RELEASE" ]]; then
27+
if [[ $(git branch --show-current) != "release/5.3.x" ]]; then
28+
die_with "Not on release/5.3.x branch."
29+
fi;
30+
stageVersion=${snapshotVersion//-SNAPSHOT/}
31+
elif [[ $RELEASE_TYPE = "CUSTOM" ]]; then
32+
if [[ $(git branch --show-current) = "release/5.3.x" ]]; then
33+
die_with "Please use your custom branch"
34+
fi;
35+
stageVersion=$CUSTOM_VERSION
36+
nextVersion=$snapshotVersion
37+
elif [[ $RELEASE_TYPE = "MILESTONE" ]]; then
38+
if [[ $(git branch --show-current) = "release/5.3.x" ]]; then
39+
die_with "Please use your custom branch."
40+
fi;
41+
stageVersion=${snapshotVersion//SNAPSHOT/$2}
42+
nextVersion=$snapshotVersion
43+
else
44+
die_with "Unknown release type $RELEASE_TYPE"
45+
fi
46+
47+
echo "Staging $stageVersion (next version will be $nextVersion)"
48+
sed -i -e "s/version=$snapshotVersion/version=$stageVersion/" gradle.properties
49+
50+
if [[ -e gradle.properties-e ]]; then
51+
rm gradle.properties-e
52+
fi;
53+
54+
git fetch --tags --all
55+
git add gradle.properties
56+
git commit -m "Release v$stageVersion" || die_with "Failed to commit updated gradle.properties for release! Please do this manually"
57+
58+
if [[ $(git tag -l "v$stageVersion") ]]; then
59+
die_with "Tag $stageVersion already exists"
60+
fi;
61+
62+
git tag -a "v$stageVersion" -m "Release v$stageVersion" || die_with "Failed to tag release! Please do this manually"
63+
64+
./gradlew --no-daemon --max-workers=4 -PdeploymentRepository=${repository} clean build publishAllPublicationsToDeploymentRepository || rollback_and_die_with "Failed to deploy release artifacts! Rolling back..."
65+
66+
if [[ $nextVersion != $snapshotVersion ]]; then
67+
echo "Setting next development version (v$nextVersion)"
68+
sed -i -e "s/version=$snapshotVersion/version=$nextVersion/" gradle.properties
69+
if [[ -e gradle.properties-e ]]; then
70+
rm gradle.properties-e
71+
fi;
72+
73+
git add gradle.properties
74+
git commit -a -m "Next development version v${nextVersion}" || die_with "Failed to commit updated pom.xml versions for next dev version! Please do this manually"
75+
fi;
76+
git push || die_with "Failed to push commits. Please do this manually"
77+
git push --tags || die_with "Failed to push tags. Please do this manually"
78+
echo "Release complete"

0 commit comments

Comments
 (0)