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
109 changes: 109 additions & 0 deletions .github/workflows/microshift.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Integration Tests on microshift

permissions:
contents: read
packages: write

on:
push:
branches:
- main
- release-*
pull_request:
branches:
- main
- release-*

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
tekton-results-integration-tests-microshift:
runs-on: ubuntu-24.04
name: Integration Tests on microshift
strategy:
fail-fast: false

env:
SHELL: /bin/bash
GOPATH: ${{ github.workspace }}
GO111MODULE: on
KO_DOCKER_REPO: ko.local
CLUSTER_DOMAIN: ${{ github.run_id }}.local
ARTIFACTS: ${{ github.workspace }}/artifacts
SKIP_SETUP: true
DOCKER_HOST: tcp://localhost:24816
SKIP_KIND: true
SKIP_PORT_FORWARD: false

steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: ${{ github.workspace }}/src/github.com/tektoncd/results

- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
cache-dependency-path: "${{ github.workspace }}/src/github.com/tektoncd/results/go.sum"
go-version-file: "${{ github.workspace }}/src/github.com/tektoncd/results/go.mod"

- name: Install dependencies
working-directory: ./
run: |
echo '::group::install ko'
curl -L https://github.com/ko-build/ko/releases/download/v0.15.4/ko_0.15.4_Linux_x86_64.tar.gz | tar xzf - ko
echo '::group:: install go-junit-report'
go install github.com/jstemmer/go-junit-report@v0.9.1
echo '::endgroup::'
chmod +x ./ko
sudo mv ko /usr/local/bin
echo '::endgroup::'

echo '::group::create required folders'
mkdir -p "${ARTIFACTS}"
echo '::endgroup::'

echo "${GOPATH}/bin" >> "$GITHUB_PATH"

- name: Run tests
working-directory: ${{ github.workspace }}/src/github.com/tektoncd/results
run: |
echo -e "\n************************ Install openshift client ************************\n"
wget https://github.com/okd-project/okd/releases/download/4.19.0-okd-scos.6/openshift-client-linux-amd64-rhel9-4.19.0-okd-scos.6.tar.gz
tar -xzvf openshift-client-linux-amd64-rhel9-4.19.0-okd-scos.6.tar.gz
export PATH=${PATH}:${PWD}

echo -e "\n************************** Setup Podman **********************************\n"
sudo podman system service --time=0 tcp://localhost:24816 &
sleep 7

echo -e "\ntest the podman tcp connection\n"
curl http://localhost:24816/_ping

echo -e "\n************************ Setup Microshift ************************\n"
curl -L -o minc https://github.com/minc-org/minc/releases/latest/download/minc_linux_amd64
chmod +x minc
./minc create --log-level debug
rm ./minc

export KUBECONFIG=$HOME/.kube/config

kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.31/deploy/local-path-storage.yaml
./oc adm policy add-scc-to-user hostmount-anyuid -z local-path-provisioner-service-account -n local-path-storage
kubectl patch storageclass local-path -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
curl https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml | yq 'del(.spec.template.spec.containers[]?.securityContext.runAsUser, .spec.template.spec.containers[]?.securityContext.runAsGroup)' > release.yaml
export TEKTON_PIPELINE_CONFIG=$(realpath ./release.yaml)

${{ github.workspace }}/src/github.com/tektoncd/results/test/e2e/e2e.sh

- name: Upload test results
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: ${{ failure() }}
with:
path: ${{ env.ARTIFACTS }}
5 changes: 4 additions & 1 deletion test/e2e/01-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
set -e

export KO_DOCKER_REPO=${KO_DOCKER_REPO:-"kind.local"}
export KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME:-"tekton-results"}
export SA_TOKEN_PATH=${SA_TOKEN_PATH:-"/tmp/tekton-results/tokens"}
export SSL_CERT_PATH=${SSL_CERT_PATH:="/tmp/tekton-results/ssl"}
export KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME:-"tekton-results"}



ROOT="$(git rev-parse --show-toplevel)"

Expand Down Expand Up @@ -90,3 +92,4 @@ echo "Waiting for deployments to be ready..."
kubectl wait pod "tekton-results-postgres-0" --namespace="tekton-pipelines" --for="condition=Ready" --timeout="120s"
kubectl wait deployment "tekton-results-api" --namespace="tekton-pipelines" --for="condition=available" --timeout="120s"
kubectl wait deployment "tekton-results-watcher" --namespace="tekton-pipelines" --for="condition=available" --timeout="120s"
kubectl get events -n tekton-pipelines
2 changes: 1 addition & 1 deletion test/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The e2e tests use environment variables to modify default values, such as the se
path, etc.The scripts set some of the variables, and you can set other variables to run e2e tests manually.

| Environment variable | Description | Default |
|----------------------|-------------------------------------------------------------|---------------------------------------------------------------|
|----------------------|-------------------------------------------------------------|---------------------------------------------------------------|
| API_SERVER_ADDR | The address on which results API server is listening | https://localhost:8080 |
| API_SERVER_NAME | Common Name of the server as defined in the SSL certificate | tekton-results-api-service.tekton-pipelines.svc.cluster.local |
| CERT_FILE_NAME | Name of the certificate file | tekton-results-cert.pem |
Expand Down
44 changes: 33 additions & 11 deletions test/e2e/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,51 @@ set -o pipefail;
set -o nounset;
# debug commands
set -x;

export KO_DOCKER_REPO=${KO_DOCKER_REPO:-"kind.local"}
export KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME:-"tekton-results"}
export SA_TOKEN_PATH=${SA_TOKEN_PATH:-"/tmp/tekton-results/tokens"}
export SSL_CERT_PATH=${SSL_CERT_PATH:="/tmp/tekton-results/ssl"}
Comment thread
khrm marked this conversation as resolved.
export SKIP_SETUP=${SKIP_SETUP:="false"}
export SKIP_PORT_FORWARD=${SKIP_PORT_FORWARD:="true"}
export SKIP_KIND=${SKIP_KIND:="false"}
# cleanup on exit (useful for running locally)
cleanup() {
kind delete cluster || true
if [ "${SKIP_KIND}" != "true" ]; then
kind delete cluster || true
fi
}

trap cleanup EXIT
setup_port_forward() {
if [ "${SKIP_PORT_FORWARD}" != "true" ]; then
pkill -f "tekton-results-api-service.*8080:8080" || true
kubectl port-forward -n tekton-pipelines service/tekton-results-api-service 8080:8080 &
fi
}

main() {
export KO_DOCKER_REPO="kind.local"
export KIND_CLUSTER_NAME="tekton-results"
export SA_TOKEN_PATH=${SA_TOKEN_PATH:-"/tmp/tekton-results/tokens"}
export SSL_CERT_PATH=${SSL_CERT_PATH:="/tmp/tekton-results/ssl"}

trap cleanup EXIT

main() {
REPO="$(git rev-parse --show-toplevel)"

${REPO}/test/e2e/00-setup.sh
if [ "${SKIP_SETUP}" != "true" ]; then
${REPO}/test/e2e/00-setup.sh
fi

if [ "${SKIP_KIND}" == "true" ]; then
unset KIND_CLUSTER_NAME
fi

${REPO}/test/e2e/01-install.sh


setup_port_forward
# Build static binaries; otherwise go test complains.
export CGO_ENABLED=0
kubectl patch configmap tekton-results-config-logging -n tekton-pipelines --type='merge' -p='{ "data": {
"zap-logger-config": "{\n \"level\": \"debug\",\n \"development\": false,\n \"outputPaths\": [\"stdout\"],\n \"errorOutputPaths\": [\"stderr\"],\n \"encoding\": \"json\",\n \"encoderConfig\": {\n \"timeKey\": \"time\",\n \"levelKey\": \"level\",\n \"nameKey\": \"logger\",\n \"callerKey\": \"caller\",\n \"messageKey\": \"msg\",\n \"stacktraceKey\": \"stacktrace\",\n \"lineEnding\": \"\",\n \"levelEncoder\": \"\",\n \"timeEncoder\": \"iso8601\",\n \"durationEncoder\": \"string\",\n \"callerEncoder\": \"\"\n }\n}",
"loglevel.watcher": "debug"}
}'
kubectl get pod $(kubectl get pod -o=name -n tekton-pipelines | grep tekton-results-watcher | sed "s/^.\{4\}//") -n tekton-pipelines -o yaml
go test -v -count=1 --tags=e2e $(go list --tags=e2e ${REPO}/test/e2e/... | grep -v /client)
kubectl logs $(kubectl get pod -o=name -n tekton-pipelines | grep tekton-results-watcher | sed "s/^.\{4\}//") -n tekton-pipelines

Expand All @@ -54,8 +73,11 @@ main() {
kubectl delete pod $(kubectl get pod -o=name -n tekton-pipelines | grep tekton-results-api | sed "s/^.\{4\}//") -n tekton-pipelines
kubectl wait deployment "tekton-results-api" --namespace="tekton-pipelines" --for="condition=available" --timeout="120s"
kubectl delete pod $(kubectl get pod -o=name -n tekton-pipelines | grep tekton-results-watcher | sed "s/^.\{4\}//") -n tekton-pipelines
kubectl wait deployment "tekton-results-watcher" --namespace="tekton-pipelines" --for="condition=available" --timeout="120s"
kubectl wait deployment "tekton-results-watcher" --namespace="tekton-pipelines" --for="condition=available" --timeout="120s"
setup_port_forward
go test -v -count=1 --tags=e2e,gcs $(go list --tags=e2e ${REPO}/test/e2e/... | grep -v /client) -run TestGCSLog
}

echo "start e2e.sh "
Comment thread
khrm marked this conversation as resolved.

main