-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement sending webhook messages
- Loading branch information
Showing
21 changed files
with
1,851 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
## Base state ## | ||
|
||
FROM node:20-alpine3.20 AS base | ||
|
||
WORKDIR /usr/src/app | ||
|
||
ENV YARN_DISABLE_GIT_HOOKS=1 | ||
ENV CI=true | ||
|
||
RUN set -ex \ | ||
&& apk add --no-cache dumb-init ca-certificates | ||
|
||
COPY --chown=node:node package.json . | ||
COPY --chown=node:node yarn.lock . | ||
COPY --chown=node:node .yarnrc.yml . | ||
COPY --chown=node:node .yarn/ .yarn/ | ||
|
||
COPY --chown=node:node ./concourse/check /assets/check | ||
COPY --chown=node:node ./concourse/in /assets/in | ||
COPY --chown=node:node ./concourse/out /assets/out | ||
|
||
RUN yarn install --immutable | ||
|
||
ENTRYPOINT ["dumb-init", "--"] | ||
|
||
## Builder stage ## | ||
|
||
FROM base AS builder | ||
|
||
COPY --from=base --chown=node:node /usr/src/app/node_modules/ /usr/src/app/node_modules/ | ||
|
||
COPY --chown=node:node tsconfig.base.json . | ||
COPY --chown=node:node tsup.config.ts . | ||
COPY --chown=node:node src/ src/ | ||
|
||
RUN yarn build | ||
|
||
## Runtime stage ## | ||
|
||
FROM base AS runtime | ||
|
||
ENV NODE_ENV="production" | ||
ENV NODE_OPTIONS="--enable-source-maps" | ||
|
||
# Create a directory for Concourse scripts | ||
RUN mkdir -p /opt/resource | ||
|
||
# Copy Concourse scripts | ||
COPY --from=base /assets/check /opt/resource/ | ||
COPY --from=base /assets/in /opt/resource/ | ||
COPY --from=base /assets/out /opt/resource/ | ||
|
||
# Copy NodeJS scripts | ||
COPY --from=base --chown=node:node /usr/src/app/node_modules/ /usr/src/app/node_modules/ | ||
COPY --from=builder --chown=node:node /usr/src/app/dist/ /usr/src/app/dist/ | ||
|
||
USER node | ||
|
||
CMD echo "This container is not used directly."; exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/sh | ||
|
||
# The MIT License (MIT) | ||
# Copyright (c) 2017-2020 James Hunt | ||
# Copyright (c) 2021-present Benjamin Gandon, Gstack | ||
# Retrieved from: https://github.com/cloudfoundry-community/slack-notification-resource/blob/62db24f60f5b442b60d7160edec533662d26c23a/check | ||
|
||
set -e | ||
|
||
exec 3>&1 # make stdout available as fd 3 for the result | ||
exec 1>&2 # redirect all output to stderr for logging | ||
|
||
PAYLOAD=$(mktemp /tmp/resource-check.XXXXXX) | ||
|
||
cat > "$PAYLOAD" <&0 | ||
|
||
TS=$(jq '.version.timestamp // empty' < "$PAYLOAD") | ||
|
||
if [ -z "$TS" ]; then | ||
echo '[]' >&3 | ||
else | ||
jq -n "[ | ||
{ timestamp: $TS } | ||
]" >&3 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/sh | ||
|
||
# The MIT License (MIT) | ||
# Copyright (c) 2017-2020 James Hunt | ||
# Copyright (c) 2021-present Benjamin Gandon, Gstack | ||
# Retrieved from: https://github.com/cloudfoundry-community/slack-notification-resource/blob/62db24f60f5b442b60d7160edec533662d26c23a/in | ||
|
||
set -e | ||
|
||
exec 3>&1 # make stdout available as fd 3 for the result | ||
exec 1>&2 # redirect all output to stderr for logging | ||
|
||
PAYLOAD=$(mktemp /tmp/resource-in.XXXXXX) | ||
|
||
cat > "$PAYLOAD" <&0 | ||
|
||
TS=$(jq '.version.timestamp // empty' < "$PAYLOAD") | ||
[ -z "$TS" ] && TS='"none"' | ||
|
||
jq -n "{ | ||
version: { | ||
timestamp: $TS | ||
} | ||
}" >&3 |
Oops, something went wrong.