Skip to content
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
39 changes: 39 additions & 0 deletions .github/workflows/operator_bundle_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Tests Operator Bundle

on: pull_request

jobs:
operatorhub-test:
runs-on: ubuntu-latest
env:
OP_TEST_CONTAINER_OPT: "-i"
steps:
- name: Set up Go env
uses: actions/setup-go@v2
with:
go-version: 1.17.1
- uses: actions/checkout@v2
with:
fetch-depth: 0
path: go/src/github.com/${{ env.REPOSITORY }}
- name: Set $GOPATH
run: |
echo "GOPATH=${{ github.workspace }}/go" >> $GITHUB_ENV
echo "${{ github.workspace }}/go/bin" >> $GITHUB_PATH
shell: bash
- uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Tests bundle
run: |
git config --global user.name "GitHub Actions" && git config --global user.email "[email protected]"
cd go/src/github.com/${{ env.REPOSITORY }}
make lint-prepare bundle-test
shell: bash
- name: Print test logs on failure
if: ${{ failure() }}
run: |
cat /tmp/test.out
echo -e "\n--------------------------------------------------------------------------\n"
cat /tmp/op-test/log.out
shell: bash
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,10 @@ bundle-run-all: ## Run the bundle image in AllNamespace(OPERATOR_NAMESPACE) ins
bundle-clean: ## Clean the bundle image
operator-sdk cleanup istio-workspace-operator -n $(OPERATOR_NAMESPACE)

.PHONY: bundle-test
bundle-test: bundle ## Run the Operator Hub test suite
./scripts/release/operatorhub.sh --dry-run --test

.PHONY: bundle-publish
bundle-publish: ## Open up a PR to the Operator Hub community catalog
./scripts/release/operatorhub.sh
Expand Down
19 changes: 14 additions & 5 deletions scripts/release/operatorhub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ FORK="${FORK:-maistra}"
FORK_REPO_URL="${FORK_REPO_URL:-https://${GIT_USER}:${GITHUB_TOKEN}@github.com/${FORK}/community-operators.git}"

OPERATOR_NAME=istio-workspace-operator
OPERATOR_VERSION=${OPERATOR_VERSION:-0.0.5}
OPERATOR_VERSION=${OPERATOR_VERSION:-0.3.0}
OPERATOR_HUB=${OPERATOR_HUB:-community-operators}

BRANCH=${BRANCH:-"${OPERATOR_HUB}/${OPERATOR_NAME}-${OPERATOR_VERSION}"}
Expand All @@ -87,17 +87,26 @@ git checkout -b "${BRANCH}"
mkdir -p "${OPERATOR_HUB}/${OPERATOR_NAME}/${OPERATOR_VERSION}"/
cp -a "${CUR_DIR}"/../../bundle/. "${OPERATOR_HUB}/${OPERATOR_NAME}/${OPERATOR_VERSION}"/

git add .
git commit -s -S -m"${TITLE}"
skipInDryRun git add .
skipInDryRun git commit -s -S -m"${TITLE}"

if [[ $runTests -ne 0 ]]; then
echo "Running tests: $tests"

cd "${TMP_DIR}"

bash <(curl -sL https://cutt.ly/WhkV76k) \
## can be removed after https://github.com/redhat-openshift-ecosystem/operator-test-playbooks/pull/244 is merged
export OP_TEST_ANSIBLE_PULL_REPO="https://github.com/redhat-openshift-ecosystem/operator-test-playbooks"

bash <(curl -sL https://cutt.ly/AEeucaw) \
"$tests" \
"${OPERATOR_HUB}/${OPERATOR_NAME}/${OPERATOR_VERSION}"
"${OPERATOR_HUB}/${OPERATOR_NAME}/${OPERATOR_VERSION}" > /tmp/test.out

## Until the script is fixed https://github.com/redhat-openshift-ecosystem/operator-test-playbooks/pull/247
if tail -n 4 /tmp/test.out | grep "Failed with rc";
then
exit 1;
fi # "Failed" was found in the logs
fi

if [[ ! $dryRun && -z $GITHUB_TOKEN ]]; then
Expand Down