Skip to content

Tests for Multi Tenancy with Service Mesh #6015

Tests for Multi Tenancy with Service Mesh

Tests for Multi Tenancy with Service Mesh #6015

Workflow file for this run

---
name: Validate
on:
push:
branches:
- '**'
tags:
- 'v*.*.*'
pull_request:
branches:
- '**'
schedule:
- cron: "0 6 * * *" # Daily at 06:00.
workflow_dispatch: # Manual workflow trigger
jobs:
generated-files-committed:
name: Generated files are committed
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}
steps:
- name: Setup Golang
uses: actions/setup-go@v4
with:
go-version: 1.20.x
- name: Install prerequisites
env:
YQ_VERSION: 3.4.0
run: |
sudo wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64 -O /usr/bin/yq
sudo chmod +x /usr/bin/yq
sudo mv /usr/bin/yq /usr/local/bin/yq
- name: Checkout
uses: actions/checkout@v3
with:
path: ./src/github.com/${{ github.repository }}
fetch-depth: 0
- name: Merge upstream
if: github.event_name == 'pull_request'
working-directory: ./src/github.com/${{ github.repository }}
run: |
if ! git config user.name > /dev/null; then
git config user.name "John Doe"
fi
if ! git config user.email > /dev/null; then
git config user.email "johndoe@localhost"
fi
git remote add upstream https://github.com/${{ github.repository }}.git
git pull --no-rebase upstream ${{ github.base_ref }}
shell: bash
- name: Set CURRENT_VERSION_IMAGES on push
working-directory: ./src/github.com/${{ github.repository }}
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref_name != 'main' && !contains(github.ref_name, 'dependabot/')
run: |
branch="$(yq read olm-catalog/serverless-operator/project.yaml project.version)" # example output: "1.26.0"
# Add "v", so that the final variable is like "v1.27.0"
echo "CURRENT_VERSION_IMAGES=v${branch}" >> $GITHUB_ENV
shell: bash
- name: Set CURRENT_VERSION_IMAGES on PRs
working-directory: ./src/github.com/${{ github.repository }}
if: github.event_name == 'pull_request' && github.base_ref != 'main'
run: |
branch="$(yq read olm-catalog/serverless-operator/project.yaml project.version)" # example output: "1.26.0"
# Add "v", so that the final variable is like "v1.27.0"
echo "CURRENT_VERSION_IMAGES=v${branch}" >> $GITHUB_ENV
shell: bash
- name: Regenerate all generated files
working-directory: ./src/github.com/${{ github.repository }}
run: make generated-files
# Optional:
# Since we're generating files based on a floating branch in midstream,
# we need to reconcile those files periodically.
#
# when it's manually triggered or a scheduled run.
- name: Create Pull Request
if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule'
uses: peter-evans/create-pull-request@v5
with:
path: ./src/github.com/${{ github.repository }}
branch: auto/update-generated-files-${{ github.ref_name }}
title: "[${{ github.ref_name }}] Run make generated-files"
commit-message: "Run make generated-files"
delete-branch: true
body: |
Generated by running `make generated-files`
- name: Check if everything is consistent
working-directory: ./src/github.com/${{ github.repository }}
run: |
if [ -n "$(git status --porcelain)" ]; then
echo '::debug::Running `git status`'
git -c color.status=always status
echo '::debug::Running `git diff`'
git -c color.ui=always diff
echo '::error::Not all generated files are commited. Run `make generated-files` and commit files.'
echo '::warning::`make generated-files` needs to be run on GOPATH due to https://github.com/knative/pkg/issues/1287'
exit 33
fi
- name: Check existence of skipRange and replaces in ClusterServiceVersion
working-directory: ./src/github.com/${{ github.repository }}
run: |
csv="olm-catalog/serverless-operator/manifests/serverless-operator.clusterserviceversion.yaml"
if [[ "$(yq read "$csv" spec.replaces)" == "" || \
"$(yq read "$csv" 'metadata.annotations."olm.skipRange"')" == "" ]]; then
echo '::error:: Missing spec.replaces or metadata.annotations."olm.skipRange" in CSV.'
exit 34
fi
lint:
name: Lint
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}
steps:
- name: Setup Golang
uses: actions/setup-go@v4
with:
go-version: 1.20.x
- name: Checkout
uses: actions/checkout@v3
with:
path: ./src/github.com/${{ github.repository }}
- name: Install Tools
working-directory: ./src/github.com/${{ github.repository }}
env:
WOKE_VERSION: v0.13.0
OSDK_VERSION: v1.12.0
run: |
TEMP_PATH="$(mktemp -d)"
cd $TEMP_PATH
echo '::group::🐶 Installing reviewdog ... https://github.com/reviewdog/reviewdog'
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b "${TEMP_PATH}" 2>&1
echo '::endgroup::'
echo '::group:: Installing misspell ... https://github.com/client9/misspell'
go install github.com/client9/misspell/cmd/misspell@latest
echo '::endgroup::'
echo '::group:: Installing woke ... https://github.com/get-woke/woke'
curl -sfL https://raw.githubusercontent.com/get-woke/woke/main/install.sh | sh -s -- -b "${TEMP_PATH}" "${WOKE_VERSION}" 2>&1
echo '::endgroup::'
echo '::group:: Installing operator-sdk ... https://github.com/operator-framework/operator-sdk/'
curl -sfL https://github.com/operator-framework/operator-sdk/releases/download/${OSDK_VERSION}/operator-sdk_linux_amd64 -o "${TEMP_PATH}/operator-sdk"
chmod +x "${TEMP_PATH}/operator-sdk"
echo "${TEMP_PATH}" >> $GITHUB_PATH
- name: Shellcheck
working-directory: ./src/github.com/${{ github.repository }}
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
run: |
find . -type f \
-path './**/*.*sh' \
-not -path '*vendor*' | xargs -r shellcheck --format=checkstyle \
| reviewdog -f=checkstyle \
-name="shellcheck" \
-reporter="github-pr-check" \
-filter-mode="added" \
-fail-on-error="true" \
-level="error"
- name: Go Lint - knative-operator
uses: golangci/golangci-lint-action@v3
with:
version: v1.51.2
args: --timeout=10m0s --verbose
working-directory: ./src/github.com/${{ github.repository }}
# This is mostly copied from https://github.com/get-woke/woke-action-reviewdog/blob/main/entrypoint.sh
# since their action is not yet released under a stable version.
- name: Language
if: ${{ always() && github.event_name == 'pull_request' }}
working-directory: ./src/github.com/${{ github.repository }}
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
run: |
woke --output simple \
| reviewdog -efm="%f:%l:%c: %m" \
-name="woke" \
-reporter="github-pr-check" \
-filter-mode="added" \
-fail-on-error="true" \
-level="error"
- name: OLM Bundle
working-directory: ./src/github.com/${{ github.repository }}
run: |
operator-sdk bundle validate ./olm-catalog/serverless-operator --select-optional suite=operatorframework --optional-values=k8s-version=1.22
- name: Spelling
working-directory: ./src/github.com/${{ github.repository }}
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
run: |
# Don't fail because of misspell
set +o pipefail
git ls-files | grep -Ev '^(vendor/|.git)' | xargs misspell -i importas -error \
| reviewdog -efm="%f:%l:%c: %m" \
-name="github.com/client9/misspell" \
-reporter="github-pr-check" \
-filter-mode="added" \
-fail-on-error="true" \
-level="error"
- name: Prettify code
uses: creyD/[email protected]
with:
dry: true
prettier_options: --check src/github.com/${{ github.repository }}/templates/*.yaml