Skip to content

Commit

Permalink
migrate clowder to using konflux
Browse files Browse the repository at this point in the history
---------

Signed-off-by: red-hat-konflux <126015336+red-hat-konflux[bot]@users.noreply.github.com>
Co-authored-by: Matt Knop <[email protected]>
Co-authored-by: red-hat-konflux <[email protected]>
Co-authored-by: red-hat-konflux[bot] <126015336+red-hat-konflux[bot]@users.noreply.github.com>

add secret definition

Update Konflux references (#1058)

* adding new e2e testing script

* Red Hat Konflux update clowder
Signed-off-by: red-hat-konflux <[email protected]>

* single dockerfile

* adding pre-fetch deps for cachi2 support

* reorder controller-gen install code

* comment additional attempt to install controller-gen/kustomize

* pre-fetch from another go.mod file

* fixing syntax

* fixing syntax

* fixing syntax

* trying changed to path

* fixing value for prefetch-input var

* remove install of controller-gen and kustomize

* fixing value for prefetch-input var

* enable hermetic builds, fix dockerfile commands

* enable hermetic builds on push

* separating deps

* updates

* fixing paths in tekton file

* update

* remove comments

* adding unit test step

* removing output workspace

* change path to clowder

* checking files/dirs

* run after clone repo

* adding workspace

* remove workspace

* checking if dir exists

* removing syntax issue

* looking at dir contents

* checking file contents for dirs

* adding workspace

* removing ls

* kicking off build

* check dir contents

* adding workspace definition

* changing workspace name

* removing workspace from on push, fixing workspace on pull

* attempting workspace again

* fixing workspace name

* idk

* Update Konflux references

Signed-off-by: red-hat-konflux <126015336+red-hat-konflux[bot]@users.noreply.github.com>

---------

Signed-off-by: red-hat-konflux <126015336+red-hat-konflux[bot]@users.noreply.github.com>
Co-authored-by: Matt Knop <[email protected]>
Co-authored-by: red-hat-konflux <[email protected]>
Co-authored-by: red-hat-konflux[bot] <126015336+red-hat-konflux[bot]@users.noreply.github.com>

make script executable, remove old scripts

remove comment

force new build

adding scripts back

updating image in deploy yaml
  • Loading branch information
maknop committed Oct 28, 2024
1 parent 6c93a05 commit c20d018
Show file tree
Hide file tree
Showing 14 changed files with 2,248 additions and 126 deletions.
543 changes: 543 additions & 0 deletions .tekton/clowder-pull-request.yaml

Large diffs are not rendered by default.

540 changes: 540 additions & 0 deletions .tekton/clowder-push.yaml

Large diffs are not rendered by default.

44 changes: 42 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,46 @@
FROM registry.access.redhat.com/ubi8/go-toolset:1.21.11-8.1724662611 as builder
USER 0
#RUN dnf install -y openssh-clients git make which jq python3
ENV GOSUMDB=off

COPY ci/minikube_e2e_tests_inner.sh .
RUN chmod 775 minikube_e2e_tests_inner.sh

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

# RUN make controller-gen kustomize

# RUN GO111MODULE=on go install sigs.k8s.io/controller-tools/cmd/[email protected] \
# && GO111MODULE=on go install sigs.k8s.io/kustomize/kustomize/[email protected]

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

COPY main.go main.go
COPY config/ config/
COPY apis/ apis/
COPY controllers/ controllers/

RUN make manifests generate fmt vet release

RUN rm main.go
RUN rm -rf config
RUN rm -rf apis
RUN rm -rf controllers

# Build the manager binary
ARG BASE_IMAGE=
FROM $BASE_IMAGE as builder
#ARG BASE_IMAGE=
#FROM $BASE_IMAGE as builder

WORKDIR /workspace

Expand Down
116 changes: 0 additions & 116 deletions Jenkinsfile

This file was deleted.

7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
#
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
# cloud.redhat.com/clowder-bundle:$VERSION and cloud.redhat.com/clowder-catalog:$VERSION.
IMAGE_TAG_BASE ?= quay.io/cloudservices/clowder
CLOWDER_BUILD_TAG ?= $(shell git rev-parse --short=8 HEAD)
IMAGE_TAG_BASE ?= quay.io/redhat-user-workloads/hcm-eng-prod-tenant/clowder/clowder
CLOWDER_BUILD_TAG ?= $(shell git rev-parse HEAD)
# CLOWDER_BUILD_TAG ?= $(shell git rev-parse --short=8 HEAD)

GO_CMD ?= go

Expand All @@ -15,7 +16,7 @@ ENVTEST_K8S_VERSION = 1.28
ifeq ($(findstring -minikube,${MAKECMDGOALS}), -minikube)
IMG ?= 127.0.0.1:5000/clowder:$(CLOWDER_BUILD_TAG)
else
IMG ?= quay.io/cloudservices/clowder:$(CLOWDER_BUILD_TAG)
IMG ?= quay.io/redhat-user-workloads/hcm-eng-prod-tenant/clowder/clowder:$(CLOWDER_BUILD_TAG)
endif

CLOWDER_VERSION ?= $(shell git describe --tags)
Expand Down
135 changes: 135 additions & 0 deletions ci/konflux_minikube_e2e_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
#!/bin/bash

set -exv

mkdir -p /container_workspace/bin

# cp /opt/app-root/src/go/bin/* /container_workspace/bin

export KUBEBUILDER_ASSETS=/container_workspace/testbin/bin

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256) ./kubectl" | sha256sum --check
chmod +x kubectl
mv kubectl /container_workspace/bin
export PATH="/container_workspace/bin:$PATH"

(
cd "$(mktemp -d)" &&
OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
KREW="krew-${OS}_${ARCH}" &&
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
tar zxvf "${KREW}.tar.gz" &&
./"${KREW}" install krew
)

source build/template_check.sh
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"

export PATH="/bins:$PATH"

set +x

echo "$MINIKUBE_SSH_KEY" > minikube-ssh-ident

chmod 600 minikube-ssh-ident

ssh -o StrictHostKeyChecking=no $MINIKUBE_USER@$MINIKUBE_HOST -i minikube-ssh-ident "minikube delete"
ssh -o StrictHostKeyChecking=no $MINIKUBE_USER@$MINIKUBE_HOST -i minikube-ssh-ident "minikube start --cpus 6 --disk-size 10GB --memory 16000MB --kubernetes-version=1.26.3 --addons=metrics-server --disable-optimizations"

export MINIKUBE_IP=`ssh -o StrictHostKeyChecking=no $MINIKUBE_USER@$MINIKUBE_HOST -i minikube-ssh-ident "minikube ip"`

set -x

scp -o StrictHostKeyChecking=no -i minikube-ssh-ident $MINIKUBE_USER@$MINIKUBE_HOST:$MINIKUBE_ROOTDIR/.minikube/profiles/minikube/client.key ./
scp -i minikube-ssh-ident $MINIKUBE_USER@$MINIKUBE_HOST:$MINIKUBE_ROOTDIR/.minikube/profiles/minikube/client.crt ./
scp -i minikube-ssh-ident $MINIKUBE_USER@$MINIKUBE_HOST:$MINIKUBE_ROOTDIR/.minikube/ca.crt ./

ssh -o ExitOnForwardFailure=yes -f -N -L 127.0.0.1:8444:$MINIKUBE_IP:8443 -i minikube-ssh-ident $MINIKUBE_USER@$MINIKUBE_HOST

cat > kube-config <<- EOM
apiVersion: v1
clusters:
- cluster:
certificate-authority: $PWD/ca.crt
server: https://127.0.0.1:8444
name: 127-0-0-1:8444
contexts:
- context:
cluster: 127-0-0-1:8444
user: remote-minikube
name: remote-minikube
users:
- name: remote-minikube
user:
client-certificate: $PWD/client.crt
client-key: $PWD/client.key
current-context: remote-minikube
kind: Config
preferences: {}
EOM

export PATH="$KUBEBUILDER_ASSETS:$PATH"
export PATH="/root/go/bin:$PATH"

export KUBECONFIG=$PWD/kube-config
export KUBECTL_CMD="kubectl "
$KUBECTL_CMD config use-context remote-minikube
$KUBECTL_CMD get pods --all-namespaces=true

source build/kube_setup.sh

export IMAGE_TAG=`git rev-parse --short=8 HEAD`

$KUBECTL_CMD create namespace clowder-system

mkdir artifacts

make release

cat manifest.yaml > artifacts/manifest.yaml

sed -i "s/clowder:latest/clowder:$IMAGE_TAG/g" manifest.yaml

$KUBECTL_CMD apply -f manifest.yaml --validate=false -n clowder-system

## The default generated config isn't quite right for our tests - so we'll create a new one and restart clowder
$KUBECTL_CMD apply -f clowder-config.yaml -n clowder-system
$KUBECTL_CMD delete pod -n clowder-system -l operator-name=clowder

# Wait for operator deployment...
$KUBECTL_CMD rollout status deployment clowder-controller-manager -n clowder-system
$KUBECTL_CMD krew install kuttl

# curl -fsSLO "https://github.com/kudobuilder/kuttl/releases/download/v0.19.0/kubectl-kuttl_0.19.0_linux_x86_64"
# chmod +x kubectl-kuttl_0.19.0_linux_x86_64
# alias kuttl="./kubectl-kuttl_0.19.0_linux_x86_64"

set +e

$KUBECTL_CMD get env

source build/run_kuttl.sh --report xml
KUTTL_RESULT=$?
mv kuttl-report.xml artifacts/junit-kuttl.xml

CLOWDER_PODS=$($KUBECTL_CMD get pod -n clowder-system -o jsonpath='{.items[*].metadata.name}')
for pod in $CLOWDER_PODS; do
$KUBECTL_CMD logs $pod -n clowder-system > artifacts/$pod.log
$KUBECTL_CMD logs $pod -n clowder-system | ./parse-controller-logs > artifacts/$pod-parsed-controller-logs.log
done

# Grab the metrics
$KUBECTL_CMD port-forward svc/clowder-controller-manager-metrics-service-non-auth -n clowder-system 8080 &
sleep 5
curl 127.0.0.1:8080/metrics > artifacts/clowder-metrics

STRIMZI_PODS=$($KUBECTL_CMD get pod -n strimzi -o jsonpath='{.items[*].metadata.name}')
for pod in $STRIMZI_PODS; do
$KUBECTL_CMD logs $pod -n strimzi > artifacts/$pod.log
done
set -e

exit $KUTTL_RESULT
Empty file modified ci/minikube_e2e_tests.sh
100755 → 100644
Empty file.
Empty file modified ci/minikube_e2e_tests_inner.sh
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8703,7 +8703,7 @@ parameters:
- name: IMAGE_TAG
value: latest
- name: IMAGE
value: quay.io/cloudservices/clowder
value: quay.io/redhat-services-prod/hcm-eng-prod-tenant/clowder
- name: DEBUG_TRIGGERS
value: 'false'
- name: DEBUG_CACHE_CREATE
Expand Down
41 changes: 41 additions & 0 deletions deps1/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module example.com/dep1

go 1.21.11

require (
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/evanphx/json-patch v4.11.0+incompatible // indirect
github.com/go-errors/errors v1.0.1 // indirect
github.com/go-openapi/jsonpointer v0.19.3 // indirect
github.com/go-openapi/jsonreference v0.19.3 // indirect
github.com/go-openapi/swag v0.19.5 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/imdario/mergo v0.3.5 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/mailru/easyjson v0.7.0 // indirect
github.com/mattn/go-runewidth v0.0.7 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/olekukonko/tablewriter v0.0.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/cobra v1.2.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.7.0 // indirect
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect
golang.org/x/text v0.3.5 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e // indirect
sigs.k8s.io/kustomize/api v0.11.2 // indirect
sigs.k8s.io/kustomize/cmd/config v0.10.4 // indirect
sigs.k8s.io/kustomize/kustomize/v4 v4.5.2 // indirect
sigs.k8s.io/kustomize/kyaml v0.13.3 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)
Empty file added deps1/go.sum
Empty file.
Loading

0 comments on commit c20d018

Please sign in to comment.