This commit is contained in:
Timo 2021-05-05 09:58:39 +03:00
parent 883e7c2877
commit fbba5afbbd
4 changed files with 6 additions and 64 deletions

View File

@ -62,8 +62,6 @@ public class PlanSpec {
return new Plan(project(), "Redaction UI", new BambooKey("UI"))
.description("Docker build for Redaction UI.")
.stages(new Stage("Build Stage").jobs(creatGinCloudPlatformImagesJob("red-ui")))
.stages(new Stage("Upstream Push Stage")
.jobs(creatGinCloudPlatformUpstreamJob()))
.stages(new Stage("Release")
.manual(true)
.jobs(createRelease()))
@ -79,48 +77,15 @@ public class PlanSpec {
.checkoutItems(new CheckoutItem().defaultRepository()), new ScriptTask().description("Build")
.location(ScriptTaskProperties.Location.FILE)
.fileFromPath("bamboo-specs/src/main/resources/scripts/build.sh")
.environmentVariables("BRANCH_NAME=\"${bamboo.planRepository.branchName}\"")
.environmentVariables("PROJECT=\"" + project + "\"")
).dockerConfiguration(
new DockerConfiguration().image("nexus.iqser.com:5001/infra/release_build:2.9.1")
.volume("/var/run/docker.sock", "/var/run/docker.sock"));
}
public Job creatGinCloudPlatformUpstreamJob() {
return new Job("Upstream Push", new BambooKey("USPSH"))
.tasks(
new VcsCheckoutTask().description("Checkout Default Repository")
.checkoutItems(new CheckoutItem().defaultRepository()),
// update versions
new ScriptTask().description("Build")
.location(ScriptTaskProperties.Location.FILE)
.fileFromPath("bamboo-specs/src/main/resources/scripts/update-version.sh")
.environmentVariables("BRANCH_NAME=\"${bamboo.planRepository.branchName}\""),
// create version.properties file
new ScriptTask().description("Set Version Properties")
.location(ScriptTaskProperties.Location.FILE)
.fileFromPath("bamboo-specs/src/main/resources/scripts/set-version.properties.sh")
.environmentVariables("BRANCH_NAME=\"${bamboo.planRepository.branchName}\""),
// read version from created file
new InjectVariablesTask().path("version.properties"),
// commit release
new VcsCommitTask().commitMessage("chore(release)").repository("RED / ui"),
// create tag with this version
new VcsTagTask().tagName("${bamboo.inject.APP_VERSION}").repository("RED / ui"))
.dockerConfiguration(new DockerConfiguration().image("nexus.iqser.com:5001/infra/release_build:2.9.1")
.volume("/var/run/docker.sock", "/var/run/docker.sock"))
// publish artifact with this version
.volume("/var/run/docker.sock", "/var/run/docker.sock"))
.artifacts(new Artifact("version").location(".").copyPattern("**/version.properties").shared(true));
}
public Job createRelease() {
return new Job("Create Release", new BambooKey("CRLS"))
.tasks(

View File

@ -18,6 +18,7 @@ then
version=$(jq -r '.version' < package.json)
fi
echo "Building version $version"
docker build -t "$imageName":latest -f "$dockerfileLocation" .
@ -25,11 +26,11 @@ if [[ -n ${version+z} ]]
then
echo "Publishing Images with version $version"
echo "${BAMBOO_DOWNLOAD_PASS} | docker login -u $BAMBOO_DOWNLOAD_USER --password-stdin nexus.iqser.com:5001"
echo "$bamboo_bamboo_download_pass | docker login -u $bamboo_bamboo_download_user --password-stdin nexus.iqser.com:5001"
docker push "$imageName}:latest"
docker push "$imageName:latest"
docker tag "$imageName:latest" "$imageName:$version"
docker push "$imageName}:$version"
docker push "$imageName:$version"
else
echo "Not on a relevant branch $BRANCH_NAME ... skipping."

View File

@ -1,5 +0,0 @@
#!/bin/bash
version=$(jq -r '.version' < package.json)
echo "Preparing release properties for version ${version}"
echo "APP_VERSION=${version}" > version.properties

View File

@ -1,19 +0,0 @@
#!/bin/bash
if [[ "${BRANCH_NAME}" == "master" ]]
then
./versions.sh minor
echo "Updating minor version ... "
fi
if [[ "${BRANCH_NAME}" == release* ]]
then
./versions.sh patch
echo "Updating patch version ... "
fi
version=$(jq -r '.version' < package.json)
echo "At version ${version}"