WIP: build subcommand

This commit is contained in:
Vincent Batts 2019-11-05 14:02:15 +00:00
parent 5b73fbdeeb
commit 6384de2bc3
3 changed files with 29 additions and 12 deletions

View file

@ -3,7 +3,7 @@
# This script builds a Source Image via "drivers" to collect source # This script builds a Source Image via "drivers" to collect source
export ABV_NAME="SrcImg" export ABV_NAME="SrcImg"
# TODO maybe a flag for this? # no flag for this, as this convention needs to change
export source_image_suffix="-source" export source_image_suffix="-source"
# output version string # output version string
@ -33,6 +33,7 @@ _usage() {
echo -e "" echo -e ""
echo -e " Subcommands:" echo -e " Subcommands:"
echo -e " unpack\tUnpack an OCI layout to a rootfs directory" echo -e " unpack\tUnpack an OCI layout to a rootfs directory"
echo -e " build\tBuilds a source image"
echo -e "" echo -e ""
} }
@ -64,6 +65,12 @@ _subcommand() {
ret=$? ret=$?
exit "${ret}" exit "${ret}"
;; ;;
build)
# XXX this is a stub and does not exist yet
build_src_img "${@}"
ret=$?
exit "${ret}"
;;
esac esac
} }

View file

@ -1,12 +1,19 @@
# BuildSourceImage
[![Build Status](https://travis-ci.org/containers/BuildSourceImage.svg?branch=master)](https://travis-ci.org/containers/BuildSourceImage) [![Build Status](https://travis-ci.org/containers/BuildSourceImage.svg?branch=master)](https://travis-ci.org/containers/BuildSourceImage)
[![Container Image Repository on Quay](https://quay.io/repository/ctrs/bsi/status "Container Image Repository on Quay")](https://quay.io/repository/ctrs/bsi) [![Container Image Repository on Quay](https://quay.io/repository/ctrs/bsi/status "Container Image Repository on Quay")](https://quay.io/repository/ctrs/bsi)
# BuildSourceImage
Tool to build a source image. Tool to build a source image.
The goal is to make retrieving the source code used to make a container image The goal is to make retrieving the source code used to make a container image
easier for users to obtain, using the standard OCI protocols and image formats. easier for users to obtain, using the standard OCI protocols and image formats.
## Use Cases
* Build a source image from an existing container image by introspection
* Build a source code image from a collection of known `.src.rpm`'s
* Include additional build context into the source image
* Include extra sources used during the building of the resulting "works" of the cumulative sources
## Usage ## Usage
```bash ```bash
@ -27,24 +34,27 @@ Usage: BuildSourceImage.sh [-D] [-b <path>] [-c <path>] [-e <path>] [-r <path>]
-h this usage information -h this usage information
-v version -v version
Subcommands:
unpack Unpack an OCI layout to a rootfs directory
build Builds a source image
``` ```
Nicely usable inside a container: Nicely usable as container `quay.io/ctrs/bsi`:
* In this example we use only a prepared directory of `.src.rpm`'s:
```bash ```bash
$> mkdir ./output/ $> mkdir ./output/
$> podman run -it -v $(pwd)/output/:/output/ -v $(pwd)/SRCRPMS/:/data/ -u $(id -u) quay.io/ctrs/bsi -s /data/ -o /output/ $> podman run -it -v $(pwd)/output/:/output/ -v $(pwd)/SRCRPMS/:/data/ -u $(id -u) quay.io/ctrs/bsi -s /data/ -o /output/
``` ```
## Examples ## Demos
* Building from a fetched reference [![asciicast](https://asciinema.org/a/266340.svg)](https://asciinema.org/a/266340) * Building from a fetched reference [![asciicast](https://asciinema.org/a/266340.svg)](https://asciinema.org/a/266340)
* Building from a directory of src.rpms: [![asciicast](https://asciinema.org/a/266341.svg)](https://asciinema.org/a/266341) * Building from a directory of src.rpms: [![asciicast](https://asciinema.org/a/266341.svg)](https://asciinema.org/a/266341)
* Building from a directory of src.rpms and pushing it to a simple registry: [![asciicast](https://asciinema.org/a/266343.svg)](https://asciinema.org/a/266343) * Building from a directory of src.rpms and pushing it to a simple registry: [![asciicast](https://asciinema.org/a/266343.svg)](https://asciinema.org/a/266343)
## Use Cases ## License
* Build a source image from an existing container image by introspection See the [LICENSE](./LICENSE) file.
* Build a source code image from a collection of known `.src.rpm`'s
* Include additional build context into the source image
* Include extra sources use

View file

@ -25,9 +25,9 @@ While it's possible to kick the tests by calling `bats ./test/`, many of the tes
If you are making local changes and have not rebuilt the container, then they will be missed. If you are making local changes and have not rebuilt the container, then they will be missed.
Best to kick off the build like: Best to kick off the build like:
```bash ```bash
make test-integration make test-integration
``` ```
This will rebuild the container if needed before running the tests.
## This will rebuild the container if needed before running the tests.