From 2fe8e1e3fa92ab31ee6788dfe58abc46b4bd1135 Mon Sep 17 00:00:00 2001 From: Lucas Yoon Date: Wed, 23 Jul 2025 15:26:11 -0400 Subject: [PATCH 1/3] adding renovate and test scripts #1718 Signed-off-by: Lucas Yoon --- .github/workflows/ci.yaml | 42 +++++++++ .github/workflows/validate-with-registry.yaml | 89 +++++++++++++++++++ devfile.yaml | 2 +- renovate.json | 16 ++++ 4 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/validate-with-registry.yaml create mode 100644 renovate.json diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000000..c0c60f577f --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,42 @@ +# This workflow will install Python dependencies, run tests and lint with Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python application + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest || [ $? -eq 5 ] diff --git a/.github/workflows/validate-with-registry.yaml b/.github/workflows/validate-with-registry.yaml new file mode 100644 index 0000000000..b74c31bb65 --- /dev/null +++ b/.github/workflows/validate-with-registry.yaml @@ -0,0 +1,89 @@ +name: Validate with Devfile Registry Tests + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + +env: + MINIKUBE_VERSION: 'v1.29.0' + MINIKUBE_RESOURCES: '--memory 14gb --cpus 4' + KUBERNETES_VERSION: 'v1.25.2' + TEST_DELTA: false + REGISTRY_PATH: ${{ github.workspace }}/registry + GO_VERSION: '1.23' + GINKGO_VERSION: v2.19.0 + YQ_VERSION: v4.44.1 + ODOV3_VERSION: '3.16.1' + +jobs: + validate-devfile-schema: + name: validate devfile schemas + runs-on: ubuntu-latest + steps: + - name: Checkout current repo + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + path: current-repo + + - name: Checkout devfile registry + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: devfile/registry + path: ${{ env.REGISTRY_PATH }} + + - name: Setup Go + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Install yq + run: | + curl -sL -O https://github.com/mikefarah/yq/releases/download/${{ env.YQ_VERSION }}/yq_linux_amd64 -o /usr/local/bin/yq && mv ./yq_linux_amd64 /usr/local/bin/yq && chmod +x /usr/local/bin/yq + + - name: Install Ginkgo + run: go install github.com/onsi/ginkgo/v2/ginkgo@${{ env.GINKGO_VERSION }} + + - name: Validate sample + run: (cd ${{ env.REGISTRY_PATH }} && bash tests/validate_devfile_schemas.sh --stacksPath ${{ github.workspace }} --stackDirs current-repo) + + non-terminating: + name: check for non-terminating images + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + path: current-repo + fetch-depth: 0 + + - name: Checkout devfile registry + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: devfile/registry + path: ${{ env.REGISTRY_PATH }} + + - name: Setup Go + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Setup Minikube + uses: manusa/actions-setup-minikube@0e8062ceff873bd77979f39cf8fd3621416afe4d # v2.13.0 + with: + minikube version: ${{ env.MINIKUBE_VERSION }} + kubernetes version: ${{ env.KUBERNETES_VERSION }} + driver: "docker" + github token: ${{ secrets.GITHUB_TOKEN }} + start args: "--addons=ingress ${{ env.MINIKUBE_RESOURCES }}" + + - name: Check that containers components are non terminating + run: | + go build -C ${{ env.REGISTRY_PATH }}/tests/check_non_terminating -o flatten-parent + (cd ${{ env.REGISTRY_PATH }} && bash ${{ env.REGISTRY_PATH }}/tests/check_non_terminating.sh --stacksPath ${{ github.workspace }} --stackDirs current-repo) diff --git a/devfile.yaml b/devfile.yaml index 8a6eada547..868c62dfd5 100644 --- a/devfile.yaml +++ b/devfile.yaml @@ -8,7 +8,7 @@ metadata: 'Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together.' language: Python - version: 1.0.1 + # version: 1.0.1 provider: Red Hat tags: - Python diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000000..8bd25dc88b --- /dev/null +++ b/renovate.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": ["local>devfile-samples/.github:renovate-config"], + "enabledManagers": ["pip_requirements", "dockerfile"], + "pip_requirements": { + "fileMatch": ["requirements\\.txt$"] + }, + "packageRules": [ + { + "matchManagers": ["pip_requirements"], + "groupName": "python dependencies", + "groupSlug": "python-deps", + "commitMessageTopic": "Python {{depName}}" + } + ] +} From 3ab30f370ecccca8737014e89a669783a54efd16 Mon Sep 17 00:00:00 2001 From: Lucas Yoon Date: Fri, 25 Jul 2025 10:37:20 -0400 Subject: [PATCH 2/3] uncomment version: 1.0.1 devfile.yaml Signed-off-by: Lucas Yoon --- devfile.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devfile.yaml b/devfile.yaml index 868c62dfd5..8a6eada547 100644 --- a/devfile.yaml +++ b/devfile.yaml @@ -8,7 +8,7 @@ metadata: 'Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together.' language: Python - # version: 1.0.1 + version: 1.0.1 provider: Red Hat tags: - Python From 322b7f7f33d3533fa5ea9dc3527504d78bed21a0 Mon Sep 17 00:00:00 2001 From: Lucas Yoon <94267691+JslYoon@users.noreply.github.com> Date: Mon, 28 Jul 2025 10:08:15 -0400 Subject: [PATCH 3/3] Update .github/workflows/validate-with-registry.yaml Co-authored-by: Michael Valdron --- .github/workflows/validate-with-registry.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/validate-with-registry.yaml b/.github/workflows/validate-with-registry.yaml index b74c31bb65..f286c8e9d8 100644 --- a/.github/workflows/validate-with-registry.yaml +++ b/.github/workflows/validate-with-registry.yaml @@ -20,7 +20,6 @@ env: GO_VERSION: '1.23' GINKGO_VERSION: v2.19.0 YQ_VERSION: v4.44.1 - ODOV3_VERSION: '3.16.1' jobs: validate-devfile-schema: