-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new build scripts #769
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#! /bin/bash | ||
set -eo pipefail | ||
trap ctrl_c EXIT | ||
|
||
# shellcheck source=/dev/null | ||
source build-common.sh | ||
|
||
function build_combination() { | ||
combination=$1 | ||
|
||
local exists | ||
exists="$(yq e '.combiner.combinations[] | select (.name=="'"$combination"'")' dazzle.yaml)" | ||
if [[ -z "$exists" ]]; then | ||
echo "combination is not defined" | ||
exit 1 | ||
fi | ||
|
||
refs=$(get_refs "$combination") | ||
required_chunks=$(get_chunks "$refs" | sort | uniq) | ||
available_chunks=$(get_available_chunks) | ||
|
||
for ac in $available_chunks; do | ||
if [[ ! "${required_chunks[*]}" =~ ${ac} ]]; then | ||
dazzle project ignore "$ac" | ||
fi | ||
done | ||
} | ||
|
||
function get_refs() { | ||
local ref=$1 | ||
echo "$ref" | ||
|
||
refs="$(yq e '.combiner.combinations[] | select (.name=="'"$ref"'") | .ref[]' dazzle.yaml)" | ||
if [[ -z "$refs" ]]; then | ||
return | ||
fi | ||
|
||
for ref in $refs; do | ||
get_refs "$ref" | ||
done | ||
} | ||
|
||
function get_chunks() { | ||
# shellcheck disable=SC2068 | ||
for ref in $@; do | ||
chunks=$(yq e '.combiner.combinations[] | select (.name=="'"$ref"'") | .chunks[]' dazzle.yaml) | ||
echo "$chunks" | ||
done | ||
} | ||
|
||
REPO=localhost:5000/dazzle | ||
|
||
save_original | ||
|
||
if [ -n "${1}" ]; then | ||
build_combination "$1" | ||
fi | ||
|
||
# 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 | ||
if [[ -n "${1}" ]]; then | ||
dazzle combine $REPO --combination "$1" -v | ||
else | ||
dazzle combine $REPO --all -v | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#! /bin/bash | ||
|
||
YELLOW=$(tput setaf 3) | ||
readonly YELLOW | ||
NC=$(tput sgr0) | ||
readonly NC | ||
|
||
readonly BACKUP_FILE=".dazzle.yaml.orig" | ||
readonly ORIGINAL_FILE="dazzle.yaml" | ||
|
||
function save_original() { | ||
if [ ! -f ${BACKUP_FILE} ]; then | ||
echo "${YELLOW}Creating a backup of ${ORIGINAL_FILE} as it does not exist yet...${NC}" && cp ${ORIGINAL_FILE} ${BACKUP_FILE} | ||
fi | ||
} | ||
|
||
function restore_original() { | ||
echo "${YELLOW}Restoring backup file ${BACKUP_FILE} to original file ${ORIGINAL_FILE}${NC}" | ||
cp ${BACKUP_FILE} ${ORIGINAL_FILE} | ||
} | ||
|
||
function ctrl_c() { | ||
echo "${YELLOW}** Trapped CTRL-C${NC}" | ||
restore_original | ||
} | ||
|
||
function get_available_chunks() { | ||
local chunk_defs | ||
chunk_defs=$(ls chunks) | ||
for chunk in $chunk_defs; do | ||
local chunkYaml="chunks/${chunk}/chunk.yaml" | ||
if [[ -f "$chunkYaml" ]]; then | ||
variants=$(yq e '.variants[].name' "$chunkYaml") | ||
for variant in $variants; do | ||
echo "$chunk:$variant" | ||
done | ||
else | ||
echo "$chunk" | ||
fi | ||
|
||
done | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed from
build_and_combine