Skip to content

Commit b03f873

Browse files
fix(operatorhub): uses ansible test scripts from new repo (#910)
Co-authored-by: Aslak Knutsen <[email protected]> Fixes #890
1 parent cc42619 commit b03f873

File tree

3 files changed

+57
-5
lines changed

3 files changed

+57
-5
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Tests Operator Bundle
2+
3+
on: pull_request
4+
5+
jobs:
6+
operatorhub-test:
7+
runs-on: ubuntu-latest
8+
env:
9+
OP_TEST_CONTAINER_OPT: "-i"
10+
steps:
11+
- name: Set up Go env
12+
uses: actions/setup-go@v2
13+
with:
14+
go-version: 1.17.1
15+
- uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0
18+
path: go/src/github.com/${{ env.REPOSITORY }}
19+
- name: Set $GOPATH
20+
run: |
21+
echo "GOPATH=${{ github.workspace }}/go" >> $GITHUB_ENV
22+
echo "${{ github.workspace }}/go/bin" >> $GITHUB_PATH
23+
shell: bash
24+
- uses: actions/setup-python@v2
25+
with:
26+
python-version: 3.7
27+
- name: Tests bundle
28+
run: |
29+
git config --global user.name "GitHub Actions" && git config --global user.email "[email protected]"
30+
cd go/src/github.com/${{ env.REPOSITORY }}
31+
make lint-prepare bundle-test
32+
shell: bash
33+
- name: Print test logs on failure
34+
if: ${{ failure() }}
35+
run: |
36+
cat /tmp/test.out
37+
echo -e "\n--------------------------------------------------------------------------\n"
38+
cat /tmp/op-test/log.out
39+
shell: bash

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,10 @@ bundle-run-all: ## Run the bundle image in AllNamespace(OPERATOR_NAMESPACE) ins
421421
bundle-clean: ## Clean the bundle image
422422
operator-sdk cleanup istio-workspace-operator -n $(OPERATOR_NAMESPACE)
423423

424+
.PHONY: bundle-test
425+
bundle-test: bundle ## Run the Operator Hub test suite
426+
./scripts/release/operatorhub.sh --dry-run --test
427+
424428
.PHONY: bundle-publish
425429
bundle-publish: ## Open up a PR to the Operator Hub community catalog
426430
./scripts/release/operatorhub.sh

scripts/release/operatorhub.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ FORK="${FORK:-maistra}"
6464
FORK_REPO_URL="${FORK_REPO_URL:-https://${GIT_USER}:${GITHUB_TOKEN}@github.com/${FORK}/community-operators.git}"
6565

6666
OPERATOR_NAME=istio-workspace-operator
67-
OPERATOR_VERSION=${OPERATOR_VERSION:-0.0.5}
67+
OPERATOR_VERSION=${OPERATOR_VERSION:-0.3.0}
6868
OPERATOR_HUB=${OPERATOR_HUB:-community-operators}
6969

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

90-
git add .
91-
git commit -s -S -m"${TITLE}"
90+
skipInDryRun git add .
91+
skipInDryRun git commit -s -S -m"${TITLE}"
9292

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

9696
cd "${TMP_DIR}"
9797

98-
bash <(curl -sL https://cutt.ly/WhkV76k) \
98+
## can be removed after https://github.com/redhat-openshift-ecosystem/operator-test-playbooks/pull/244 is merged
99+
export OP_TEST_ANSIBLE_PULL_REPO="https://github.com/redhat-openshift-ecosystem/operator-test-playbooks"
100+
101+
bash <(curl -sL https://cutt.ly/AEeucaw) \
99102
"$tests" \
100-
"${OPERATOR_HUB}/${OPERATOR_NAME}/${OPERATOR_VERSION}"
103+
"${OPERATOR_HUB}/${OPERATOR_NAME}/${OPERATOR_VERSION}" > /tmp/test.out
104+
105+
## Until the script is fixed https://github.com/redhat-openshift-ecosystem/operator-test-playbooks/pull/247
106+
if tail -n 4 /tmp/test.out | grep "Failed with rc";
107+
then
108+
exit 1;
109+
fi # "Failed" was found in the logs
101110
fi
102111

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

0 commit comments

Comments
 (0)