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

tests are all good now & release changes #26

Merged
merged 2 commits into from
Mar 21, 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
2 changes: 1 addition & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: task-git
version: 0.2.0
version: 0.3.0
description: |
This Task represents Git and is able to initialize and clone a remote
repository on the informed Workspace. It's likely to become the first `step`
Expand Down
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ prepare-release:
hack/release.sh $(RELEASE_DIR)

.PHONY: release
release: prepare-release
release: ${CATALOGCD} prepare-release
pushd ${RELEASE_DIR} && \
$(CATALOGCD) release \
--output release \
Expand Down Expand Up @@ -97,6 +97,14 @@ test-integration:
test-e2e: install
$(BATS_CORE) $(BATS_FLAGS) $(ARGS) $(E2E_TESTS)

.PHONY: test-e2e-git-clone
test-e2e-git-clone: E2E_TESTS=./test/e2e/*clone.bats
test-e2e-git-clone: test-e2e

.PHONY: test-e2e-git-cli
test-e2e-git-cli: E2E_TESTS=./test/e2e/*cli.bats
test-e2e-git-cli: test-e2e

# Run all the end-to-end tests against the current openshift context.
# It is used mainly by the CI and ideally shouldn't differ that much from test-e2e
.PHONY: prepare-e2e-openshift
Expand Down
41 changes: 24 additions & 17 deletions hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,32 @@ release() {
[[ ! -d "${RELEASE_DIR}" ]] &&
panic "Release dir is not found '${RELEASE_DIR}'!"

# releasing task-git (it's the only task)
# See task-containers if there is more than one task to support.
declare task_name=task-git
declare task_doc=README.md
declare task_dir="${RELEASE_DIR}/tasks/${task_name}"
[[ ! -d "${task_dir}" ]] &&
mkdir -p "${task_dir}"
# releasing all task templates using the following glob expression
for t in $(ls -1 templates/task-*.yaml); do
declare task_name=$(extract_name ${t})
[[ -z "${task_name}" ]] &&
panic "Unable to extract Task name from '${t}'!"

# rendering the helm template for the specific file, using the resource name for the
# filename respectively
echo "# Rendering '${task_name}' at '${task_dir}'..."
helm template . >${task_dir}/${task_name}.yaml ||
panic "Unable to render '${task_name}'!"
declare task_doc="$(find_doc ${task_name})"
[[ -z "${task_doc}" ]] &&
panic "Unable to find documentation file for '${task_name}'!"

# finds the respective documentation file copying as "README.md", on the same
# directory where the respective task is located
echo "# Copying '${task_name}' documentation file '${task_doc}'..."
cp -v -f ${task_doc} "${task_dir}/README.md" ||
panic "Unable to copy '${task_doc}' into '${task_dir}'"
declare task_dir="${RELEASE_DIR}/tasks/${task_name}"
[[ ! -d "${task_dir}" ]] &&
mkdir -p "${task_dir}"

# rendering the helm template for the specific file, using the resource name for the
# filename respectively
echo "# Rendering '${task_name}' at '${task_dir}'..."
helm template --show-only=${t} . >${task_dir}/${task_name}.yaml ||
panic "Unable to render '${t}'!"

# finds the respective documentation file copying as "README.md", on the same
# directory where the respective task is located
echo "# Copying '${task_name}' documentation file '${task_doc}'..."
cp -v -f ${task_doc} "${task_dir}/README.md" ||
panic "Unable to copy '${task_doc}' into '${task_dir}'"
done
}

release
2 changes: 1 addition & 1 deletion test/e2e/e2e-git-cli.bats
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ source ./test/helper/helper.sh
sleep 30

# assering the taskrun status, making sure all steps have been successful
assert_tekton_resource "taskrun" --regexp $'\S+.\nCOMMIT=6c073b08f7987018cbb2cb9a5747c84913b3608e'
assert_tekton_resource "taskrun" --regexp $'\S+\nCOMMIT=6c073b08f7987018cbb2cb9a5747c84913b3608e'
assert_tekton_resource "pipelinerun" --partial '(Failed: 0, Cancelled 0), Skipped: 0'
}
5 changes: 4 additions & 1 deletion test/e2e/e2e-git-clone.bats
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ source ./test/helper/helper.sh
--showlog >&3
assert_success

# waiting a few seconds before asserting results
sleep 30

#
# Asserting Results
#

assert_tekton_resource "taskrun" --regexp $'\S+.\nCOMMIT=\S+.\nCOMMITTER_DATE=\S+.\nURL=\S+*'
assert_tekton_resource "taskrun" --regexp $'\S+\nCOMMIT=\S+\nCOMMITTER_DATE=\S+\nURL=\S+'
}