Git and code hosts
Functions of the tools module at v0.7.0. Each returns what a command runs in; import it with import * as tools from "tools".
git.env
Git, configured by its parameters.
git.env(
--name: String | Null = null,
--email: String | Null = null,
--token: String | Null = <secret>,
--host: String = "github.com",
--token_user: String = "x-access-token",
--ssh_dir: String | Null = null,
--ssh_agent_socket: String | Null = null,
--base_access: String | Map<String> | Null = null,
--with: Array<Record<env: Map<String>, volumes: Array<String>>> = [],
--extra_env: Map<String> = {}
): RunnableThe image is built from lib/images/unix/Dockerfile, as for unix.env(), so it takes no --image, and lask sync builds it. The container sees none of the host's Git configuration: the identity, a token for https and an SSH identity are given here, and the mounted project is trusted (safe.directory).
Parameters
--nameGIT_AUTHOR_NAME and GIT_COMMITTER_NAME.--emailGIT_AUTHOR_EMAIL and GIT_COMMITTER_EMAIL.--token!!An access token for https; masked in the command log. See git_setup.--hostThe host the token is for.--token_userThe user name the host expects beside a token.--ssh_dirHost directory mounted read-only at /root/.ssh; see ssh_setup.--ssh_agent_socketHost path of an SSH agent socket (SSH_AUTH_SOCK); see ssh_setup.--base_accessWhat the container may do with the project directory: "rw" (the default), "ro", "none", or a table of paths such as {".": "ro", "dist": "rw"} (lask spec 10.2).--withSetups of other tools this environment should also carry.--extra_envAny other variable; below --with and the named parameters.
Returns Runnable: The environment, for command { "git" } on ... or $[...].
Image recipe lib/images/unix/Dockerfile
Command words bzip2, curl, envsubst, gzip, jq, openssl, rsync, tar, unzip, wget, xz, yq, zip: import command { "bzip2", "curl", "envsubst", "gzip", "jq", "openssl", "rsync", "tar", "unzip", "wget", "xz", "yq", "zip" } from "tools"
lask eval git.env --name "CI" --email ci@example.comgit.setup
Git's identity and its access to private repositories over https.
git.setup(
--token: String | Null = <secret>,
--host: String = "github.com",
--token_user: String = "x-access-token",
--name: String | Null = null,
--email: String | Null = null
): Record<env: Map<String>, volumes: Array<String>>The configuration is carried in GIT_CONFIG_* variables, so nothing is written to a file: the mounted project is trusted (safe.directory), and with a token, https://<host>/ and git@<host>: are both rewritten to https with the token in the URL. That reaches every tool that clones through Git — go get of a private module, a git dependency of npm, Cargo or Bundler. The token is masked wherever it appears.
Parameters
--token!!The access token; masked in the command log.--hostThe host the token is for.--token_userThe user name the host expects beside a token: "x-access-token" for GitHub, "oauth2" for GitLab.--nameGIT_AUTHOR_NAME and GIT_COMMITTER_NAME.--emailGIT_AUTHOR_EMAIL and GIT_COMMITTER_EMAIL.
Returns Record<env: Map<String>, volumes: Array<String>>: The variables, for a tool's --with.
gh.env
The GitHub CLI, configured by its parameters.
gh.env(
--token: String | Null = <secret>,
--host: String | Null = null,
--repo: String | Null = null,
--base_access: String | Map<String> | Null = null,
--with: Array<Record<env: Map<String>, volumes: Array<String>>> = [],
--extra_env: Map<String> = {}
): RunnableThe image is that of unix.env(), as for git. gh never prompts, checks for no update, and pages nothing (GH_PROMPT_DISABLED=1, GH_NO_UPDATE_NOTIFIER=1, GH_PAGER=""). The token authenticates gh's own API calls; a command that also runs git over https — gh pr checkout, gh repo clone — takes with = [git.setup(token = ...)] as well.
Parameters
--token!!GH_TOKEN; masked in the command log.--hostGH_HOST, for GitHub Enterprise Server.--repoGH_REPO, "owner/name": the repository a command acts on when it is not the project's.--base_accessWhat the container may do with the project directory: "rw" (the default), "ro", "none", or a table of paths such as {".": "ro", "dist": "rw"} (lask spec 10.2).--withSetups of other tools this environment should also carry.--extra_envAny other variable; below --with and the named parameters.
Returns Runnable: The environment, for command { "gh" } on ... or $[...].
Image recipe lib/images/unix/Dockerfile
Command words bzip2, curl, envsubst, gzip, jq, openssl, rsync, tar, unzip, wget, xz, yq, zip: import command { "bzip2", "curl", "envsubst", "gzip", "jq", "openssl", "rsync", "tar", "unzip", "wget", "xz", "yq", "zip" } from "tools"
lask eval gh.env --repo lask-task-runner/laskglab.env
The GitLab CLI, configured by its parameters.
glab.env(
--token: String | Null = <secret>,
--host: String | Null = null,
--base_access: String | Map<String> | Null = null,
--with: Array<Record<env: Map<String>, volumes: Array<String>>> = [],
--extra_env: Map<String> = {}
): RunnableThe image is that of unix.env(), as for git. glab checks for no update and never prompts (GLAB_CHECK_UPDATE=false, GLAB_NO_PROMPT=true). As with gh, a command that runs git over https takes git_setup as well, with token_user = "oauth2".
Parameters
--token!!GITLAB_TOKEN; masked in the command log.--hostGITLAB_HOST, for a self-managed instance.--base_accessWhat the container may do with the project directory: "rw" (the default), "ro", "none", or a table of paths such as {".": "ro", "dist": "rw"} (lask spec 10.2).--withSetups of other tools this environment should also carry.--extra_envAny other variable; below --with and the named parameters.
Returns Runnable: The environment, for command { "glab" } on ... or $[...].
Image recipe lib/images/unix/Dockerfile
Command words bzip2, curl, envsubst, gzip, jq, openssl, rsync, tar, unzip, wget, xz, yq, zip: import command { "bzip2", "curl", "envsubst", "gzip", "jq", "openssl", "rsync", "tar", "unzip", "wget", "xz", "yq", "zip" } from "tools"
lask eval glab.env --host gitlab.example.com