Skip to content
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

Refactor build env logic to switch between testing and production #604

Merged

Conversation

peterzhuamazon
Copy link
Member

Description

Add Docker Run UnitTest on x64 Runner

Issues Resolved

opensearch-project/opensearch-build#4723

Testing

  • New functionality includes testing

[Describe how this change was tested]


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@peterzhuamazon peterzhuamazon added enhancement New feature or request docker labels Jul 31, 2024
@peterzhuamazon peterzhuamazon self-assigned this Jul 31, 2024
@peterzhuamazon peterzhuamazon changed the title Add Docker Run UnitTest on x64 Runner Refactor build env logic to switch between testing and production Aug 1, 2024
@peterzhuamazon peterzhuamazon marked this pull request as ready for review August 1, 2024 20:31
Signed-off-by: Peter Zhu <[email protected]>
Comment on lines +38 to +41
PLATFORM=${{ matrix.platform }}
PLATFORM=`echo $PLATFORM | tr '/' '-'`
docker buildx build --platform ${{ matrix.platform }} --build-arg BUILD_ENV=testing --build-arg BUILD_DATE=`date -u +%Y-%m-%dT%H:%M:%SZ` -f "docker/Dockerfile" -t "osb/osb-$PLATFORM" -o type=docker .
docker images | grep "osb/osb-$PLATFORM"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably can be streamlined, but fine for testing.
What does the docker images line do? Is it simply to print the output of the grep?

Copy link
Member Author

@peterzhuamazon peterzhuamazon Aug 1, 2024

Choose a reason for hiding this comment

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

Yes @gkamat

It is to setup the next step of running docker container based on the image just created.

In multi-arch build most of the time image has to be pushed upon completion to registry.
I force the image to be saved locally so we can use the image to run containers.

Once the container is up we can use it to run IT.
This is a pre-req before that happens.

And I agree the code can be streamlined a bit, which I will improve in the next iteration.

Thanks.

@gkamat gkamat merged commit fc9c147 into opensearch-project:main Aug 1, 2024
11 checks passed
@peterzhuamazon peterzhuamazon deleted the add-docker-unittest-x64 branch August 1, 2024 21:39
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need this file for integration tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker enhancement New feature or request
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants