Migrated release script to use Buck exclusively.

Change-Id: I04371594b68071488788c4ecbdb896a6306a2a14
This commit is contained in:
Thomas Vachuska 2016-10-25 16:59:29 -07:00 committed by Brian O'Connor
parent 6066dff896
commit be1a1964bb
6 changed files with 66 additions and 7 deletions

10
BUCK
View File

@ -47,3 +47,13 @@ java_library(
visibility = ['PUBLIC'],
deps = INSTALL
)
tar_file(
name = 'onos-test',
root = 'onos-test-%s' % ONOS_VERSION,
srcs = glob(['tools/test/**/*']) + [
'tools/dev/bash_profile',
'tools/dev/bin/onos-app',
'tools/build/envDefaults'
],
)

View File

@ -262,3 +262,25 @@ def osgi_jar_with_tests(
srcs = test_srcs,
jar_target = ':' + name + '-tests',
)
def tar_file(
name,
srcs,
root = None,
out = None,
visibility = [ 'PUBLIC' ],
):
cmd = ( 'mkdir -p $TMP/%(root_dir)s && '
'cp -r $SRCDIR/ $TMP/%(root_dir)s && '
'tar -C $TMP -zcf $OUT %(root_dir)s' ) % {
'root_dir': root if root is not None else name
}
genrule(
name = name,
srcs = srcs,
bash = cmd,
out = out if out is not None else ( root if root is not None else name ) + '.tar.gz',
visibility = visibility,
)

View File

@ -3,6 +3,9 @@
# Packages ONOS test facilities into onos-test.tar.gz
# -----------------------------------------------------------------------------
echo "Use 'onos-buck build //:onos-test' instead"
exit 1
set -e
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1

View File

@ -26,10 +26,14 @@ export ONOS_VERSION=$NEW_VERSION
onos-validate-change-version
# Build ONOS & deploy to staging repo using the release profile.
onos-build && onos-package --tar --zip && mvn -Prelease clean deploy -DskipTests
onos-buck build onos
time onos-buck-publish
# Build ONOS docs
onos-build-docs
onos-buck build //docs:internal //docs:external
# Package test tar.gz
onos-buck build //:onos-test
# Build ONOS archetypes & deploy to staging repo using the release profile.
# Note that release of the staging repository is a separate manual step.

View File

@ -9,6 +9,20 @@ set -e
. $ONOS_ROOT/tools/build/envDefaults
#FIXME need to export s3Creds
#TODO we could verify that ONOS_VERSION is set, and only upload that version
onosUploadBits.py
# Stage the onos tar in /tmp
rm -f $ONOS_TAR
cp $(onos-buck build onos --show-output | tail -1 | cut -d\ -f2) $ONOS_TAR
# Repackage the onos tar
pushd /tmp/
tar xf onos-$ONOS_VERSION.tar.gz
rm -f onos-$ONOS_VERSION.zip
zip -r onos-$ONOS_VERSION.zip onos-$ONOS_VERSION/
popd
# Stage the test bits tar in /tmp
rm -f $ONOS_TEST_TAR
cp $(onos-buck build //:onos-test --show-output | tail -1 | cut -d\ -f2) $ONOS_TEST_TAR
onosUploadBits.py $ONOS_VERSION

View File

@ -14,11 +14,11 @@ from uploadToS3 import uploadFile
nightlyTag = 'NIGHTLY'
bitsPath = '/tmp'
prefix = 'onos-(\d+\.\d+\.\d+)'
prefix = 'onos-(?:test-)?(\d+\.\d+\.\d+)'
buildNum = '\.?([\w-]*)'
ext = '\.(?:tar\.gz|zip|deb|noarch\.rpm)'
def findBits( path ):
def findBits( path, target_version=None ):
for file in listdir( path ):
filePath = join( path, file )
if not isfile( filePath ):
@ -28,6 +28,9 @@ def findBits( path ):
match = re.match( regex, file )
if match:
version = match.group(1)
if target_version is not None and version != target_version:
print 'Skipping %s...' % filePath
continue
build = match.group(2)
if build:
if 'NIGHTLY' in build or 'rc' in build:
@ -37,4 +40,7 @@ def findBits( path ):
uploadFile(filePath, dest='release/')
if __name__ == '__main__':
findBits( '/tmp' )
import sys
version = sys.argv[1] if len(sys.argv) >= 2 else None
findBits( '/tmp', version )