Exit 0 if release job has already tagged a repo.
The release merge job is a one way operation.
Given this, Release jobs should only exist in the format
{project-name}-release-verify
and
{project-name}-release-merge
They should trigger from a change to any branch/**
As a developer working on {example-branch} will not want to
check out master to push a new release file.
Edge Cases:
Inevitably a release file will be pulled in from master to {example-branch}
or a remerge will be requested
This will again trigger the release jobs.
since in this case the repo is already tagged, the job should not report
a failure.
This is solved by having the verfiy and merge exit 0 when the repo is already tagged
if git tag -v "$VERSION"; then
echo "Repo already tagged $VERSION"
echo "This job has already run exit 0"
exit 0
if
Example Workflow - Milestone 0 is released from master:
releases/1.4.0.yaml (on branch master)
tag: 1.4.0
log_dir: 'optf-osdf-maven-stage-master/97/'
Repo is tagged and artifact is pushed!
Milestone 3 is released from dublin:
releases/1.4.3.yaml (on branch dublin)
tag: 1.4.3
log_dir: 'optf-osdf-maven-stage-dublin/20/'
Repo is tagged and artifact is pushed!
Note:
the ref is determined by the log file.
So We could check if this ref can be found on the {branch}
to reduce human errors.
example:
odlparent-maven-stage-4.0.x/152/patches/taglist.log.gz
has:
odlparent
c8964051cf81e2bd5d831fe6e5d568c5eedeeb8e
Psudo code:
STREAM=${STREAM:-'nostream'}
echo "--> Checking if $ref is on stable/$STREAM"
if ! (git branch -a --contains $ref | grep "stable/$STREAM"); then
echo "--> ERROR: $ref for $repo is not on stable/$STREAM!"
fi
Also in this patch:
To reduce possible errors:
Don't get project name from the release file:
PROJECT="$(niet ".project" "$release_file")"
we can just use ${PROJECT//\//-} when we need
the /'s changed to -'s
It will allways be correct when passed to jenkins
from gerrit
Also remove quiet from wget,
if there is a failure I want to see it on the console.
Signed-off-by: Aric Gardner <agardner@linuxfoundation.org>
Change-Id: I1e95e864bc2b49a62b3f7016cb2f1292a6687d9a