kubernetes/git-sync

v4 slack webhook

cfsnate opened this issue · 6 comments

hoping to send webhook to slack on sync, 400 error using built in webhook function per #508

no apt in v4 so can't install curl in a custom image to do a custom script

am I missing something?

I'm not AGAINST trying to find a way to make this work, if someone wants to contribute tests and an implementation.

I got curl working in quite an annoying and fragile way. but it works. files taken from stock debian bullseye

FROM registry.k8s.io/git-sync/git-sync:v4.2.1
USER root

ADD curl/binary/curl /usr/bin/curl

RUN chmod +x /usr/bin/curl

ADD curl/lib/libcurl.so.4.7.0 /usr/lib/aarch64-linux-gnu/libcurl.so.4

ADD curl/lib/libssl.so.1.1 /usr/lib/aarch64-linux-gnu/libssl.so.1.1

ADD curl/lib/libcrypto.so.1.1 /usr/lib/aarch64-linux-gnu/libcrypto.so.1.1

ADD curl/lib/libldap_r-2.4.so.2.11.5 /usr/lib/aarch64-linux-gnu/libldap_r-2.4.so.2

ADD curl/lib/liblber-2.4.so.2.11.5 /usr/lib/aarch64-linux-gnu/liblber-2.4.so.2

ADD slack.sh /opt/slack.sh

RUN chmod +x /opt/slack.sh

USER git-sync

will play with this a bit more tomorrow

Alternatively:

  • we could offer a non-minimized Dockerfile and you could just build your own from that (meaning a much larger image)
  • we could offer a build with curl in it (57.8MB without, 58.9 with - minor)

If we want to include curl, I'd like an e2e test showing it works for some simple things (and doesn't drag in other deps, like git does :) Here's a starting point:

diff --git a/Dockerfile.in b/Dockerfile.in
index dadb69e..18fb5a3 100644
--- a/Dockerfile.in
+++ b/Dockerfile.in
@@ -60,6 +60,7 @@ RUN /stage_binaries.sh -o {ARG_STAGING} \
        -p git \
        -p openssh-client \
        -p ca-certificates \
+       -p curl \
        -p socat \
        -b /bin/grep \
        -b /bin/sed \

Have exactly the same problems with sending notifications with webhook to slack. The way I managed to install curl into the image is with this

FROM curlimages/curl:8.6.0 AS curl_build

FROM registry.k8s.io/git-sync/git-sync:v4.1.0
USER root
COPY --from=curl_build /usr/bin/curl /usr/bin/curl
COPY --from=curl_build /usr/lib /usr/lib
COPY --from=curl_build /lib /lib

USER git-sync

curl command works, but have not tested it much yet. If I encounter problems, I can let you know

If someone can help craft an e2e that mimicks a slack integration, I could merge curl. I just want to make sure I don't add curl only to find it is missing some other helper package(s).

I merged curl - I'd still love an e2e for this