Skip to content

Conversation

@MonkeyCanCode
Copy link
Contributor

Description

As #114 added support for building the project with eclipselink via optional flag, this PR is add the same support via optional command line argument to run.sh when using mini-deployment locally.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation update
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Default:

yong@DESKTOP:~/polaris(optional_eclipselink)$ bash run.sh
Building Kind Registry...
...
Creating cluster "kind" ...
...
Building polaris image with ECLIPSELINK=false...
...
Applying Kubernetes manifests...
namespace/polaris created
deployment.apps/polaris-deployment created
service/polaris-service created

With optional command line argument:

yong@DESKTOP:~/polaris(optional_eclipselink)$ bash run.sh -e true
Building Kind Registry...
...
Creating cluster "kind" ...
...
Building polaris image with ECLIPSELINK=true...
...
Applying Kubernetes manifests...
namespace/polaris created
deployment.apps/polaris-deployment created
service/polaris-service created

Helper:

xxx@DESKTOP:~/polaris(optional_eclipselink)$ bash run.sh -h
Usage: run.sh [-e true|false] [-h]
  -e    Set the ECLIPSELINK flag (default: false)
  -h    Display this help message

Checklist:

Please delete options that are not relevant.

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • If adding new functionality, I have discussed my implementation with the community using the linked GitHub issue

Comment on lines 28 to 33
usage() {
echo "Usage: $0 [-e true|false] [-h]"
echo " -e Set the ECLIPSELINK flag (default: false)"
echo " -h Display this help message"
exit 1
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is one I'm a little unsure about. Things like metastore manager and callcontext resolver are designed to be pluggable and discoverable by DropWizard.

I'm worried about the precedent this sets and whether we would want to add all these as myriad options here. The script might get quite complicated in order to cover every combination.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this concern, should we move those into a config file instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe just a safety valve type flag that allows you to pass an arbitrary build arg down to docker build?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

K, let me think about it tonight then submit another PR to address those tonight.

Copy link
Contributor Author

@MonkeyCanCode MonkeyCanCode Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eric-maynard updated with arbitrary build arg support. Please take another look when you get a chance.

Helper message:

Usage: run.sh [-b build-arg1=value1,build-arg2=value2,...] [-h]
  -b    Pass a set of arbitrary build arguments to docker build, separated by commas
  -h    Display this help message

Default run:

bash run.sh

Arbitrary build arg run:

bash run.sh -b ECLIPSELINK=true

# sample output:
# Building polaris image with build arguments: --build-arg ECLIPSELINK=true

Arbitrary build args run:

bash run.sh -b ECLIPSELINK=true,RANDOM=true

# sample output:
# Building polaris image with build arguments: --build-arg ECLIPSELINK=true --build-arg RANDOM=true

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to add a change to the docs specifying how to get this build working. But I don't want to hold the PR up any longer, so maybe post a separate docs PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can update those later tonight if not yet merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually lets have it in a diff PR. The current Dockerfile doesn't support eclipseLinkDeps flag. I will add this in and update the doc for both optional options. What do u think?

@flyrain

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend to add an example like ./run.sh -b ECLIPSELINK=true, as it is probably most commonly used.

run.sh Outdated
# build and deploy the server image
# Check if BUILD_ARGS is not empty and print the build arguments
if [[ -n "$BUILD_ARGS" ]]; then
echo "Building polaris image with build arguments:$BUILD_ARGS"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: space missing after :

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took care.

run.sh Outdated
echo "Applying kubernetes manifests..."
kubectl delete -f k8/deployment.yaml --ignore-not-found
kubectl apply -f k8/deployment.yaml
kubectl apply -f k8/deployment.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing whitespace at end of file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took care.

Copy link
Contributor

@eric-maynard eric-maynard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some comments on style

@MonkeyCanCode
Copy link
Contributor Author

Anything else needed on this PR?

@RussellSpitzer
Copy link
Member

The license check is currently failing, I don't think this should be happening, can you try rebasing and try again?

@MonkeyCanCode
Copy link
Contributor Author

The license check is currently failing, I don't think this should be happening, can you try rebasing and try again?

yes. Just noticed it. Was fine earlier. Had being a while since I submitted this PR. The PR had being rebased.

@adutra
Copy link
Contributor

adutra commented Sep 11, 2024

The license check is currently failing, I don't think this should be happening, can you try rebasing and try again?

yes. Just noticed it. Was fine earlier. Had being a while since I submitted this PR. The PR had being rebased.

Probably fixed by #266 or #271.

Copy link
Contributor

@flyrain flyrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@flyrain flyrain merged commit a0b24ce into apache:main Sep 21, 2024
@flyrain
Copy link
Contributor

flyrain commented Sep 21, 2024

Thanks @MonkeyCanCode for the PR. Thanks @RussellSpitzer @eric-maynard @collado-mike for the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants