Skip to content

Commit

Permalink
Build docker image with current commit to prevent grabbing wrong tarball
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwalker committed Mar 16, 2020
1 parent c881451 commit 89c2fcc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ IMAGE_NAME ?= llvm
XDG_DATA_HOME ?= $(HOME)/.local/share
BUILD_DOCS ?= OFF
RELEASE ?= 10.0.0
SHA ?= `git rev-parse --short HEAD`
CWD = `pwd`

help:
@echo "$(IMAGE_NAME):$(RELEASE) (docs=$(BUILD_DOCS))"
@echo "$(IMAGE_NAME):$(RELEASE)-$(SHA) (docs=$(BUILD_DOCS))"
@echo ""
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'

clean: ## Clean up generated artifacts
@rm -rf build/host
Expand Down Expand Up @@ -82,10 +83,10 @@ dist-linux: ## Build an LLVM release distribution for x86_64-unknown-linux
@mkdir -p build/packages/ && \
cd lumen/ && \
docker build \
-t llvm-project:dist \
-t llvm-project:dist-$(RELEASE)-$(SHA) \
--target=dist \
--build-arg buildscript_args="-release=$(RELEASE) -clean-obj" . && \
utils/dist/extract-release.sh -release $(RELEASE)
utils/dist/extract-release.sh -release $(RELEASE) -sha $(SHA)

docker: ## Build a Docker image containing an LLVM distribution
cd lumen/ && \
Expand Down
13 changes: 12 additions & 1 deletion lumen/utils/dist/extract-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
PACKAGES_DIR="$(cd "$SCRIPT_DIR"/../../../build/packages && pwd -P)"

release=""
sha=""

while [ $# -gt 0 ]; do
case $1 in
Expand All @@ -14,6 +15,11 @@ while [ $# -gt 0 ]; do
release="$1"
shift
;;
-sha | --sha )
shift
sha="$1"
shift
;;
*)
echo "unknown option: $1"
exit 2
Expand All @@ -26,8 +32,13 @@ if [ -z "$release" ]; then
exit 2
fi

if [ -z "$sha" ]; then
echo "error: no sha hash specified"
exit 2
fi

cd "$PACKAGES_DIR"
if ! id="$(docker create llvm-project:dist sh)"; then
if ! id="$(docker create llvm-project:dist-${release}-${sha} sh)"; then
echo "Could not create dist container!"
exit 2
fi
Expand Down

0 comments on commit 89c2fcc

Please sign in to comment.