Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support standard build envs for CI / Git integrations #59

Open
pi0 opened this issue Jul 17, 2023 · 2 comments
Open

Support standard build envs for CI / Git integrations #59

pi0 opened this issue Jul 17, 2023 · 2 comments

Comments

@pi0
Copy link
Member

pi0 commented Jul 17, 2023

CI/CD pipelines often provide variables such as deployment URL, git hash, git branch, etc. We might expose standard exports that can scan them.

Some providers:

Vercel

https://vercel.com/docs/projects/environment-variables/system-environment-variables

VERCEL_URL, VERCEL_BRANCH_URL, VERCEL_GIT_PROVIDER, VERCEL_GIT_REPO_SLUG, VERCEL_GIT_REPO_OWNER, VERCEL_GIT_REPO_ID, VERCEL_GIT_COMMIT_REF, VERCEL_GIT_COMMIT_SHA, VERCEL_GIT_COMMIT_MESSAGE, VERCEL_GIT_COMMIT_AUTHOR_LOGIN, VERCEL_GIT_COMMIT_AUTHOR_NAME, VERCEL_GIT_PREVIOUS_SHA

Netlify

https://docs.netlify.com/configure-builds/environment-variables/

REPOSITORY_URL, BRANCH, HEAD, COMMIT_REF, CACHED_COMMIT_REF, CACHED_COMMIT_REF, PULL_REQUEST, REVIEW_ID, URL, DEPLOY_URL, DEPLOY_PRIME_URL

Github Actions

https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables

GITHUB_SHA, GITHUB_ACTOR, GITHUB_API_URL, GITHUB_BASE_REF, GITHUB_HEAD_REF, GITHUB_REF, GITHUB_REF_NAME, GITHUB_REPOSITORY, GITHUB_REPOSITORY_OWNER, GITHUB_REPOSITORY_OWNER_ID, GITHUB_WORKFLOW_SHA

Gitlab CI

https://docs.gitlab.com/ee/ci/variables/predefined_variables.html

CI_COMMIT_AUTHOR, CI_COMMIT_BEFORE_SHA, CI_COMMIT_BRANCH, CI_COMMIT_DESCRIPTION, CI_COMMIT_MESSAGE, CI_COMMIT_REF_NAME, CI_COMMIT_SHA, CI_COMMIT_SHORT_SHA, CI_COMMIT_TAG, CI_ENVIRONMENT_URL, CI_PAGES_URL,

Cloudflare pages

https://developers.cloudflare.com/pages/configuration/build-configuration/#environment-variables

CF_PAGES, CF_PAGES_COMMIT_SHA, CF_PAGES_BRANCH, CF_PAGES_URL

@pi0 pi0 added the discussion label Jul 17, 2023
@harlan-zw
Copy link

harlan-zw commented Jan 24, 2024

Following.

Also, fwiw the URL becomes ambiguous across platforms, sometimes it's the specific URL for that deployment (https://<deployid>.host.com) verse the configured domain (https://mydomain.com).

@pi0
Copy link
Member Author

pi0 commented Jan 24, 2024

Yes indeed... I'm not sure if any of these platforms give access to the alias of main domain and if they do we might expose two vars for canonical domain. (BTW talking about our usecase of generatic permanent URLs for something like og-image, I would say this is even safer to rely on deploy-pinned URL)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants