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

DBZ-4128 Add Debezium Kafka Connect REST Extension to Debezium Kafka Connect NIGHTLY container image #259

Conversation

rk3rn3r
Copy link
Member

@rk3rn3r rk3rn3r commented Oct 7, 2021

RUN for PACKAGE in {scripting}; do \
SNAPSHOT_VERSION=$(curl -fSL $MAVEN_OSS_SNAPSHOT/io/debezium/debezium-$PACKAGE/$DEBEZIUM_VERSION/maven-metadata.xml | awk -F'<[^>]+>' '/<extension>tar.gz<\/extension>/ {getline; print $2}'); \
curl -fSL -o /tmp/package.tar.gz \
RUN for PACKAGE in {scripting,}; do \
Copy link
Member

Choose a reason for hiding this comment

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

Any particular reason for the loop given it's a single element? Same below?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, it was like that before. I guess good old premature optimization. that's the correct Bash syntax for a list and I only added the missing comma, else Bash would handle it as the string {scripting} and not as list.

curl -fSL -o /tmp/plugin.tar.gz \
$MAVEN_OSS_SNAPSHOT/io/debezium/debezium-connector-$CONNECTOR/$DEBEZIUM_VERSION/debezium-connector-$CONNECTOR-$SNAPSHOT_VERSION-plugin.tar.gz &&\
SNAPSHOT_VERSION=$(curl --silent -fSL $MAVEN_OSS_SNAPSHOT/io/debezium/debezium-connector-$CONNECTOR/$DEBEZIUM_VERSION/maven-metadata.xml | awk -F'<[^>]+>' '/<extension>tar.gz<\/extension>/ {getline; print $2; exit}'); \
echo "Downloading and installing debezium-connector-$CONNECTOR-$SNAPSHOT_VERSION-plugin.tar.gz ..." ; \
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the semicolons are used as command delimiter here and not && as below?

Copy link
Member Author

@rk3rn3r rk3rn3r Oct 8, 2021

Choose a reason for hiding this comment

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

Because && is a logical connection. But the next command can be executed when the echo doesn't work. And in general echo should always return true if a tty is attached. The other && are used to continue with following commands only when the previous succeeded.

done
done

RUN for PACKAGE in {connect-rest-extension,}; do \
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to merge the two extension loops? IIUC they only differ in the filename suffix.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, they also differ in what they evaluate from the maven-metadata.xml.

@@ -11,17 +11,32 @@ ENV DEBEZIUM_VERSION=$DEBEZIUM_VERSION \
# Download the snapshot version of the connectors and then install them into the `$KAFKA_CONNECT_PLUGINS_DIR/debezium` directory...
#
RUN for CONNECTOR in {mysql,mongodb,postgres,sqlserver,oracle,db2,vitess}; do \
Copy link
Contributor

Choose a reason for hiding this comment

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

As you are touching the file, would it be possible to intorduce two env vars on top of the file, one enumerating plugins and the other extensions and refer to them in the loop?

Copy link
Member Author

@rk3rn3r rk3rn3r Oct 8, 2021

Choose a reason for hiding this comment

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

I could do it as an ARG so that we can build a different connector list based on a build arg. But do we really need this anytime soon?

@rk3rn3r
Copy link
Member Author

rk3rn3r commented Oct 8, 2021

I expected this to be already merged as I need the container image to finish the DBZ UI tests and next week Thursday is my last day before my PTO.
I was just adding some logging in a single file and fixed some really minor code mistakes (see my comment on Bash list vs string above and made curl really silent) beside the added lines for the actual task. If it would be 2 or more files and more than 4 changed lines (additionally to the lines I added for the task) I would have done different commits for sure!

@jpechane jpechane merged commit f2fdf67 into debezium:master Oct 12, 2021
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.

3 participants