--- title: "ADR 0048: tkn pac resolve works without a cluster and with a stub provider" --- * Status: accepted * Code: [`pkg/cmd/tknpac/resolve/resolve.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/cmd/tknpac/resolve/resolve.go), [`pkg/cmd/tknpac/resolve/basic_auth_secret.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/cmd/tknpac/resolve/basic_auth_secret.go) ## Context `tkn pac resolve` renders a PipelineRun the way the controller would, on a developer machine. It reuses the controller's `resolve` package, which needs a provider and an event, and the `git_auth_secret` placeholder needs a token. ## Decision * A `NewClients` error is tolerated only when its message contains `Couldn't get kubeConfiguration namespace`; any other error is returned. The command therefore runs without a kubeconfig. * When the clients exist, errors from `run.UpdatePacConfig` are discarded, so a cluster without Pipelines-as-Code still resolves. Errors from `git.GetGitInfo(".")` are ignored too. * The zap logger is built at `FatalLevel`, so only fatal errors reach the user. * `github.New()` is the provider given to `resolve.Resolve` whatever the real forge is. The code states no other reason than that remote tasks are not resolved. * Placeholders are replaced with the `-p` parameters and git info only: no body, empty `http.Header`, empty JSON map. * After marshalling, `cleanRe` strips `null` or `{}` values of `status`, `spec`, `metadata`, `taskRunTemplate`, `creationTimestamp` and `computeResources` from the YAML text. * When a template uses `git_auth_secret`, `makeGitAuthSecret` takes the token in this order: an existing cluster Secret labelled with the repository owner and name (its name is reused, none is created), the token flag, `PAC_PROVIDER_TOKEN`, then an interactive prompt. ## Consequences * The match on the kubeconfig error message breaks if the client library changes its wording. * A regexp over YAML text cannot remove every empty field. * Provider-specific resolution behaviour is not exercised by this command.