Skip to content

Commit

Permalink
Merge branch 'main' into test_ci
Browse files Browse the repository at this point in the history
  • Loading branch information
xinredhat authored Oct 10, 2024
2 parents f1870d2 + ee29b42 commit 3e4f144
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 56 deletions.
44 changes: 5 additions & 39 deletions integration-tests/scripts/rhtap-e2e-runner.sh
Original file line number Diff line number Diff line change
@@ -1,33 +1,10 @@
#!/bin/sh

set -e

#JOB_SPEC env:
# {
# "container_image": "quay.io/rhtap/rhtap-cli@sha256:d2c1a65eda860ff667b30bffde2ec325c1ea7375ae2a68d4defd7aedbd0effdf",
# "konflux_component": "rhtap-cli",
# "git": {
# "pull_request_number": 195,
# "pull_request_author": "flacatus",
# "git_org": "redhat-appstudio",
# "git_repo": "rhtap-cli",
# "commit_sha": "ff9aacf8c902f1d6a5004e258522771d48f2b629",
# "event_type": "pull_request",
# "source_repo_url": "https://github.com/flacatus/rhtap-cli",
# "source_repo_branch": "fix_pr"
# }
# }
# Check if the JOB_SPEC environment variable is set.
if [ -z "${JOB_SPEC}" ]; then
echo "Error: JOB_SPEC environment variable must be set."
exit 1
fi
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail

# Important variables to start tests
export ARTIFACT_DIR="${ARTIFACT_DIR:-$(mktemp -d)}"
export GIT_REPO="${GIT_REPO:-$(echo "$JOB_SPEC" | jq -r '.git.git_repo')}"
export GIT_REVISION="${GIT_REVISION:-$(echo "$JOB_SPEC" | jq -r '.git.commit_sha')}"
export GIT_URL="${GIT_URL:-$(echo "$JOB_SPEC" | jq -r '.git.source_repo_url')}"

# Load secrets from files
export GITLAB_TOKEN="$(cat /usr/local/rhtap-cli-install/gitlab_token)"
Expand All @@ -38,7 +15,7 @@ export OCI_STORAGE_USERNAME="$(jq -r '."quay-username"' /usr/local/konflux-test-
export APPLICATION_ROOT_NAMESPACE="rhtap-app"
export GITHUB_ORGANIZATION="rhtap-rhdh-qe"
export GITLAB_ORGANIZATION="rhtap-qe"
export QUAY_IMAGE_ORG="rhtap"
export QUAY_IMAGE_ORG="rhtap_qe"
export IMAGE_REGISTRY="$(kubectl -n rhtap-quay get route rhtap-quay-quay -o 'jsonpath={.spec.host}')"
export OCI_CONTAINER="${OCI_CONTAINER:-""}"
export RED_HAT_DEVELOPER_HUB_URL="https://$(kubectl get route backstage-developer-hub -n rhtap -o jsonpath='{.spec.host}')"
Expand Down Expand Up @@ -75,15 +52,4 @@ post_actions() {

trap post_actions EXIT

cd "$(mktemp -d)"

if [[ "${GIT_REPO}" = "rhtap-e2e" ]]; then
echo -e "INFO: Cloning repository '$GIT_REPO' with revision '$GIT_REVISION' from URL '$GIT_URL'"
git clone "${GIT_URL}" .
git checkout "${GIT_REVISION}"
else
echo -e "INFO: Cloning repository 'redhat-appstudio/rhtap-e2e' with revision 'main'"
git clone https://github.com/redhat-appstudio/rhtap-e2e.git .
fi

yarn && yarn test tests/gpts/github/quarkus.tekton.test.ts
26 changes: 9 additions & 17 deletions integration-tests/tasks/rhtap-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,16 @@ spec:
fi
if [ "$GIT_REPO" = "rhtap-e2e" ]; then
export SOURCE_REPO_URL="$(echo "$JOB_SPEC" | jq -r '.git.source_repo_url')"
export SOURCE_REPO_BRANCH="$(echo "$JOB_SPEC" | jq -r '.git.source_repo_branch')"
GIT_REVISION="${GIT_REVISION:-$(echo "$JOB_SPEC" | jq -r '.git.commit_sha')}"
GIT_URL="${GIT_URL:-$(echo "$JOB_SPEC" | jq -r '.git.source_repo_url')}"
echo "[INFO] SOURCE_REPO_URL is set to $SOURCE_REPO_URL"
echo "[INFO] SOURCE_REPO_BRANCH is set to $SOURCE_REPO_BRANCH"
echo -e "INFO: Cloning repository '$GIT_REPO' with revision '$GIT_REVISION' from URL '$GIT_URL'"
git clone "${GIT_URL}" .
git checkout "${GIT_REVISION}"
if [ -z "$SOURCE_REPO_URL" ] || [ -z "$SOURCE_REPO_BRANCH" ]; then
echo "[ERROR] SOURCE_REPO_URL or SOURCE_REPO_BRANCH is not set"
exit 1
fi
echo -e "[INFO] Running e2e tests from source: $SOURCE_REPO_URL and branch $SOURCE_REPO_BRANCH"
curl -fsSL https://raw.githubusercontent.com/$SOURCE_REPO_URL/$SOURCE_REPO_BRANCH/integration-tests/scripts/rhtap-e2e-runner.sh -o rhtap-e2e-runner.sh
chmod +x rhtap-e2e-runner.sh
./rhtap-e2e-runner.sh
./integration-tests/scripts/rhtap-e2e-runner.sh
else
echo -e "[INFO] Running e2e tests from: redhat-appstudio/rhtap-e2e and branch main"
curl -fsSL https://raw.githubusercontent.com/redhat-appstudio/rhtap-e2e/main/integration-tests/scripts/rhtap-e2e-runner.sh -o rhtap-e2e-runner.sh
chmod +x rhtap-e2e-runner.sh
./rhtap-e2e-runner.sh
echo -e "INFO: Cloning repository 'redhat-appstudio/rhtap-e2e' with revision 'main'"
git clone https://github.com/redhat-appstudio/rhtap-e2e.git .
./integration-tests/scripts/rhtap-e2e-runner.sh
fi

0 comments on commit 3e4f144

Please sign in to comment.