Skip to content

Commit

Permalink
Merge pull request #1056 from RedHatInsights/new_pipeline
Browse files Browse the repository at this point in the history
Konfluxing
  • Loading branch information
psav authored Nov 13, 2024
2 parents 1c8a877 + c4da2d1 commit 7490e46
Show file tree
Hide file tree
Showing 16 changed files with 1,227 additions and 288 deletions.
98 changes: 96 additions & 2 deletions .tekton/clowder-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,25 @@ metadata:
namespace: hcm-eng-prod-tenant
spec:
params:
- name: hermetic
value: "true"
- name: git-url
value: '{{source_url}}'
- name: revision
value: '{{revision}}'
- name: output-image
value: quay.io/redhat-user-workloads/hcm-eng-prod-tenant/clowder/clowder:on-pr-{{revision}}
value: quay.io/redhat-user-workloads/hcm-eng-prod-tenant/clowder/clowder:{{revision}}
- name: image-expires-after
value: 5d
- name: dockerfile
value: Dockerfile
- name: path-context
value: .
- name: prefetch-input
value:
- {"type": "gomod", "path": "."}
- {"type": "gomod", "path": "./deps/controller-gen"}
- {"type": "gomod", "path": "./deps/kustomize"}
pipelineSpec:
description: |
This pipeline is ideal for building container images from a Containerfile while maintaining trust after pipeline customization.
Expand Down Expand Up @@ -107,6 +114,9 @@ spec:
description: Path to a file with build arguments for buildah, see https://www.mankier.com/1/buildah-build#--build-arg-file
name: build-args-file
type: string
- name: minikube-ssh-key
description: Minikube information.
default: minikube-ssh-key
results:
- description: ""
name: IMAGE_URL
Expand Down Expand Up @@ -234,6 +244,89 @@ spec:
operator: in
values:
- "true"
- name: run-unit-tests
params:
# New parameter to use the Trusted Artifact from the git-clone Task.
- name: SOURCE_ARTIFACT
value: $(tasks.clone-repository.results.SOURCE_ARTIFACT)
runAfter:
- build-container
taskSpec:
params:
- description: The Trusted Artifact URI pointing to the artifact with the application source code.
name: SOURCE_ARTIFACT
type: string
stepTemplate:
volumeMounts:
- mountPath: /var/workdir
name: workdir
steps:
# New step to fetch the Trusted Artifact and make it available to the next steps.
- name: use-trusted-artifact
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:81c4864dae6bb11595f657be887e205262e70086a05ed16ada827fd6391926ac
args:
- use
- $(params.SOURCE_ARTIFACT)=/var/workdir/source
- name: kustomize-build
image: registry.access.redhat.com/ubi8/ubi:latest
workingDir: /var/workdir/source
script: set -xe && dnf install -y go make && make test
volumes:
# New volume to store a copy of the source code accessible only to this Task.
- name: workdir
emptyDir: {}
- name: run-e2e-tests
params:
# New parameter to use the Trusted Artifact from the git-clone Task.
- name: SOURCE_ARTIFACT
value: $(tasks.clone-repository.results.SOURCE_ARTIFACT)
runAfter:
- build-container
taskSpec:
params:
- description: The Trusted Artifact URI pointing to the artifact with the application source code.
name: SOURCE_ARTIFACT
type: string
stepTemplate:
volumeMounts:
- mountPath: /var/workdir
name: workdir
steps:
# New step to fetch the Trusted Artifact and make it available to the next steps.
- name: use-trusted-artifact
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:81c4864dae6bb11595f657be887e205262e70086a05ed16ada827fd6391926ac
args:
- use
- $(params.SOURCE_ARTIFACT)=/var/workdir/source
- name: kustomize-build
image: registry.access.redhat.com/ubi8/ubi:latest
workingDir: /var/workdir/source
env:
- name: MINIKUBE_HOST
valueFrom:
secretKeyRef:
name: minikube-ssh-key
key: MINIKUBE_HOST
- name: MINIKUBE_USER
valueFrom:
secretKeyRef:
name: minikube-ssh-key
key: MINIKUBE_USER
- name: MINIKUBE_SSH_KEY
valueFrom:
secretKeyRef:
name: minikube-ssh-key
key: MINIKUBE_SSH_KEY
- name: MINIKUBE_ROOTDIR
valueFrom:
secretKeyRef:
name: minikube-ssh-key
key: MINIKUBE_ROOTDIR
script: set -e && dnf install -y git go jq make openssh-clients python3 && ./ci/konflux_minikube_e2e_tests.sh
volumes:
# New volume to store a copy of the source code accessible only to this Task.
- name: workdir
emptyDir: {}
- name: build-image-index
params:
- name: IMAGE
Expand All @@ -248,7 +341,8 @@ spec:
value:
- $(tasks.build-container.results.IMAGE_URL)@$(tasks.build-container.results.IMAGE_DIGEST)
runAfter:
- build-container
- run-unit-tests
- run-e2e-tests
taskRef:
params:
- name: name
Expand Down
91 changes: 89 additions & 2 deletions .tekton/clowder-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ spec:
description: Path to a file with build arguments for buildah, see https://www.mankier.com/1/buildah-build#--build-arg-file
name: build-args-file
type: string
- name: minikube-ssh-key
description: Minikube information.
default: minikube-ssh-key
results:
- description: ""
name: IMAGE_URL
Expand Down Expand Up @@ -231,6 +234,89 @@ spec:
operator: in
values:
- "true"
- name: run-unit-tests
params:
# New parameter to use the Trusted Artifact from the git-clone Task.
- name: SOURCE_ARTIFACT
value: $(tasks.clone-repository.results.SOURCE_ARTIFACT)
runAfter:
- build-container
taskSpec:
params:
- description: The Trusted Artifact URI pointing to the artifact with the application source code.
name: SOURCE_ARTIFACT
type: string
stepTemplate:
volumeMounts:
- mountPath: /var/workdir
name: workdir
steps:
# New step to fetch the Trusted Artifact and make it available to the next steps.
- name: use-trusted-artifact
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:81c4864dae6bb11595f657be887e205262e70086a05ed16ada827fd6391926ac
args:
- use
- $(params.SOURCE_ARTIFACT)=/var/workdir/source
- name: kustomize-build
image: registry.access.redhat.com/ubi8/ubi:latest
workingDir: /var/workdir/source
script: set -xe && dnf install -y go make && make test
volumes:
# New volume to store a copy of the source code accessible only to this Task.
- name: workdir
emptyDir: {}
- name: run-e2e-tests
params:
# New parameter to use the Trusted Artifact from the git-clone Task.
- name: SOURCE_ARTIFACT
value: $(tasks.clone-repository.results.SOURCE_ARTIFACT)
runAfter:
- build-container
taskSpec:
params:
- description: The Trusted Artifact URI pointing to the artifact with the application source code.
name: SOURCE_ARTIFACT
type: string
stepTemplate:
volumeMounts:
- mountPath: /var/workdir
name: workdir
steps:
# New step to fetch the Trusted Artifact and make it available to the next steps.
- name: use-trusted-artifact
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:81c4864dae6bb11595f657be887e205262e70086a05ed16ada827fd6391926ac
args:
- use
- $(params.SOURCE_ARTIFACT)=/var/workdir/source
- name: kustomize-build
image: registry.access.redhat.com/ubi8/ubi:latest
workingDir: /var/workdir/source
env:
- name: MINIKUBE_HOST
valueFrom:
secretKeyRef:
name: minikube-ssh-key
key: MINIKUBE_HOST
- name: MINIKUBE_USER
valueFrom:
secretKeyRef:
name: minikube-ssh-key
key: MINIKUBE_USER
- name: MINIKUBE_SSH_KEY
valueFrom:
secretKeyRef:
name: minikube-ssh-key
key: MINIKUBE_SSH_KEY
- name: MINIKUBE_ROOTDIR
valueFrom:
secretKeyRef:
name: minikube-ssh-key
key: MINIKUBE_ROOTDIR
script: set -e && dnf install -y git go jq make openssh-clients python3 && ./ci/konflux_minikube_e2e_tests.sh
volumes:
# New volume to store a copy of the source code accessible only to this Task.
- name: workdir
emptyDir: {}
- name: build-image-index
params:
- name: IMAGE
Expand All @@ -245,7 +331,8 @@ spec:
value:
- $(tasks.build-container.results.IMAGE_URL)@$(tasks.build-container.results.IMAGE_DIGEST)
runAfter:
- build-container
- run-unit-tests
- run-e2e-tests
taskRef:
params:
- name: name
Expand Down Expand Up @@ -470,4 +557,4 @@ spec:
- name: git-auth
secret:
secretName: '{{ git_auth_secret }}'
status: {}
status: {}
17 changes: 14 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
# Build the manager binary
ARG BASE_IMAGE=
FROM $BASE_IMAGE as builder
FROM registry.access.redhat.com/ubi8/go-toolset:1.21.11-8.1724662611 as builder
USER 0
ENV GOSUMDB=off

WORKDIR /workspace

# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum

# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer

RUN go mod download

COPY Makefile Makefile

COPY hack/boilerplate.go.txt hack/boilerplate.go.txt

# Copy the go source
Expand Down
39 changes: 0 additions & 39 deletions Dockerfile.base

This file was deleted.

Loading

0 comments on commit 7490e46

Please sign in to comment.