-
Notifications
You must be signed in to change notification settings - Fork 2
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
Introduce Dockerfile support to maestro workflow #68
Draft
fagiani
wants to merge
9
commits into
main
Choose a base branch
from
feature/add-dockerfile-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+28
−7
Draft
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d36b0e2
Introduce Dockerfile support to maestro workflow
fagiani 72552e2
Add path and build-mode env variables
MatheusdeMelo 1181d51
Fix variables names and workload paths
MatheusdeMelo bf00391
Change build checks
MatheusdeMelo 09a70cd
Improve workload path workflow
fagiani 4b4b31f
Add workload_path variable
MatheusdeMelo 2eaa3b3
Fix variable check
MatheusdeMelo 1f7492a
Merge branch 'feature/add-dockerfile-support' of github.com:veezor/ma…
MatheusdeMelo 33a2a8c
Fix variable description
MatheusdeMelo 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,12 +28,19 @@ fi | |
|
||
if [ $(DOCKER_CLI_EXPERIMENTAL=enabled docker manifest inspect $build_image_name 2> /dev/null ; echo $?) -eq 0 ]; then | ||
echo "----> Skipping build as image already exists" | ||
else | ||
exit 0 | ||
fi | ||
|
||
if [ -z "$WORKLOAD_PATH" ]; then | ||
$WORKLOAD_PATH=. | ||
Comment on lines
+34
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fagiani here |
||
fi | ||
|
||
if [ -f "${WORKLOAD_PATH}/project.toml" ]; then | ||
build_builder_name=`grep builder project.toml | cut -d= -f2 | tr -d '" '` | ||
build_builder_tag=`echo $build_builder_name | tr /: -` | ||
docker pull ${build_image_name%:*}:$build_builder_tag 2> /dev/null || true | ||
docker tag ${build_image_name%:*}:$build_builder_tag $build_builder_name 2> /dev/null || true | ||
build_assume_role=$(curl -s http://169.254.170.2$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI) | ||
build_assume_role=$(curl -s http://169.254.170.2$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI) | ||
echo "AWS_ACCESS_KEY_ID=$(jq -r '.AccessKeyId' <<<$build_assume_role)" >> .env | ||
echo "AWS_SECRET_ACCESS_KEY=$(jq -r '.SecretAccessKey' <<<$build_assume_role)" >> .env | ||
echo "AWS_SESSION_TOKEN=$(jq -r '.Token' <<<$build_assume_role)" >> .env | ||
|
@@ -42,9 +49,22 @@ else | |
--env-file .env \ | ||
--publish \ | ||
--trust-builder \ | ||
$( [[ -z $MAESTRO_NO_CACHE || $MAESTRO_NO_CACHE = "false" ]] && echo "--pull-policy if-not-present --cache-image ${build_image_name%:*}:cache") \ | ||
$( [ $MAESTRO_NO_CACHE = "true" ] && echo "--pull-policy always --clear-cache --env USE_YARN_CACHE=false --env NODE_MODULES_CACHE=false") \ | ||
$( [ $MAESTRO_DEBUG = "true" ] && echo "--env NPM_CONFIG_LOGLEVEL=debug --env NODE_VERBOSE=true --verbose") | ||
docker tag $build_builder_name ${build_image_name%:*}:$build_builder_tag | ||
docker push ${build_image_name%:*}:$build_builder_tag 2> /dev/null | ||
--path ${WORKLOAD_PATH:-.} | ||
$( [[ -z $MAESTRO_NO_CACHE || $MAESTRO_NO_CACHE = "false" ]] && echo "--pull-policy if-not-present --cache-image ${build_image_name%:*}:cache") \ | ||
$( [ $MAESTRO_NO_CACHE = "true" ] && echo "--pull-policy always --clear-cache --env USE_YARN_CACHE=false --env NODE_MODULES_CACHE=false") \ | ||
$( [ $MAESTRO_DEBUG = "true" ] && echo "--env NPM_CONFIG_LOGLEVEL=debug --env NODE_VERBOSE=true --verbose") | ||
build_built=true | ||
fi | ||
|
||
if [ -z "$build_built" && -f "${WORKLOAD_PATH}/Dockerfile" ]; then | ||
docker build -t ${build_image_name%:*}:latest -t $build_image_name ${WORKLOAD_PATH:-.} | ||
build_built=true | ||
fi | ||
|
||
if [ -z "$build_built" ]; then | ||
echo "Error: Expected either a Dockerfile or a project.toml within the project's root path" | ||
exit 1 | ||
fi | ||
|
||
docker tag $build_builder_name ${build_image_name%:*}:$build_builder_tag | ||
docker push ${build_image_name%:*}:$build_builder_tag 2> /dev/null |
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.
"Set the workload path to run build commands on
correct directory" should do itThere 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.
Changed to new description.