One command of a pipeline (or a lone one): its deploys; *out: what it * writes to the pipe, when that is a kustomize build or a helm template. */
| 1736 | /* One command of a pipeline (or a lone one): its deploys; *out: what it |
| 1737 | * writes to the pipe, when that is a kustomize build or a helm template. */ |
| 1738 | static void sh_deploy_command(sh_t *s, TSNode cmd, const sh_argv_t *a, const sh_src_t *in, |
| 1739 | sh_src_t *out) { |
| 1740 | *out = (sh_src_t){SH_SRC_NONE, NULL, NULL}; |
| 1741 | int prog = sh_program(s, a); |
| 1742 | if (prog < 0 || !a->v[prog]) { |
| 1743 | return; |
| 1744 | } |
| 1745 | const char *base = sh_basename(a->v[prog]); |
| 1746 | if (strcmp(base, "kubectl") == 0) { |
| 1747 | sh_kubectl(s, cmd, a, prog, in, out); |
| 1748 | } else if (strcmp(base, "helm") == 0) { |
| 1749 | sh_helm(s, cmd, a, prog, out); |
| 1750 | } else if (strcmp(base, "kustomize") == 0) { |
| 1751 | const char *verb = sh_first_operand(a, prog + SKIP_ONE); |
| 1752 | if (sh_eq(verb, "build")) { |
| 1753 | int at = SH_NO_DEPTH; |
| 1754 | for (int i = prog + SKIP_ONE; i < a->n; i++) { |
| 1755 | if (a->v[i] == verb) { |
| 1756 | at = i; |
| 1757 | break; |
| 1758 | } |
| 1759 | } |
| 1760 | const char *d = at >= 0 ? sh_first_operand(a, at + SKIP_ONE) : NULL; |
| 1761 | *out = (sh_src_t){SH_SRC_KUST, d ? d : ".", "kustomize"}; |
| 1762 | } |
| 1763 | } else if (strcmp(base, "find") == 0) { |
| 1764 | sh_find(s, cmd, a, prog); |
| 1765 | } |
| 1766 | } |
| 1767 | |
| 1768 | /* The File node a repository path names; 0: none. */ |
| 1769 | static int64_t sh_repo_file_id(const sh_t *s, const char *path) { |
no test coverage detected