GoogleCloudPlatform / GoogleCloudPlatform/datashare-toolkit

Add github build attributes as environment variables for the application

Open
#243 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
94
Forks
27
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
Add github build attributes as environment variables for the application. This will assist in operational debugging and enable dynamic link generation.

**Describe the solution you'd like**
Add github build attributes as environment variables for the application Ideally, I would like multiple variables like this example for the Docker CLI executable [here](https://blog.alexellis.io/inject-build-time-vars-golang/), but we can start with these:

```
VERSION=$(git describe --all --exact-match `git rev-parse HEAD` | grep tags | sed 's/tags\///')`
```
```
GIT_COMMIT=$(git rev-list -1 HEAD)
```

These variables should be passed to the Docker image build from the CLI or through the automated CI/CD process. For CI/CD, the Github tag can be extracted via [Github actions](https://github.community/t/how-to-get-just-the-tag-name/16241) , CircleCI [here](https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions), or directly in the Docker image as described above.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.