Skip to content

Commit bd4694a

Browse files
committed
Update CI credential credhub references
Use better credhub key references and specify parameters in task yaml. Closes gh-90
1 parent 3308ad7 commit bd4694a

9 files changed

+43
-26
lines changed

ci/pipeline.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ jobs:
156156
file: git-repo/ci/tasks/sync-to-maven-central.yml
157157
params:
158158
BINTRAY_USERNAME: ((bintray-username))
159-
BINTRAY_PASSWORD: ((bintray-password))
160-
SONATYPE_USERNAME: ((sonatype-username))
161-
SONATYPE_PASSWORD: ((sonatype-password))
159+
BINTRAY_API_KEY: ((bintray-api-key))
162160
BINTRAY_SUBJECT: ((bintray-subject))
163161
BINTRAY_REPO: ((bintray-repo))
162+
SONATYPE_USER_TOKEN: ((sonatype-user-token))
163+
SONATYPE_PASSWORD_TOKEN: ((sonatype-password-token))
164164
- name: publish-eclipse-update-site
165165
serial: true
166166
plan:
@@ -177,9 +177,7 @@ jobs:
177177
file: git-repo/ci/tasks/publish-eclipse-update-site.yml
178178
params:
179179
BINTRAY_USERNAME: ((bintray-username))
180-
BINTRAY_PASSWORD: ((bintray-password))
181-
SONATYPE_USERNAME: ((sonatype-username))
182-
SONATYPE_PASSWORD: ((sonatype-password))
180+
BINTRAY_API_KEY: ((bintray-api-key))
183181
BINTRAY_SUBJECT: ((bintray-subject))
184182
BINTRAY_REPO: ((bintray-repo))
185183
groups:

ci/scripts/promote.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ groupId=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].i
99
version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' )
1010

1111

12-
if [[ $RELEASE_TYPE = "M" ]]; then
12+
if [[ ${RELEASE_TYPE} = "M" ]]; then
1313
targetRepo="libs-milestone-local"
14-
elif [[ $RELEASE_TYPE = "RC" ]]; then
14+
elif [[ ${RELEASE_TYPE} = "RC" ]]; then
1515
targetRepo="libs-milestone-local"
16-
elif [[ $RELEASE_TYPE = "RELEASE" ]]; then
16+
elif [[ ${RELEASE_TYPE} = "RELEASE" ]]; then
1717
targetRepo="libs-release-local"
1818
else
19-
echo "Unknown release type $RELEASE_TYPE" >&2; exit 1;
19+
echo "Unknown release type ${RELEASE_TYPE}" >&2; exit 1;
2020
fi
2121

2222
echo "Promoting ${buildName}/${buildNumber} to ${targetRepo}"
@@ -32,7 +32,7 @@ curl \
3232
-X \
3333
POST "${ARTIFACTORY_SERVER}/api/build/promote/${buildName}/${buildNumber}" > /dev/null || { echo "Failed to promote" >&2; exit 1; }
3434

35-
if [[ $RELEASE_TYPE = "RELEASE" ]]; then
35+
if [[ ${RELEASE_TYPE} = "RELEASE" ]]; then
3636
curl \
3737
-s \
3838
--connect-timeout 240 \
@@ -48,17 +48,17 @@ if [[ $RELEASE_TYPE = "RELEASE" ]]; then
4848
ARTIFACTS_PUBLISHED=false
4949
WAIT_TIME=5
5050
COUNTER=0
51-
while [ $ARTIFACTS_PUBLISHED == "false" ] && [ $COUNTER -lt 60 ]; do
51+
while [ $artifactsPublished == "false" ] && [ $COUNTER -lt 60 ]; do
5252
result=$( curl -s https://api.bintray.com/packages/"${BINTRAY_SUBJECT}"/"${BINTRAY_REPO}"/"${groupId}" )
5353
versions=$( echo "$result" | jq -r '.versions' )
5454
exists=$( echo "$versions" | grep "$version" -o || true )
5555
if [ "$exists" = "$version" ]; then
56-
ARTIFACTS_PUBLISHED=true
56+
artifactsPublished=true
5757
fi
5858
COUNTER=$(( COUNTER + 1 ))
5959
sleep $WAIT_TIME
6060
done
61-
if [[ $ARTIFACTS_PUBLISHED = "false" ]]; then
61+
if [[ $artifactsPublished = "false" ]]; then
6262
echo "Failed to publish"
6363
exit 1
6464
fi

ci/scripts/publish-eclipse-update-site.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ curl \
1313
-s \
1414
--connect-timeout 240 \
1515
--max-time 2700 \
16-
-u ${BINTRAY_USERNAME}:${BINTRAY_PASSWORD} \
16+
-u ${BINTRAY_USERNAME}:${BINTRAY_API_KEY} \
1717
-f \
1818
-X PUT \
1919
-T "artifactory-repo/io/spring/javaformat/io.spring.javaformat.eclipse.site/${version}/io.spring.javaformat.eclipse.site-${version}.zip" \
@@ -33,7 +33,7 @@ curl \
3333
-s \
3434
--connect-timeout 240 \
3535
--max-time 2700 \
36-
-u ${BINTRAY_USERNAME}:${BINTRAY_PASSWORD} \
36+
-u ${BINTRAY_USERNAME}:${BINTRAY_API_KEY} \
3737
-f \
3838
-X PUT \
3939
-T "target/repository/content.jar" \
@@ -43,7 +43,7 @@ curl \
4343
-s \
4444
--connect-timeout 240 \
4545
--max-time 2700 \
46-
-u ${BINTRAY_USERNAME}:${BINTRAY_PASSWORD} \
46+
-u ${BINTRAY_USERNAME}:${BINTRAY_API_KEY} \
4747
-f \
4848
-X PUT \
4949
-T "target/repository/artifacts.jar" \

ci/scripts/stage.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ git clone git-repo stage-git-repo > /dev/null
1313
pushd stage-git-repo > /dev/null
1414

1515
snapshotVersion=$( xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' pom.xml )
16-
if [[ $RELEASE_TYPE = "RELEASE" ]]; then
16+
if [[ ${RELEASE_TYPE} = "RELEASE" ]]; then
1717
stageVersion=$( strip_snapshot_suffix $snapshotVersion)
1818
nextVersion=$( bump_version_number $snapshotVersion)
1919
else
20-
echo "Unknown release type $RELEASE_TYPE" >&2; exit 1;
20+
echo "Unknown release type ${RELEASE_TYPE}" >&2; exit 1;
2121
fi
2222

23-
echo "Staging $stageVersion (next version will be $nextVersion)"
24-
run_maven versions:set -DnewVersion=$stageVersion -DgenerateBackupPoms=false
23+
echo "Staging ${stageVersion} (next version will be ${nextVersion})"
24+
run_maven versions:set -DnewVersion=${stageVersion} -DgenerateBackupPoms=false
2525
run_maven org.eclipse.tycho:tycho-versions-plugin:update-eclipse-metadata
2626

2727
git config user.name "Spring Buildmaster" > /dev/null
2828
git config user.email "[email protected]" > /dev/null
2929
git add pom.xml > /dev/null
30-
git commit -m"Release v$stageVersion" > /dev/null
31-
git tag -a "v$stageVersion" -m"Release v$stageVersion" > /dev/null
30+
git commit -m"Release v${stageVersion}" > /dev/null
31+
git tag -a "v${stageVersion}" -m"Release v${stageVersion}" > /dev/null
3232

3333
run_maven clean deploy -U -Dfull -DaltDeploymentRepository=distribution::default::file://${repository}
3434

@@ -38,7 +38,7 @@ run_maven versions:set -DnewVersion=$nextVersion -DgenerateBackupPoms=false
3838
run_maven org.eclipse.tycho:tycho-versions-plugin:update-eclipse-metadata
3939
sed -i "s/:release-version:.*/:release-version: ${stageVersion}/g" README.adoc
4040
git add . > /dev/null
41-
git commit -m"Next development version (v$nextVersion)" > /dev/null
41+
git commit -m"Next development version (v${nextVersion})" > /dev/null
4242

4343
echo "DONE"
4444

ci/scripts/sync-to-maven-central.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ echo "Syncing ${buildName}/${buildNumber} to Maven Central"
1111
-s \
1212
--connect-timeout 240 \
1313
--max-time 2700 \
14-
-u ${BINTRAY_USERNAME}:${BINTRAY_PASSWORD} \
15-
-H "Content-Type: application/json" -d "{\"username\": \"${SONATYPE_USERNAME}\", \"password\": \"${SONATYPE_PASSWORD}\"}" \
14+
-u ${BINTRAY_USERNAME}:${BINTRAY_API_KEY} \
15+
-H "Content-Type: application/json" -d "{\"username\": \"${SONATYPE_USER_TOKEN}\", \"password\": \"${SONATYPE_PASSWORD_TOKEN}\"}" \
1616
-f \
1717
-X \
1818
POST "https://api.bintray.com/maven_central_sync/${BINTRAY_SUBJECT}/${BINTRAY_REPO}/${groupId}/versions/${version}" > /dev/null || { echo "Failed to sync" >&2; exit 1; }

ci/tasks/promote.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,12 @@ platform: linux
33
inputs:
44
- name: git-repo
55
- name: artifactory-repo
6+
params:
7+
RELEASE_TYPE
8+
ARTIFACTORY_SERVER:
9+
ARTIFACTORY_USERNAME:
10+
ARTIFACTORY_PASSWORD:
11+
BINTRAY_SUBJECT:
12+
BINTRAY_REPO:
613
run:
714
path: git-repo/ci/scripts/promote.sh

ci/tasks/publish-eclipse-update-site.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ platform: linux
33
inputs:
44
- name: git-repo
55
- name: artifactory-repo
6+
params:
7+
BINTRAY_USERNAME:
8+
BINTRAY_API_KEY:
69
run:
710
path: git-repo/ci/scripts/publish-eclipse-update-site.sh

ci/tasks/stage.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ outputs:
88
caches:
99
- path: maven
1010
- path: gradle
11+
params:
12+
RELEASE_TYPE
1113
run:
1214
path: git-repo/ci/scripts/stage.sh

ci/tasks/sync-to-maven-central.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,12 @@ platform: linux
33
inputs:
44
- name: git-repo
55
- name: artifactory-repo
6+
params:
7+
BINTRAY_USERNAME:
8+
BINTRAY_API_KEY:
9+
BINTRAY_SUBJECT:
10+
BINTRAY_REPO:
11+
SONATYPE_USER_TOKEN:
12+
SONATYPE_PASSWORD_TOKEN:
613
run:
714
path: git-repo/ci/scripts/sync-to-maven-central.sh

0 commit comments

Comments
 (0)