Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROX-20232: Remove all but single collector pipeline #1687

Merged
merged 7 commits into from
May 29, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ metadata:
build.appstudio.redhat.com/target_branch: '{{target_branch}}'
pipelinesascode.tekton.dev/max-keep-runs: "500"
# TODO(ROX-21073): re-enable for all PR branches
pipelinesascode.tekton.dev/on-cel-expression: event == "pull_request" && (source_branch.contains("rhtap") || source_branch.contains("konflux"))
pipelinesascode.tekton.dev/on-cel-expression: (event == "push" && target_branch == "master") || (event == "pull_request" && (source_branch.contains("rhtap") || source_branch.contains("konflux")))
Molter73 marked this conversation as resolved.
Show resolved Hide resolved
creationTimestamp: null
labels:
appstudio.openshift.io/application: acs
appstudio.openshift.io/component: collector
pipelines.appstudio.openshift.io/type: build
name: collector-on-pull-request
name: collector-build
namespace: rh-acs-tenant

spec:
Expand All @@ -25,11 +25,10 @@ spec:
- name: git-url
value: '{{repo_url}}'
- name: image-expires-after
# TODO(ROX-20230): make release images not expire.
value: '13w'
- name: output-image-repo
value: quay.io/rhacs-eng/collector
- name: output-tag-suffix
value: '-latest'
- name: path-context
value: .
- name: revision
Expand All @@ -50,8 +49,6 @@ spec:
value: 'true'
- name: build-source-image
value: 'true'
- name: build-target-stage
value: collector

workspaces:
- name: workspace
Expand All @@ -71,6 +68,26 @@ spec:
secret:
secretName: subscription-manager-activation-key

taskRunSpecs:
- pipelineTaskName: build-container
stepSpecs:
- name: build
# CPU requests are increased to speed up builds compared to the defaults.
# Defaults: https://github.com/redhat-appstudio/build-definitions/blob/main/task/buildah/0.1/buildah.yaml#L126
computeResources:
limits:
cpu: 4
requests:
cpu: 4
- pipelineTaskName: clamav-scan
stepSpecs:
# Provision more CPU to speed up ClamAV scan compared to the defaults.
# https://github.com/redhat-appstudio/build-definitions/blob/main/task/clamav-scan/0.1/clamav-scan.yaml#L48
- name: extract-and-scan-image
computeResources:
requests:
cpu: 1

# The pipeline regularly takes >1h to finish.
timeouts:
pipeline: 1h30m0s
Expand Down
36 changes: 27 additions & 9 deletions .tekton/collector-component-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ spec:
- description: Output Image Repository
name: output-image-repo
type: string
- description: Suffix appended to the tag of the output image
name: output-tag-suffix
type: string
- default: .
description: Path to the source code of an application's component from where
to build image.
Expand Down Expand Up @@ -130,11 +127,10 @@ spec:
- name: init
params:
- name: image-url
# We can't provide a real tag because it is not known at this time.
# We still provide a fake tag to the task to comply with the expected input.
# Because 'rebuild' is set to true, this has no effect.
# TODO(ROX-24116): Apply both Konflux-style and StackRox-style tags to containers
value: $(params.output-image-repo):fake-tag
# We can't provide a StackRox-style tag because it is not known at this time (requires cloning source, etc.)
# As a workaround, we still provide a unique tag that's based on a revision to this task to comply with its
# expected input. We later actually add this tag on a built image with apply-tags task.
value: $(params.output-image-repo):konflux-$(params.revision)
- name: rebuild
value: $(params.rebuild)
taskRef:
Expand Down Expand Up @@ -227,7 +223,7 @@ spec:
- name: build-container
params:
- name: IMAGE
value: $(params.output-image-repo):$(tasks.determine-image-tag.results.image-tag)$(params.output-tag-suffix)
value: $(params.output-image-repo):$(tasks.determine-image-tag.results.image-tag)
- name: DOCKERFILE
value: $(params.dockerfile)
- name: CONTEXT
Expand Down Expand Up @@ -262,6 +258,28 @@ spec:
- name: source
workspace: workspace

- name: apply-tags
params:
- name: IMAGE
value: $(tasks.build-container.results.IMAGE_URL)
- name: ADDITIONAL_TAGS
value:
- konflux-$(params.revision)
# TODO(ROX-24402): don't publish multiple tags when ability to install Slim collector is gone.
- $(tasks.determine-image-tag.results.image-tag)-latest
Copy link
Contributor

Choose a reason for hiding this comment

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

When (if at all) will the -latest and -slim tags be removed? Can we link a Jira issue here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So far, it's a distant plan for which I created the epic ROX-24402.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for updating the comment.

- $(tasks.determine-image-tag.results.image-tag)-slim
runAfter:
- build-container
taskRef:
params:
- name: name
value: apply-tags
- name: bundle
value: quay.io/redhat-appstudio-tekton-catalog/task-apply-tags:0.1@sha256:29add9a49a2281a3755a9b580d2b9c5cb110231b14cccf8ade2fd7895a9b4b4a
- name: kind
value: task
resolver: bundles

- name: build-source-image
params:
- name: BINARY_IMAGE
Expand Down
79 changes: 0 additions & 79 deletions .tekton/collector-push.yaml

This file was deleted.

79 changes: 0 additions & 79 deletions .tekton/collector-slim-pull-request.yaml

This file was deleted.

79 changes: 0 additions & 79 deletions .tekton/collector-slim-push.yaml

This file was deleted.

11 changes: 1 addition & 10 deletions collector/container/konflux.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ RUN /tmp/.konflux/scripts/subscription-manager-bro.sh register /mnt && \
rpm --root=/mnt --verbose -e --nodeps $(rpm --root=/mnt -qa 'curl' '*rpm*' '*dnf*' '*libsolv*' '*hawkey*' 'yum*') && \
rm -rf /mnt/var/cache/dnf /mnt/var/cache/yum

FROM scratch as collector-common
FROM scratch

COPY --from=rpm-implanter-app /mnt /

Expand Down Expand Up @@ -160,15 +160,6 @@ CMD collector-wrapper.sh \
--collection-method=$COLLECTION_METHOD \
--grpc-server=$GRPC_SERVER

FROM collector-common AS collector-slim

LABEL \
com.redhat.component="rhacs-collector-slim-container" \
io.k8s.display-name="collector-slim" \
name="rhacs-collector-slim-rhel8"

FROM collector-common AS collector

LABEL \
com.redhat.component="rhacs-collector-container" \
io.k8s.display-name="collector" \
Expand Down
Loading