Skip to content
Merged
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
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ jobs:
export IMAGE_PROCESSING_CONTAINER_IMAGE="$(KO_DOCKER_REPO=kind.local ko publish ./cmd/image-processing)"

make test-integration
- name: Test-PipelineRun
run: |
BUILDRUN_EXECUTOR=PipelineRun ginkgo --focus-file="buildruns_to_pipelineruns_test.go" -v test/integration/...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit (not blocking): ideally would like to have these be arguments to the make target, but I can live with this for now.


e2e:
strategy:
Expand Down Expand Up @@ -240,6 +243,33 @@ jobs:
export TEST_E2E_FLAGS="-r --procs 8 --randomize-all --timeout=1h --trace --vv"
export TEST_E2E_TIMEOUT_MULTIPLIER=2
make test-e2e
- name: Test-PipelineRun
run: |
export TEST_NAMESPACE=shp-e2e
export TEST_IMAGE_REPO=registry.registry.svc.cluster.local:32222/shipwright-io/build-e2e
export TEST_IMAGE_REPO_INSECURE=true
export TEST_E2E_TIMEOUT_MULTIPLIER=1
kubectl patch deployment shipwright-build-controller -n shipwright-build --type='json' -p='[
{
"op": "add",
"path": "/spec/template/spec/containers/0/env/-",
"value": {
"name": "BUILDRUN_EXECUTOR",
"value": "PipelineRun"
}
}
]'
# Wait for the rollout to complete
kubectl rollout restart deployment shipwright-build-controller -n shipwright-build
kubectl rollout status deployment shipwright-build-controller -n shipwright-build

# Run PipelineRun tests
TEST_CONTROLLER_NAMESPACE=${TEST_NAMESPACE} \
TEST_WATCH_NAMESPACE=${TEST_NAMESPACE} \
TEST_E2E_SERVICEACCOUNT_NAME=pipeline \
TEST_E2E_TIMEOUT_MULTIPLIER=${TEST_E2E_TIMEOUT_MULTIPLIER} \
TEST_E2E_VERIFY_TEKTONOBJECTS=true \
ginkgo --focus="PipelineRun E2E Tests" --procs 8 --timeout=1h --vv test/e2e/v1beta1/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit (not blocking): ditto on incorporating this into the make target.

- name: Build controller logs
if: ${{ failure() }}
run: |
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ test-integration: install-apis ginkgo
--randomize-all \
--randomize-suites \
--fail-on-pending \
--skip-file=buildruns_to_pipelineruns_test.go \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit (not blocking): we should use labels or other Ginkgo-native mechanisms for skipping these tests in the default integration and e2e test suites.

-trace \
test/integration/...

Expand All @@ -226,7 +227,7 @@ test-e2e-plain: ginkgo
TEST_E2E_SERVICEACCOUNT_NAME=${TEST_E2E_SERVICEACCOUNT_NAME} \
TEST_E2E_TIMEOUT_MULTIPLIER=${TEST_E2E_TIMEOUT_MULTIPLIER} \
TEST_E2E_VERIFY_TEKTONOBJECTS=${TEST_E2E_VERIFY_TEKTONOBJECTS} \
$(GINKGO) ${TEST_E2E_FLAGS} test/e2e/
$(GINKGO) --skip-file=e2e_pipelinerun_test.go ${TEST_E2E_FLAGS} test/e2e/

.PHONY: test-e2e-kind-with-prereq-install
test-e2e-kind-with-prereq-install: ginkgo install-controller-kind install-strategies test-e2e-plain
Expand Down
4 changes: 4 additions & 0 deletions deploy/200-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ rules:
# With the OwnerReferencesPermissionEnforcement admission controller enabled, controllers need the "delete" permission on objects that they set owner references on.
verbs: ['get', 'list', 'watch', 'create', 'delete', 'patch']

- apiGroups: ['tekton.dev']
resources: ['pipelineruns']
verbs: ['get', 'list', 'watch', 'create', 'delete', 'patch']

- apiGroups: ['']
resources: ['pods']
verbs: ['get', 'list', 'watch']
Expand Down
1 change: 1 addition & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ The following environment variables are available:
| `KUBE_API_BURST` | Burst to use for the Kubernetes API client. See [Config.Burst]. A value of 0 or lower will use the default from client-go, which currently is 10. Default is 0. |
| `KUBE_API_QPS` | QPS to use for the Kubernetes API client. See [Config.QPS]. A value of 0 or lower will use the default from client-go, which currently is 5. Default is 0. |
| `VULNERABILITY_COUNT_LIMIT` | holds vulnerability count limit if vulnerability scan is enabled for the output image. If it is defined as 10, then it will output only 10 vulnerabilities sorted by severity in the buildrun status.Output. Default is 50. |
| `BUILDRUN_EXECUTOR` | Sets the kind of buildrun exectutor that will be used. Value can be `TaskRun` or `PipelineRun`. By default buildrun will use `TaskRun` for its build executor. |

[^1]: The `runAsUser` and `runAsGroup` are dynamically overwritten depending on the build strategy that is used. See [Security Contexts](buildstrategies.md#security-contexts) for more information.

Expand Down
8 changes: 8 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const (
controllerBuildRunMaxConcurrentReconciles = "BUILDRUN_MAX_CONCURRENT_RECONCILES"
controllerBuildStrategyMaxConcurrentReconciles = "BUILDSTRATEGY_MAX_CONCURRENT_RECONCILES"
controllerClusterBuildStrategyMaxConcurrentReconciles = "CLUSTERBUILDSTRATEGY_MAX_CONCURRENT_RECONCILES"
controllerBuildrunExecutorEnvVar = "BUILDRUN_EXECUTOR"

// environment variables for the kube API
kubeAPIBurst = "KUBE_API_BURST"
Expand Down Expand Up @@ -107,6 +108,7 @@ type Config struct {
KubeAPIOptions KubeAPIOptions
GitRewriteRule bool
VulnerabilityCountLimit int
BuildrunExecutor string
}

// PrometheusConfig contains the specific configuration for the
Expand Down Expand Up @@ -163,6 +165,7 @@ func NewDefaultConfig() *Config {
TerminationLogPath: terminationLogPathDefault,
GitRewriteRule: false,
VulnerabilityCountLimit: 50,
BuildrunExecutor: "TaskRun",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 on default value.


GitContainerTemplate: Step{
Image: gitDefaultImage,
Expand Down Expand Up @@ -361,6 +364,11 @@ func (c *Config) SetConfigFromEnv() error {
c.VulnerabilityCountLimit = vc
}

// set environment variable for executor type
if executor := os.Getenv(controllerBuildrunExecutorEnvVar); executor != "" {
c.BuildrunExecutor = executor
}
Comment on lines +367 to +370
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit (not blocking): ideally we should have some validation on this env var value and not accept it at face value.


// Mark that the Git wrapper is suppose to use Git rewrite rule
if useGitRewriteRule := os.Getenv(useGitRewriteRule); useGitRewriteRule != "" {
c.GitRewriteRule = strings.ToLower(useGitRewriteRule) == "true"
Expand Down
Loading