{"id":28395122,"url":"https://github.com/databiosphere/terra-common-lib","last_synced_at":"2025-06-27T01:31:33.018Z","repository":{"id":38441342,"uuid":"320407698","full_name":"DataBiosphere/terra-common-lib","owner":"DataBiosphere","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-06T13:27:52.000Z","size":538,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":22,"default_branch":"develop","last_synced_at":"2025-06-01T06:52:18.737Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DataBiosphere.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-12-10T22:42:49.000Z","updated_at":"2025-05-06T13:27:56.000Z","dependencies_parsed_at":"2023-10-13T07:14:40.273Z","dependency_job_id":"3b9effe2-e8b0-4951-9798-6c30307e17d9","html_url":"https://github.com/DataBiosphere/terra-common-lib","commit_stats":null,"previous_names":[],"tags_count":172,"template":false,"template_full_name":null,"purl":"pkg:github/DataBiosphere/terra-common-lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataBiosphere%2Fterra-common-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataBiosphere%2Fterra-common-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataBiosphere%2Fterra-common-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataBiosphere%2Fterra-common-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DataBiosphere","download_url":"https://codeload.github.com/DataBiosphere/terra-common-lib/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataBiosphere%2Fterra-common-lib/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262172450,"owners_count":23270009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-31T19:39:11.484Z","updated_at":"2025-06-27T01:31:33.004Z","avatar_url":"https://github.com/DataBiosphere.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# terra-common-lib\n## Publishing \nMC Terra components use JFrog Artifactory to publish libraries to a central Maven [repository](https://broadinstitute.jfrog.io/ui/packages).\nThe library version number is the `version` in [build.gradle](build.gradle). We use [github actions](/.github/workflows) to bumping version and publish to repository.\n\nThe publishing procedure is:\n1. After PR is merged to develop branch: github action automatically bumped the minor `version` in [build.gradle](build.gradle) then publish to [lib-snapshot-local](https://broadinstitute.jfrog.io/ui/repos/tree/General/libs-snapshot-local)\n2. After release is created(usually a manual step): github action automatically bumped the minor `version` in [build.gradle](build.gradle) then publish to [lib-snapshot-release](https://broadinstitute.jfrog.io/ui/repos/tree/General/libs-release-local).\n3. To bump major version, we need manually update `version` in [build.gradle](build.gradle) value first then create the release.\n \n## Development \n\n### Database Configuration\nTerra Common Lib includes functionality using [Stairway](https://github.com/DataBiosphere/stairway).\nSome of the TCL unit tests therefore rely on a running SQL instance to run Stairway. There are two\nrecommended ways to set up a local Postgres Database for the unit tests.\n\n#### Option A: Docker Postgres\n##### Running the Postgres Container\nTo start a postgres container configured with the necessary databases:\n```sh\n./local-dev/run_postgres.sh start\n```\nTo stop the container:\n```sh\n./local-dev/run_postgres.sh stop\n```\nNote that the contents of the database is not saved between container runs.\n\n##### Connecting to the Postgres Container\nUse `psql` to connect to databases within the started database container, e.g. for database `tclstairway` users `tclstairwayuser` with password `tclstairwaypwd`:\n```sh\nPGPASSWORD=tclstairwaypwd psql postgresql://127.0.0.1:5432/tclstairway -U tclstairwayuser\n```\n\n#### Option B: Local Postgres \nSet up a local Postgres instance. To set up TCL's required database for unit tests, run the following command, which will create the DB's and users:\n\n```sh\npsql -f local-dev/local-postgres-init.sql\n```\n\n### Local testing\nWhen working on a TCL package, it is often helpful to be able to quickly test out changes\nin the context of a service repo (e.g. `terra-workspace-manager` or `terra-resource-buffer`)\nrunning a local server.\n\nGradle makes this very easy with a `mavenLocal` target for publishing and loading packages:\n\n1. Publish from TCL to your machine's local Maven cache.\n   \n   ```\n   ./gradlew publishToMavenLocal\n   ```\n    \n   Your package will be in `~/.m2/repository`.\n2. From the service repo, add `mavenLocal()` to the _first_ repository location\nbuild.gradle file (e.g. before `mavenCentral()`.\n\n   ```\n   # terra-workspace-manager/build.gradle\n\n   // If true, search local repository (~/.m2/repository/) first for dependencies.\n   def useMavenLocal = true\n   repositories {\n      if (useMavenLocal) {\n          mavenLocal() // must be listed first to take effect\n      }\n      mavenCentral()\n      ...\n   ```\n\nThat's it! Your service should pick up locally-published changes. If your changes involved bumping \na minor version of a TCL package, be careful to update version numbers accordingly.\n\n## SourceClear\n\n[SourceClear](https://srcclr.github.io) is a static analysis tool that scans a project's Java\ndependencies for known vulnerabilities. If you are working on addressing dependency vulnerabilities\nin response to a SourceClear finding, you may want to run a scan off of a feature branch and/or local code.\n\n### Github Action\n\nYou can trigger TCL's SCA scan on demand via its\n[Github Action](https://github.com/broadinstitute/dsp-appsec-sourceclear-github-actions/actions/workflows/z-manual-terra-common-lib.yml),\nand optionally specify a Github ref (branch, tag, or SHA) to check out from the repo to scan.  By default,\nthe scan is run off of TCL's `develop` branch.\n\nHigh-level results are outputted in the Github Actions run.\n\n### Running Locally\n\nYou will need to get the API token from Vault before running the Gradle `srcclr` task.\n\n```sh\nexport SRCCLR_API_TOKEN=$(vault read -field=api_token secret/secops/ci/srcclr/gradle-agent)\n./gradlew srcclr\n```\n\nHigh-level results are outputted to the terminal.\n\n### Veracode\n\nFull results including dependency graphs are uploaded to\n[Veracode](https://sca.analysiscenter.veracode.com/workspaces/jppForw/projects/544768/issues)\n(if running off of a feature branch, navigate to Project Details \u003e Selected Branch \u003e Change to select your feature branch).\nYou can request a Veracode account to view full results from #dsp-infosec-champions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatabiosphere%2Fterra-common-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatabiosphere%2Fterra-common-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatabiosphere%2Fterra-common-lib/lists"}