Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ jobs:
if: >
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request_target' && contains(fromJSON('["zakisk", "infernus01", "savitaashture", "chmouel", "vdemeester", "PuneetPunamiya", "enarha", "aThorp96", "sm43", "waveywaves", "dependabot[bot]"]'), github.event.pull_request.user.login))
(github.event_name == 'pull_request_target' &&
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association))
concurrency:
group: ${{ github.workflow }}-${{ matrix.provider }}-${{ github.event.pull_request.number || github.ref_name }}
cancel-in-progress: true
Expand Down
14 changes: 10 additions & 4 deletions config/302-pac-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,18 @@ data:
# namespace and repository CR, supported only with GitHub App
auto-configure-new-github-repo: "false"

# add a template to generate name for namespace for your auto configured
# github repo supported fields are repo_owner, repo_name eg. if defined as
# `{{repo_owner}}-{{repo_name}}-ci`, then namespace generated for repository
# https://github.com/owner/repo will be `owner-repo-ci`
# Add a template to generate the name for a Repository CR for an auto-configured
# GitHub repository. Supported fields are `repo_owner` and `repo_name`. e.g.,
# if defined as `{{repo_owner}}-{{repo_name}}-repo-cr`, the generated CR name for
# https://github.com/owner/test will be `owner-test-repo-cr`
auto-configure-repo-namespace-template: ""

# add a template to generate name for repository for your auto configured
# github repo. supported fields are repo_owner, repo_name eg. if defined as
# `{{repo_owner}}-{{repo_name}}-repo-cr`, then repository CR generated for git repository
# https://github.com/owner/test will be `owner-test-repo-cr`
auto-configure-repo-repository-template: ""

# Enable or disable the feature to rerun the CI if push event happens on
# a pull request
#
Expand Down
13 changes: 13 additions & 0 deletions docs/content/docs/install/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,19 @@ There is a few things you can configure through the config map

`https://github.com/owner/repo` will be `owner-repo-ci`

* `auto-configure-repo-repository-template`

If `auto-configure-new-github-repo` is enabled then you can provide a template
for generating the name for your new repository custom resource. By default, the repository custom resource name will be generated using this format `{{repo_name}}-repo-cr`.

You can override the default using the following variables

* `{{repo_owner}}`: The repository owner.
* `{{repo_name}}`: The repository name.
For example, if the template is defined as `{{repo_owner}}-{{repo_name}}-repo-cr`,
then the Repository CR name generated for the repository
`https://github.com/owner/test` will be `owner-test-repo-cr`

* `remember-ok-to-test`

If `remember-ok-to-test` is true then if `ok-to-test` is done on pull request then in
Expand Down
75 changes: 38 additions & 37 deletions pkg/apis/pipelinesascode/keys/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,43 +23,44 @@ import (
)

const (
ControllerInfo = pipelinesascode.GroupName + "/controller-info"
Task = pipelinesascode.GroupName + "/task"
Pipeline = pipelinesascode.GroupName + "/pipeline"
URLOrg = pipelinesascode.GroupName + "/url-org"
URLRepository = pipelinesascode.GroupName + "/url-repository"
SHA = pipelinesascode.GroupName + "/sha"
Sender = pipelinesascode.GroupName + "/sender"
EventType = pipelinesascode.GroupName + "/event-type"
Branch = pipelinesascode.GroupName + "/branch"
SourceBranch = pipelinesascode.GroupName + "/source-branch"
Repository = pipelinesascode.GroupName + "/repository"
GitProvider = pipelinesascode.GroupName + "/git-provider"
State = pipelinesascode.GroupName + "/state"
ShaTitle = pipelinesascode.GroupName + "/sha-title"
ShaURL = pipelinesascode.GroupName + "/sha-url"
RepoURL = pipelinesascode.GroupName + "/repo-url"
SourceRepoURL = pipelinesascode.GroupName + "/source-repo-url"
PullRequest = pipelinesascode.GroupName + "/pull-request"
InstallationID = pipelinesascode.GroupName + "/installation-id"
GHEURL = pipelinesascode.GroupName + "/ghe-url"
SourceProjectID = pipelinesascode.GroupName + "/source-project-id"
TargetProjectID = pipelinesascode.GroupName + "/target-project-id"
OriginalPRName = pipelinesascode.GroupName + "/original-prname"
GitAuthSecret = pipelinesascode.GroupName + "/git-auth-secret"
CheckRunID = pipelinesascode.GroupName + "/check-run-id"
OnEvent = pipelinesascode.GroupName + "/on-event"
OnComment = pipelinesascode.GroupName + "/on-comment"
OnTargetBranch = pipelinesascode.GroupName + "/on-target-branch"
OnPathChange = pipelinesascode.GroupName + "/on-path-change"
OnLabel = pipelinesascode.GroupName + "/on-label"
OnPathChangeIgnore = pipelinesascode.GroupName + "/on-path-change-ignore"
OnCelExpression = pipelinesascode.GroupName + "/on-cel-expression"
TargetNamespace = pipelinesascode.GroupName + "/target-namespace"
MaxKeepRuns = pipelinesascode.GroupName + "/max-keep-runs"
CancelInProgress = pipelinesascode.GroupName + "/cancel-in-progress"
LogURL = pipelinesascode.GroupName + "/log-url"
ExecutionOrder = pipelinesascode.GroupName + "/execution-order"
ControllerInfo = pipelinesascode.GroupName + "/controller-info"
Task = pipelinesascode.GroupName + "/task"
Pipeline = pipelinesascode.GroupName + "/pipeline"
URLOrg = pipelinesascode.GroupName + "/url-org"
URLRepository = pipelinesascode.GroupName + "/url-repository"
SHA = pipelinesascode.GroupName + "/sha"
Sender = pipelinesascode.GroupName + "/sender"
EventType = pipelinesascode.GroupName + "/event-type"
Branch = pipelinesascode.GroupName + "/branch"
SourceBranch = pipelinesascode.GroupName + "/source-branch"
Repository = pipelinesascode.GroupName + "/repository"
GitProvider = pipelinesascode.GroupName + "/git-provider"
State = pipelinesascode.GroupName + "/state"
ShaTitle = pipelinesascode.GroupName + "/sha-title"
ShaURL = pipelinesascode.GroupName + "/sha-url"
RepoURL = pipelinesascode.GroupName + "/repo-url"
SourceRepoURL = pipelinesascode.GroupName + "/source-repo-url"
PullRequest = pipelinesascode.GroupName + "/pull-request"
InstallationID = pipelinesascode.GroupName + "/installation-id"
GHEURL = pipelinesascode.GroupName + "/ghe-url"
SourceProjectID = pipelinesascode.GroupName + "/source-project-id"
TargetProjectID = pipelinesascode.GroupName + "/target-project-id"
OriginalPRName = pipelinesascode.GroupName + "/original-prname"
GitAuthSecret = pipelinesascode.GroupName + "/git-auth-secret"
CheckRunID = pipelinesascode.GroupName + "/check-run-id"
OnEvent = pipelinesascode.GroupName + "/on-event"
OnComment = pipelinesascode.GroupName + "/on-comment"
OnTargetBranch = pipelinesascode.GroupName + "/on-target-branch"
OnPathChange = pipelinesascode.GroupName + "/on-path-change"
OnLabel = pipelinesascode.GroupName + "/on-label"
OnPathChangeIgnore = pipelinesascode.GroupName + "/on-path-change-ignore"
OnCelExpression = pipelinesascode.GroupName + "/on-cel-expression"
TargetNamespace = pipelinesascode.GroupName + "/target-namespace"
MaxKeepRuns = pipelinesascode.GroupName + "/max-keep-runs"
CancelInProgress = pipelinesascode.GroupName + "/cancel-in-progress"
LogURL = pipelinesascode.GroupName + "/log-url"
ExecutionOrder = pipelinesascode.GroupName + "/execution-order"
SCMReportingPLRStarted = pipelinesascode.GroupName + "/scm-reporting-plr-started"
// PublicGithubAPIURL default is "https://api.github.com" but it can be overridden by X-GitHub-Enterprise-Host header.
PublicGithubAPIURL = "https://api.github.com"
GithubApplicationID = "github-application-id"
Expand Down
1 change: 0 additions & 1 deletion pkg/kubeinteraction/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func AddLabelsAndAnnotations(event *info.Event, pipelineRun *tektonv1.PipelineRu
keys.SourceBranch: event.HeadBranch,
keys.Repository: repo.GetName(),
keys.GitProvider: providerConfig.Name,
keys.State: StateStarted,
keys.ControllerInfo: fmt.Sprintf(`{"name":"%s","configmap":"%s","secret":"%s", "gRepo": "%s"}`,
paramsinfo.Controller.Name, paramsinfo.Controller.Configmap, paramsinfo.Controller.Secret, paramsinfo.Controller.GlobalRepository),
}
Expand Down
21 changes: 11 additions & 10 deletions pkg/params/settings/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,17 @@ type HubCatalog struct {
// if there is a change performed on the default value,
// update the same on "config/302-pac-configmap.yaml".
type Settings struct {
ApplicationName string `default:"Pipelines as Code CI" json:"application-name"`
HubCatalogs *sync.Map
RemoteTasks bool `default:"true" json:"remote-tasks"`
MaxKeepRunsUpperLimit int `json:"max-keep-run-upper-limit"`
DefaultMaxKeepRuns int `json:"default-max-keep-runs"`
BitbucketCloudCheckSourceIP bool `default:"true" json:"bitbucket-cloud-check-source-ip"`
BitbucketCloudAdditionalSourceIP string `json:"bitbucket-cloud-additional-source-ip"`
TektonDashboardURL string `json:"tekton-dashboard-url"`
AutoConfigureNewGitHubRepo bool `default:"false" json:"auto-configure-new-github-repo"`
AutoConfigureRepoNamespaceTemplate string `json:"auto-configure-repo-namespace-template"`
ApplicationName string `default:"Pipelines as Code CI" json:"application-name"`
HubCatalogs *sync.Map
RemoteTasks bool `default:"true" json:"remote-tasks"`
MaxKeepRunsUpperLimit int `json:"max-keep-run-upper-limit"`
DefaultMaxKeepRuns int `json:"default-max-keep-runs"`
BitbucketCloudCheckSourceIP bool `default:"true" json:"bitbucket-cloud-check-source-ip"`
BitbucketCloudAdditionalSourceIP string `json:"bitbucket-cloud-additional-source-ip"`
TektonDashboardURL string `json:"tekton-dashboard-url"`
AutoConfigureNewGitHubRepo bool `default:"false" json:"auto-configure-new-github-repo"`
AutoConfigureRepoNamespaceTemplate string `json:"auto-configure-repo-namespace-template"`
AutoConfigureRepoRepositoryTemplate string `json:"auto-configure-repo-repository-template"`

SecretAutoCreation bool `default:"true" json:"secret-auto-create"`
SecretGHAppRepoScoped bool `default:"true" json:"secret-github-app-token-scoped"`
Expand Down
96 changes: 49 additions & 47 deletions pkg/params/settings/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,55 +52,57 @@ func TestSyncConfig(t *testing.T) {
{
name: "override values",
configMap: map[string]string{
"application-name": "pac-pac",
"remote-tasks": "false",
"max-keep-run-upper-limit": "10",
"default-max-keep-runs": "5",
"bitbucket-cloud-check-source-ip": "false",
"bitbucket-cloud-additional-source-ip": "some-ip",
"tekton-dashboard-url": "https://tekton-dashboard",
"auto-configure-new-github-repo": "true",
"auto-configure-repo-namespace-template": "template",
"secret-auto-create": "false",
"secret-github-app-token-scoped": "false",
"secret-github-app-scope-extra-repos": "extra-repos",
"error-log-snippet": "false",
"error-detection-from-container-logs": "false",
"error-detection-max-number-of-lines": "100",
"error-detection-simple-regexp": "^(?P<filename>[^:]*):(?P<line>[0-9]+):(?P<column>[0-9]+)?([ ]*)?(?P<error>.*)",
"custom-console-name": "custom-console",
"custom-console-url": "https://custom-console",
"custom-console-url-pr-details": "https://custom-console-pr-details",
"custom-console-url-pr-tasklog": "https://custom-console-pr-tasklog",
"custom-console-url-namespace": "https://custom-console-namespace",
"remember-ok-to-test": "false",
"skip-push-event-for-pr-commits": "true",
"application-name": "pac-pac",
"remote-tasks": "false",
"max-keep-run-upper-limit": "10",
"default-max-keep-runs": "5",
"bitbucket-cloud-check-source-ip": "false",
"bitbucket-cloud-additional-source-ip": "some-ip",
"tekton-dashboard-url": "https://tekton-dashboard",
"auto-configure-new-github-repo": "true",
"auto-configure-repo-namespace-template": "template",
"auto-configure-repo-repository-template": "template",
"secret-auto-create": "false",
"secret-github-app-token-scoped": "false",
"secret-github-app-scope-extra-repos": "extra-repos",
"error-log-snippet": "false",
"error-detection-from-container-logs": "false",
"error-detection-max-number-of-lines": "100",
"error-detection-simple-regexp": "^(?P<filename>[^:]*):(?P<line>[0-9]+):(?P<column>[0-9]+)?([ ]*)?(?P<error>.*)",
"custom-console-name": "custom-console",
"custom-console-url": "https://custom-console",
"custom-console-url-pr-details": "https://custom-console-pr-details",
"custom-console-url-pr-tasklog": "https://custom-console-pr-tasklog",
"custom-console-url-namespace": "https://custom-console-namespace",
"remember-ok-to-test": "false",
"skip-push-event-for-pr-commits": "true",
},
expectedStruct: Settings{
ApplicationName: "pac-pac",
HubCatalogs: nil,
RemoteTasks: false,
MaxKeepRunsUpperLimit: 10,
DefaultMaxKeepRuns: 5,
BitbucketCloudCheckSourceIP: false,
BitbucketCloudAdditionalSourceIP: "some-ip",
TektonDashboardURL: "https://tekton-dashboard",
AutoConfigureNewGitHubRepo: true,
AutoConfigureRepoNamespaceTemplate: "template",
SecretAutoCreation: false,
SecretGHAppRepoScoped: false,
SecretGhAppTokenScopedExtraRepos: "extra-repos",
ErrorLogSnippet: false,
ErrorDetection: false,
ErrorDetectionNumberOfLines: 100,
ErrorDetectionSimpleRegexp: "^(?P<filename>[^:]*):(?P<line>[0-9]+):(?P<column>[0-9]+)?([ ]*)?(?P<error>.*)",
CustomConsoleName: "custom-console",
CustomConsoleURL: "https://custom-console",
CustomConsolePRdetail: "https://custom-console-pr-details",
CustomConsolePRTaskLog: "https://custom-console-pr-tasklog",
CustomConsoleNamespaceURL: "https://custom-console-namespace",
RememberOKToTest: false,
SkipPushEventForPRCommits: true,
ApplicationName: "pac-pac",
HubCatalogs: nil,
RemoteTasks: false,
MaxKeepRunsUpperLimit: 10,
DefaultMaxKeepRuns: 5,
BitbucketCloudCheckSourceIP: false,
BitbucketCloudAdditionalSourceIP: "some-ip",
TektonDashboardURL: "https://tekton-dashboard",
AutoConfigureNewGitHubRepo: true,
AutoConfigureRepoNamespaceTemplate: "template",
AutoConfigureRepoRepositoryTemplate: "template",
SecretAutoCreation: false,
SecretGHAppRepoScoped: false,
SecretGhAppTokenScopedExtraRepos: "extra-repos",
ErrorLogSnippet: false,
ErrorDetection: false,
ErrorDetectionNumberOfLines: 100,
ErrorDetectionSimpleRegexp: "^(?P<filename>[^:]*):(?P<line>[0-9]+):(?P<column>[0-9]+)?([ ]*)?(?P<error>.*)",
CustomConsoleName: "custom-console",
CustomConsoleURL: "https://custom-console",
CustomConsolePRdetail: "https://custom-console-pr-details",
CustomConsolePRTaskLog: "https://custom-console-pr-tasklog",
CustomConsoleNamespaceURL: "https://custom-console-namespace",
RememberOKToTest: false,
SkipPushEventForPRCommits: true,
},
},
{
Expand Down
Loading
Loading