diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index 087c63ef1..9ac812edf 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -7,5 +7,5 @@ ENV BUILDKIT_FILENAME=buildkit-v${BUILDKIT_VERSION}.linux-amd64.tar.gz # Install custom tools, runtime, etc. RUN sudo su -c "cd /usr; curl -L https://github.com/moby/buildkit/releases/download/v${BUILDKIT_VERSION}/${BUILDKIT_FILENAME} | tar xvz" && \ -sudo su -c "cd /usr/bin; curl -o yq -L https://github.com/mikefarah/yq/releases/download/v4.22.1/yq_linux_amd64 && chmod +x yq" + sudo su -c "cd /usr/bin; curl -o yq -L https://github.com/mikefarah/yq/releases/download/v4.22.1/yq_linux_amd64 && chmod +x yq" diff --git a/.gitpod.yml b/.gitpod.yml index 0f15a9696..e18d2e77e 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -20,8 +20,9 @@ tasks: command: | gp await-port 5000 REPO=localhost:5000/dazzle - echo "To build specific chunks and combinations 'time ./dazzle-up.sh -c chunk1 -c chunk2 -n combo'" - echo "To build all the chunks and combinations 'time ./dazzle-up.sh'" + echo "To build specific chunks and combine them 'time ./build-chunk.sh -c chunk1 -c chunk2 -n combo'" + echo "To build all the chunks and combinations 'time ./build-all.sh'" + echo "To build a specific combination 'time ./build-combo.sh combo'" echo "To list image chunks 'dazzle project image-name $REPO'" echo "To list hashes for image chunks 'dazzle project hash $REPO'" echo "To print the combined image maniest 'dazzle project manifest $REPO'" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2877e51cb..1f0e0cc24 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,7 +31,7 @@ Here is a list of dependencies and tools: ## Locally -We ship a shell script [dazzle-up.sh](dazzle-up.sh) that can be used to build the images locally. See the following sub sections for usage. +We ship a shell script [build-all.sh](build-all.sh) that can be used to build the images locally. See the following sub sections for usage. This script will first build the chunks and run tests followed by creation of container images. It uses `dazzle` to perform these tasks. @@ -45,20 +45,30 @@ where `combo` is the name of the combination defined in [dazzle.yaml](dazzle.yam ### Build Specific Chunks -Often, you would want to test only the chunks that you modify. You can do that by using the `-c` flag. +Often, you would want to test only the chunks that you modify. You can do that with build-chunk.sh using the `-c` flag and specifying the name for your combination with `-n`. ```console -./dazzle-up.sh -c lang-c -c dep-cacert-update -n mychangecombo +./build-chunk.sh -c lang-c -c dep-cacert-update -n mychangecombo ``` Above command will build only chunks `lang-c` and `dep-cacert-update` and combine the created chunks (all variants, if any exists) as a combination with name `mychangecombo`. +### Build Specific Combination + +Sometimes you only want to build one specific combination e.g. the `postgresql` or the `go` image. You can do that with + +```console +./build-combo.sh e.g. ./build-combo.sh postgresql +``` + +This will build all chunks that are referenced by the `go` combination and then combine them to create the `go` image. + ### Build All Chunks Execute the following command to build using the default config `dazzle.yaml` shipped in this repo: ```bash -./dazzle-up.sh +./build-all.sh ``` > **NOTE:** Building images locally consumes a lot of resources and is often slow. diff --git a/build-all.sh b/build-all.sh new file mode 100755 index 000000000..920e6d2e1 --- /dev/null +++ b/build-all.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -euo pipefail + +REPO=localhost:5000/dazzle +# First, build chunks without hashes +dazzle build $REPO -v --chunked-without-hash +# Second, build again, but with hashes +dazzle build $REPO -v +# Third, create combinations of chunks +dazzle combine $REPO --all -v diff --git a/dazzle-up.sh b/build-chunk.sh similarity index 68% rename from dazzle-up.sh rename to build-chunk.sh index dd7a2c46b..4920a95a7 100755 --- a/dazzle-up.sh +++ b/build-chunk.sh @@ -2,19 +2,16 @@ set -euo pipefail trap ctrl_c INT -readonly YELLOW=$(tput setaf 3) -readonly NC=$(tput sgr0) +# shellcheck source=/dev/null +source build-common.sh -readonly BACKUP_FILE=".dazzle.yaml.orig" readonly TEMP_FILE=".dazzle.yaml.temp" -readonly ORIGINAL_FILE="dazzle.yaml" -readonly AVAILABLE_CHUNKS=$(ls chunks/) readonly REPO="localhost:5000/dazzle" function usage() { cat <