Update Konflux references #9031
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Validate | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'release-*' | |
tags: | |
- 'v*.*.*' | |
pull_request: | |
branches: | |
- 'main' | |
- 'release-*' | |
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: openshift-knative/hack/actions/setup-go@main | |
- name: Install CLI tools from OpenShift Mirror | |
uses: redhat-actions/openshift-tools-installer@v1 | |
with: | |
# Installs the latest release of oc with the major version 4. | |
oc: "4" | |
- name: Install yq | |
run: | | |
go install github.com/mikefarah/yq/v3@latest | |
- name: Install OPM | |
run: | | |
go install github.com/operator-framework/operator-registry/cmd/[email protected] | |
- name: Checkout | |
uses: actions/checkout@v4 | |
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 | |
working-directory: ./src/github.com/${{ github.repository }} | |
if: (github.event_name == 'pull_request' && github.base_ref != 'main') || ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref_name != 'main') | |
run: | | |
tag="release-$(yq read ./olm-catalog/serverless-operator/project.yaml 'project.version')" | |
echo "CURRENT_VERSION_IMAGES=${tag}" >> $GITHUB_ENV | |
shell: bash | |
- name: Regenerate all generated files | |
working-directory: ./src/github.com/${{ github.repository }} | |
run: make generated-files | |
# Generate catalog only if not triggered by a pull request. Credentials are not available in pre-submit phase. | |
- name: Regenerate file-based catalog | |
if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || ( github.event_name == 'push' && !contains(github.ref_name, 'dependabot/') ) | |
working-directory: ./src/github.com/${{ github.repository }} | |
env: | |
REGISTRY_REDHAT_IO_USERNAME: ${{ secrets.REGISTRY_REDHAT_IO_USERNAME }} | |
REGISTRY_REDHAT_IO_PASSWORD: ${{ secrets.REGISTRY_REDHAT_IO_PASSWORD }} | |
run: make generate-catalog | |
# 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' || ( github.event_name == 'push' && !contains(github.ref_name, 'dependabot/') ) | |
uses: peter-evans/create-pull-request@v7 | |
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: ./hack/verify-diff.sh | |
- 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 [[ "$(GOFLAGS='' go run github.com/mikefarah/yq/v3@latest read "$csv" spec.replaces)" == "" || \ | |
"$(GOFLAGS='' go run github.com/mikefarah/yq/v3@latest 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: openshift-knative/hack/actions/setup-go@main | |
- name: Checkout | |
uses: actions/checkout@v4 | |
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@v6 | |
with: | |
version: v1.61.0 | |
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 |