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

Add capability to build docker all-in-one #3813

Merged
merged 4 commits into from
Jul 13, 2022

Conversation

albertteoh
Copy link
Contributor

@albertteoh albertteoh commented Jul 13, 2022

Which problem is this PR solving?

  • As a developer, I want to quickly test changes to SPM locally, which depends on the jaegertracing/all-in-one:latest image.
  • Building this image is currently not supported in the current Makefile.

Short description of the changes

  • Add all-in-one component to the list of components to build docker images for.
  • Note: I don't believe this impacts existing CI builds, which utilise the scripts/build-all-in-one-image.sh for all-in-one, and scripts/build-upload-docker-images.sh for other components. These scripts, in turn, execute their own docker commands (not sure why, instead of using Makefile targets).

Testing

--build-arg base_image=$(BASE_IMAGE) \
--build-arg debug_image=$(DEBUG_IMAGE) \
--build-arg TARGETARCH=$(GOARCH) \
--load \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Necessary for registering the images into docker so they are visible via docker images.

Makefile Outdated
Comment on lines 309 to 313
# Save the current Internal Field Separator (IFS) for later recovery, then set it to a comma-separator.
# The reason for using a comma-separator is to support the empty prefix required for all-in-one.
OLDIFS=$IFS; \
IFS=","; \
for pair in "jaeger,agent" "jaeger,collector" "jaeger,query" "jaeger,ingester" ",all-in-one" ; do \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Open to other suggestions on a better approach.

Copy link
Member

Choose a reason for hiding this comment

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

perhaps it's simpler to use strings like jaeger-agent and then just regex-out the jaeger- prefix when referring to the working dir cmd/$$component

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion, done in: 353cc39

@codecov
Copy link

codecov bot commented Jul 13, 2022

Codecov Report

Merging #3813 (c649fa6) into main (2781f27) will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #3813      +/-   ##
==========================================
+ Coverage   97.58%   97.59%   +0.01%     
==========================================
  Files         289      289              
  Lines       16800    16800              
==========================================
+ Hits        16394    16396       +2     
+ Misses        321      319       -2     
  Partials       85       85              
Impacted Files Coverage Δ
pkg/config/tlscfg/cert_watcher.go 94.68% <0.00%> (+2.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2781f27...c649fa6. Read the comment docs.

Makefile Outdated
component_suffix="$${BASH_REMATCH[2]}"; \
fi; \
docker buildx build --target $(TARGET) \
--tag $(DOCKER_NAMESPACE)/$$component_prefix$$component_suffix$(SUFFIX):${DOCKER_TAG} \
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
--tag $(DOCKER_NAMESPACE)/$$component_prefix$$component_suffix$(SUFFIX):${DOCKER_TAG} \
--tag $(DOCKER_NAMESPACE)/$$component$(SUFFIX):${DOCKER_TAG} \

Makefile Outdated
done
--load \
cmd/$$component_suffix ; \
echo "Finished building $$component_suffix ==============" ; \
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
echo "Finished building $$component_suffix ==============" ; \
echo "Finished building $$component ==============" ; \

Makefile Outdated
--tag $(DOCKER_NAMESPACE)/jaeger-$$component$(SUFFIX):${DOCKER_TAG} \
for component in "jaeger-agent" "jaeger-collector" "jaeger-query" "jaeger-ingester" "all-in-one" ; do \
regex="(jaeger-)(.*)"; \
component_prefix=""; \
Copy link
Member

Choose a reason for hiding this comment

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

this var is not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, that's simpler: ae6b0e1

Signed-off-by: Albert Teoh <[email protected]>
Makefile Outdated
echo "Finished building $$component ==============" ; \
done
done; \
Copy link
Member

Choose a reason for hiding this comment

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

why does this have \ continuation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was a remnant of the previous implementation where the IFS needed to be reset. Removed in c649fa6

@@ -1,4 +1,5 @@
JAEGER_IMPORT_PATH=github.com/jaegertracing/jaeger
SHELL := /bin/bash
Copy link
Member

Choose a reason for hiding this comment

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

is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, because regex matches via the =~ operator requires [[ ... ]], which is only supported in bash, and not sh. Without it, the following error will result: /bin/sh: 4: [[: not found.

Signed-off-by: Albert Teoh <[email protected]>
@albertteoh albertteoh enabled auto-merge (squash) July 13, 2022 22:51
@albertteoh
Copy link
Contributor Author

Thanks for the review!

@albertteoh albertteoh merged commit 3c73db9 into jaegertracing:main Jul 13, 2022
albertteoh added a commit to albertteoh/jaeger that referenced this pull request Aug 8, 2022
Add `all-in-one` component to the list of components to build docker images for.

Signed-off-by: Albert Teoh <[email protected]>
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.

2 participants