This adds a `/opt/appsmith/info.json` file to Docker images, with the
following sample content:
```json
{
"commitSha": "0521ba2c0d7a62cef3d4def66fc15b59cc34ceef",
"commitUrl": "0521ba2c0d",
"branch": "release",
"date": "2023-08-02T12:52:53+00:00",
"isCI": false
}
```
We're enabling this only for images built for DPs currently, and will
then extend to other workflows as well.
Notice that we copy `info.*json` instead of `info.json`. The reason is
so that the Docker build doesn't fail, even if the `info.json` file
doesn't exist. This lets us publish this to each workflow in turn,
slowly and carefully.
[Relevant Slack
conversation](https://theappsmith.slack.com/archives/C02MUD8DNUR/p1686197957141419).
17 lines
476 B
Bash
Executable File
17 lines
476 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -o errexit
|
|
set -o nounset
|
|
|
|
commit_sha="$(git rev-parse HEAD)"
|
|
|
|
base_url="$(git remote get-url origin | sed 's,^git@github\.com:,https://github.com/,; s/\.git$//')"
|
|
|
|
jq -n \
|
|
--arg commitSha "$commit_sha" \
|
|
--arg commitUrl "$base_url/commit/$commit_sha" \
|
|
--arg branch "$(git rev-parse --abbrev-ref HEAD)" \
|
|
--arg date "$(date -u -Iseconds)" \
|
|
--argjson isCI "${CI:-false}" \
|
|
'$ARGS.named' | tee "$(git rev-parse --show-toplevel)/info.json"
|