PromucFlow_constructor/scripts/generate_info_json.sh
Shrikant Sharat Kandula e8c3cc19a2
chore: Add info.json to Docker images (#25948)
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).
2023-08-02 18:36:59 +05:30

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"