Skip to content

Commit

Permalink
Create containerinfo for fissile builds
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Aug 2, 2017
1 parent 0bc7924 commit e8b160f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
3 changes: 2 additions & 1 deletion Build/Docker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ sub parse {
sub showcontainerinfo {
my ($fn, $image, $taglist, $annotationfile) = @ARGV;
local $Build::Kiwi::urlmapper = sub { return $_[0] };
my $d = parse({}, $fn);
my $d = {};
$d = parse({}, $fn) if $fn;
die("$d->{'error'}\n") if $d->{'error'};
$image =~ s/.*\/// if defined $image;
my @tags = split(' ', $taglist);
Expand Down
19 changes: 9 additions & 10 deletions build-recipe-fissile
Original file line number Diff line number Diff line change
Expand Up @@ -98,29 +98,28 @@ recipe_build_fissile() {

echo "Building packages with fissile"
if ! chroot $BUILD_ROOT /bin/bash -c "cd $TOPDIR/SOURCES/release && . .envrc && fissile build packages"; then
cleanup_and_exit 1 "fissile build packages failed"
cleanup_and_exit 1 "fissile build packages failed"
fi

echo "Building images with fissile"
if ! chroot $BUILD_ROOT /bin/bash -c "cd $TOPDIR/SOURCES/release && . .envrc && fissile build images"; then
cleanup_and_exit 1 "fissile build images failed"
cleanup_and_exit 1 "fissile build images failed"
fi

# Save the resulting images to tarballs.
mkdir -p $BUILD_ROOT$TOPDIR/FISSILE
non_built_images=$(perl -MYAML::XS -e "print join('|', @{YAML::XS::LoadFile('$BUILD_ROOT$TOPDIR/SOURCES/fissile.yml')->{'DockerImageDeps'}})")

for image in $(chroot $BUILD_ROOT docker images --format "{{.Repository}}:{{.Tag}}" | grep -v $non_built_images); do
echo "Saving image $image"
filename=$(echo $image | sed 's/\//_/g')
if ! chroot $BUILD_ROOT docker save --output "$TOPDIR/FISSILE/$filename.tar" $image ; then
cleanup_and_exit 1 "Docker save command failed"
fi
echo "Saving image $image"
filename=$(echo $image | sed 's/\//_/g')
if ! chroot $BUILD_ROOT docker save --output "$TOPDIR/FISSILE/$filename.tar" "$image" ; then
cleanup_and_exit 1 "Docker save command failed"
fi
# Create containerinfo
perl -I$BUILD_DIR -MBuild::Docker -e Build::Docker::showcontainerinfo '' "$filename.tar" "$image" containers/annotation> "$BUILD_ROOT$TOPDIR/FISSILE/$filename.containerinfo"
done

# Create containerinfo
# perl -I$BUILD_DIR -MBuild::Docker -e Build::Docker::showcontainerinfo "$BUILD_ROOT/$TOPDIR/SOURCES/$RECIPEFILE" "$FILENAME.tar" "$IMAGE_NAME:$TAG" containers/annotation> "$BUILD_ROOT$TOPDIR/FISSILE/$FILENAME.containerinfo"

recipe_cleanup_fissile

BUILD_SUCCEEDED=true
Expand Down

0 comments on commit e8b160f

Please sign in to comment.