diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c2c33718..2ec67b3e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,5 +1,10 @@ .github/* @tylertitsworth +classical-ml/* @tylertitsworth @jitendra42 @sramakintel @sharvil10 docs/* @tylertitsworth @jitendra42 +enterprise/* @sharvil10 preset/* @ma-pineda @jafraustro +pytorch/* @tylertitsworth @jitendra42 @sramakintel @sharvil10 +tensorflow/* @tylertitsworth @jitendra42 @sramakintel @sharvil10 test-runner/* @tylertitsworth +workflows/* @tylertitsworth * @tylertitsworth @jitendra42 diff --git a/.github/ct.yaml b/.github/ct.yaml new file mode 100644 index 00000000..cc8a17cf --- /dev/null +++ b/.github/ct.yaml @@ -0,0 +1,21 @@ +# Copyright (c) 2024 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# See https://github.com/helm/chart-testing#configuration + +remote: origin +target-branch: main +chart-dirs: + - workflows/charts +helm-extra-args: --timeout 600s diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 7a8fabec..2a17ce7a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -71,42 +71,42 @@ updates: package-ecosystem: pip schedule: interval: weekly - + - directory: /workflows + groups: + helm: + patterns: + - "*" + package-ecosystem: pip + schedule: + interval: weekly - package-ecosystem: docker directory: /classical-ml schedule: interval: weekly - - package-ecosystem: docker directory: /preset/classical-ml schedule: interval: weekly - - package-ecosystem: docker directory: /preset/data-analytics schedule: interval: weekly - - package-ecosystem: docker directory: /preset/deep-learning schedule: interval: weekly - - package-ecosystem: docker directory: /preset/inference-optimization schedule: interval: weekly - - package-ecosystem: docker directory: /python schedule: interval: weekly - - package-ecosystem: docker directory: /pytorch schedule: interval: weekly - - package-ecosystem: docker directory: /tensorflow schedule: diff --git a/.github/workflows/chart-ci.yaml b/.github/workflows/chart-ci.yaml index 996c94e8..a00cfff8 100644 --- a/.github/workflows/chart-ci.yaml +++ b/.github/workflows/chart-ci.yaml @@ -14,10 +14,11 @@ name: Helm Chart CI on: - pull_request: null - # pull_request_target: - # types: [opened, edited, reopened, synchronize] - # branches: [main] + pull_request_target: + types: [opened, edited, reopened, synchronize] + branches: [main] + paths: + - 'workflows/charts/**' merge_group: null permissions: read-all concurrency: @@ -31,11 +32,10 @@ jobs: uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0 with: egress-policy: audit - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: fetch-depth: 0 - # ref: "refs/pull/${{ github.event.number }}/merge" + ref: "refs/pull/${{ github.event.number }}/merge" - uses: azure/setup-kubectl@3e0aec4d80787158d308d7b364cb1b702e7feb7f # v4.0.0 - uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0 - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 @@ -53,7 +53,8 @@ jobs: - name: Helm Lint, Install, and Test if: steps.changed.outputs.changed == 'true' run: | + install -m 0600 ${{ secrets.KUBECONFIG_PATH }} /tmp/config.yaml kubectl config use-context kubeflow ct lint-and-install --target-branch ${{ github.event.repository.default_branch }} --config .github/ct.yaml --debug --namespace helm-ci env: - KUBECONFIG: ${{ secrets.KUBECONFIG_PATH }} + KUBECONFIG: /tmp/config.yaml diff --git a/.github/workflows/scorecard.yaml b/.github/workflows/scorecard.yaml index 364fbe1c..f8505959 100644 --- a/.github/workflows/scorecard.yaml +++ b/.github/workflows/scorecard.yaml @@ -39,7 +39,6 @@ jobs: uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0 with: egress-policy: audit - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: persist-credentials: false diff --git a/.github/workflows/weekly-test.yaml b/.github/workflows/weekly-test.yaml index 5315bcdc..d39bd70e 100644 --- a/.github/workflows/weekly-test.yaml +++ b/.github/workflows/weekly-test.yaml @@ -28,7 +28,6 @@ jobs: uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0 with: egress-policy: audit - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - name: Output Group Directories id: group-list diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5b5b82f9..eb9f3852 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ ci: autofix_prs: true autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate" autoupdate_schedule: "weekly" - skip: [pylint, shellcheck, markdownlint, hadolint-docker, shfmt, tox, mkdocs] + skip: [pylint, shellcheck, markdownlint, hadolint-docker, helm-docs-container, shfmt, tox, mkdocs, ct] repos: - hooks: - id: check-added-large-files @@ -82,4 +82,9 @@ repos: id: mkdocs language: system name: mkdocs + - entry: ct lint --config .github/ct.yaml + files: ^workflows/charts/ + id: ct + language: system + name: ct repo: local diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bfbafbfb..a1d452b2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,7 +16,10 @@ This project follows the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT. 2. Create a new branch for your contribution: `git checkout -b feature/your-feature`. 3. Install [pre-commit](https://pre-commit.com/), [Docker](https://docs.docker.com/engine/install/), and [Python 3.8+](https://www.python.org/downloads/). 4. Follow the [Project Setup](README.md#project-setup) steps. -5. Install the third-party python dependencies necessary for pre-commit with `pip install -r test-runner/dev-requirements.txt && pip install -r docs/requirements.txt`. +5. Install the third-party python dependencies necessary for pre-commit depending on the type of contribution you are making: + 1. If you are contributing to Test Runner, run `pip install -r test-runner/dev-requirements.txt`. + 2. If you are contributing to documentation, run `pip install -r docs/requirements.txt`. (This hook will always run) + 3. If you are contributing to helm charts, run `pip install -r workflows/charts/dev-requirements.txt`. Install [Helm](https://helm.sh/docs/intro/install/) and then [Chart Testing](https://github.com/helm/chart-testing) tool. 6. Make your changes, commit, and sign your changes: `git commit -s -m 'Add your feature'`. 7. Push to the branch: `git push origin feature/your-feature`. 8. Submit a pull request. diff --git a/README.md b/README.md index 7bf2a244..f893ec3b 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,10 @@ [](https://securityscorecards.dev/viewer/?uri=github.com/intel/ai-containers) [](https://app.fossa.com/projects/git%2Bgithub.com%2Fintel%2Fai-containers?ref=badge_shield&issueType=license) [](https://github.com/intel/ai-containers/actions/workflows/github-code-scanning/codeql) +[](https://results.pre-commit.ci/latest/github/intel/ai-containers/main) [](https://github.com/intel/ai-containers/actions/workflows/test-runner-ci.yaml) [](https://github.com/intel/ai-containers/actions/workflows/weekly-test.yaml) -[](https://results.pre-commit.ci/latest/github/intel/ai-containers/main) +[](https://github.com/intel/ai-containers/actions/workflows/chart-ci.yaml) This repository contains Dockerfiles, scripts, yaml files, Helm charts, etc. used to scale out AI containers with versions of TensorFlow and PyTorch that have been optimized for Intel platforms. Scaling is done with python, Docker, kubernetes, kubeflow, cnvrg.io, Helm, and other container orchestration frameworks for use in the cloud and on-premise. diff --git a/python/tests/tests.yaml b/python/tests/tests.yaml index 8bdbf297..5e82b365 100644 --- a/python/tests/tests.yaml +++ b/python/tests/tests.yaml @@ -13,20 +13,20 @@ # limitations under the License. import-${IDP_VERISON:-core}: - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-idp-${IDP_VERSION:-core}-py${PYTHON_VERSION:-3.10}-base - cmd: python -c "import mkl" + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-idp-${IDP_VERSION:-core}-py${PYTHON_VERSION:-3.10}-base + cmd: python -c "import mkl" perf-${IDP_VERSION:-core}: - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-idp-${IDP_VERSION:-core}-py${PYTHON_VERSION:-3.10}-base - cmd: python /tests/perf_sample.py - volumes: - - dst: /tests - src: $PWD/python/tests + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-idp-${IDP_VERSION:-core}-py${PYTHON_VERSION:-3.10}-base + cmd: python /tests/perf_sample.py + volumes: + - dst: /tests + src: $PWD/python/tests perf-stock: - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-pip-py${PYTHON_VERSION:-3.10}-base - cmd: python /tests/perf_sample.py - volumes: - - dst: /tests - src: $PWD/python/tests + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-pip-py${PYTHON_VERSION:-3.10}-base + cmd: python /tests/perf_sample.py + volumes: + - dst: /tests + src: $PWD/python/tests # compare-perf-${IDP_VERSION:-core}: # img: python:3.11-slim-bullseye # cmd: bash /tests/compare-perf.sh ${IDP_VERSION:-core} diff --git a/pytorch/serving/tests.yaml b/pytorch/serving/tests.yaml index a6a0b9e0..ae8e92e4 100644 --- a/pytorch/serving/tests.yaml +++ b/pytorch/serving/tests.yaml @@ -12,16 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. ---- ipex-serving-model-archive: img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-py${PYTHON_VERSION:-3.10}-torchserve cmd: /home/model-server/model-archive/mar-test.sh entrypoint: /bin/bash volumes: - - src: $PWD/pytorch/serving/model-archive - dst: /home/model-server/model-archive - - src: $PWD/pytorch/serving/model-store - dst: /home/model-server/model-store + - src: $PWD/pytorch/serving/model-archive + dst: /home/model-server/model-archive + - src: $PWD/pytorch/serving/model-store + dst: /home/model-server/model-store user: root workdir: /home/model-server/model-archive ipex-serving-workflow-archive: @@ -29,10 +28,10 @@ ipex-serving-workflow-archive: cmd: /home/model-server/model-archive/war-test.sh entrypoint: /bin/bash volumes: - - src: $PWD/pytorch/serving/model-archive - dst: /home/model-server/model-archive - - src: $PWD/pytorch/serving/wf-store - dst: /home/model-server/wf-store + - src: $PWD/pytorch/serving/model-archive + dst: /home/model-server/model-archive + - src: $PWD/pytorch/serving/wf-store + dst: /home/model-server/wf-store user: root workdir: /home/model-server/model-archive ipex-serving-rest-workflow: @@ -40,10 +39,10 @@ ipex-serving-rest-workflow: cmd: bash /home/model-server/wf-store/rest-test.sh serving: True volumes: - - src: $PWD/pytorch/serving/model-store - dst: /home/model-server/model-store - - src: $PWD/pytorch/serving/wf-store - dst: /home/model-server/wf-store + - src: $PWD/pytorch/serving/model-store + dst: /home/model-server/model-store + - src: $PWD/pytorch/serving/wf-store + dst: /home/model-server/wf-store env: ENABLE_TORCH_PROFILER: 'true' shm_size: 1g @@ -53,8 +52,8 @@ ipex-serving-rest-inference: cmd: bash /home/model-server/model-store/rest-test.sh serving: True volumes: - - src: $PWD/pytorch/serving/model-store - dst: /home/model-server/model-store + - src: $PWD/pytorch/serving/model-store + dst: /home/model-server/model-store env: ENABLE_TORCH_PROFILER: 'true' shm_size: 1g @@ -64,8 +63,8 @@ ipex-serving-grpc-inference: cmd: bash /home/model-server/model-store/grpc-test.sh serving: True volumes: - - src: $PWD/pytorch/serving/model-store - dst: /home/model-server/model-store + - src: $PWD/pytorch/serving/model-store + dst: /home/model-server/model-store env: ENABLE_TORCH_PROFILER: 'true' shm_size: 1g diff --git a/pytorch/tests/tests.yaml b/pytorch/tests/tests.yaml index 35de7150..4d26c25e 100644 --- a/pytorch/tests/tests.yaml +++ b/pytorch/tests/tests.yaml @@ -12,50 +12,49 @@ # See the License for the specific language governing permissions and # limitations under the License. ---- import-ipex-cpu-${PACKAGE_OPTION:-pip}: - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.3.0}-base - cmd: python -c "import torch;import intel_extension_for_pytorch as ipex;print(f'torch {torch.__version__} ipex {ipex.__version__}')" + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.3.0}-base + cmd: python -c "import torch;import intel_extension_for_pytorch as ipex;print(f'torch {torch.__version__} ipex {ipex.__version__}')" import-ipex-xpu-${PACKAGE_OPTION:-pip}: - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.1.20xpu}-xpu-base - cmd: python -c "import torch; import intel_extension_for_pytorch as ipex;[print(f'[{i}] {torch.xpu.get_device_properties(i)}') for i in range(torch.xpu.device_count())];" + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.1.20xpu}-xpu-base + cmd: python -c "import torch; import intel_extension_for_pytorch as ipex;[print(f'[{i}] {torch.xpu.get_device_properties(i)}') for i in range(torch.xpu.device_count())];" import-cpu-jupyter-${PACKAGE_OPTION:-pip}: - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.3.0}-jupyter - cmd: python -m jupyter --version + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.3.0}-jupyter + cmd: python -m jupyter --version import-xpu-jupyter-${PACKAGE_OPTION:-pip}: - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.1.20xpu}-xpu-jupyter - cmd: python -m jupyter --version + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.1.20xpu}-xpu-jupyter + cmd: python -m jupyter --version import-cpu-oneccl-${PACKAGE_OPTION:-pip}: - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.3.0}-oneccl-inc-${INC_VERSION:-2.5.1} - cmd: python -c "import oneccl_bindings_for_pytorch as oneccl; print(f'oneccl {oneccl.__version__}')" + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.3.0}-oneccl-inc-${INC_VERSION:-2.5.1} + cmd: python -c "import oneccl_bindings_for_pytorch as oneccl; print(f'oneccl {oneccl.__version__}')" import-cpu-inc-${PACKAGE_OPTION:-pip}: - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.3.0}-oneccl-inc-${INC_VERSION:-2.5.1} - cmd: python -c "import neural_compressor as inc;print(inc.__version__)" + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.3.0}-oneccl-inc-${INC_VERSION:-2.5.1} + cmd: python -c "import neural_compressor as inc;print(inc.__version__)" ipex-cpu-${PACKAGE_OPTION:-pip}: - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.3.0}-base - cmd: python /tests/ipex-resnet50.py --ipex --device cpu --backend gloo - volumes: - - dst: /tests - src: $PWD/pytorch/tests + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.3.0}-base + cmd: python /tests/ipex-resnet50.py --ipex --device cpu --backend gloo + volumes: + - dst: /tests + src: $PWD/pytorch/tests ipex-xpu-${PACKAGE_OPTION:-pip}: - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.1.20xpu}-xpu-base - cmd: python /tests/ipex-resnet50.py --ipex --device xpu - volumes: - - dst: /tests - src: $PWD/pytorch/tests + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.1.20xpu}-xpu-base + cmd: python /tests/ipex-resnet50.py --ipex --device xpu + volumes: + - dst: /tests + src: $PWD/pytorch/tests ipex-xpu-jupyter-${PACKAGE_OPTION:-pip}: - img: ${REGISTRY}/aiops/mlops-ci:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.1.20xpu}-xpu-jupyter - cmd: papermill --log-output /jupyter/xpu.ipynb -k python3 - notebook: True + img: ${REGISTRY}/aiops/mlops-ci:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.1.20xpu}-xpu-jupyter + cmd: papermill --log-output /jupyter/xpu.ipynb -k python3 + notebook: True oneccl-${PACKAGE_OPTION:-pip}: - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.3.0}-oneccl-inc-${INC_VERSION:-2.5.1} - cmd: ipexrun cpu /tests/ipex-resnet50.py --ipex --device cpu --backend ccl - volumes: - - dst: /tests - src: $PWD/pytorch/tests + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.3.0}-oneccl-inc-${INC_VERSION:-2.5.1} + cmd: ipexrun cpu /tests/ipex-resnet50.py --ipex --device cpu --backend ccl + volumes: + - dst: /tests + src: $PWD/pytorch/tests inc-${PACKAGE_OPTION:-pip}: - img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.3.0}-oneccl-inc-${INC_VERSION:-2.5.1} - cmd: python /tests/inc-quant.py - volumes: - - dst: /tests - src: $PWD/pytorch/tests + img: ${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER:-0}-${BASE_IMAGE_NAME:-ubuntu}-${BASE_IMAGE_TAG:-22.04}-${PACKAGE_OPTION:-pip}-py${PYTHON_VERSION:-3.10}-ipex-${IPEX_VERSION:-2.3.0}-oneccl-inc-${INC_VERSION:-2.5.1} + cmd: python /tests/inc-quant.py + volumes: + - dst: /tests + src: $PWD/pytorch/tests diff --git a/workflows/charts/dev-requirements.txt b/workflows/charts/dev-requirements.txt new file mode 100644 index 00000000..9096ab43 --- /dev/null +++ b/workflows/charts/dev-requirements.txt @@ -0,0 +1,2 @@ +yamale>=5.2.1 +yamllint>=1.15.1 diff --git a/workflows/charts/test/.helmignore b/workflows/charts/test/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/workflows/charts/test/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/workflows/charts/test/Chart.yaml b/workflows/charts/test/Chart.yaml new file mode 100644 index 00000000..76e8468a --- /dev/null +++ b/workflows/charts/test/Chart.yaml @@ -0,0 +1,42 @@ +# Copyright (c) 2024 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v2 +name: chart-test +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +maintainers: + - name: tylertitsworth + email: tyler.titsworth@intel.com + url: https://github.com/tylertitsworth +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/workflows/charts/test/README.md b/workflows/charts/test/README.md new file mode 100644 index 00000000..989ae5fe --- /dev/null +++ b/workflows/charts/test/README.md @@ -0,0 +1,30 @@ +# chart-test + +   + +A Helm chart for Kubernetes + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| tylertitsworth | <tyler.titsworth@intel.com> | <https://github.com/tylertitsworth> | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| fullnameOverride | string | `""` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"nginx"` | | +| image.tag | string | `""` | | +| nameOverride | string | `""` | | +| replicaCount | int | `1` | | +| service.port | int | `80` | | +| service.type | string | `"ClusterIP"` | | +| serviceAccount.annotations | object | `{}` | | +| serviceAccount.create | bool | `true` | | +| serviceAccount.name | string | `""` | | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1) diff --git a/workflows/charts/test/templates/NOTES.txt b/workflows/charts/test/templates/NOTES.txt new file mode 100644 index 00000000..4d1369ea --- /dev/null +++ b/workflows/charts/test/templates/NOTES.txt @@ -0,0 +1,16 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "chart-test.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "chart-test.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "chart-test.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "chart-test.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/workflows/charts/test/templates/_helpers.tpl b/workflows/charts/test/templates/_helpers.tpl new file mode 100644 index 00000000..9e23fffb --- /dev/null +++ b/workflows/charts/test/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "chart-test.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "chart-test.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "chart-test.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "chart-test.labels" -}} +helm.sh/chart: {{ include "chart-test.chart" . }} +{{ include "chart-test.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "chart-test.selectorLabels" -}} +app.kubernetes.io/name: {{ include "chart-test.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "chart-test.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "chart-test.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/workflows/charts/test/templates/deployment.yaml b/workflows/charts/test/templates/deployment.yaml new file mode 100644 index 00000000..05174bb2 --- /dev/null +++ b/workflows/charts/test/templates/deployment.yaml @@ -0,0 +1,47 @@ +# Copyright (c) 2024 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "chart-test.fullname" . }} + labels: + {{- include "chart-test.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "chart-test.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "chart-test.selectorLabels" . | nindent 8 }} + spec: + serviceAccountName: {{ include "chart-test.serviceAccountName" . }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 80 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http diff --git a/workflows/charts/test/templates/service.yaml b/workflows/charts/test/templates/service.yaml new file mode 100644 index 00000000..2a5d21f8 --- /dev/null +++ b/workflows/charts/test/templates/service.yaml @@ -0,0 +1,29 @@ +# Copyright (c) 2024 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: Service +metadata: + name: {{ include "chart-test.fullname" . }} + labels: + {{- include "chart-test.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "chart-test.selectorLabels" . | nindent 4 }} diff --git a/workflows/charts/test/templates/serviceaccount.yaml b/workflows/charts/test/templates/serviceaccount.yaml new file mode 100644 index 00000000..52ecc7b5 --- /dev/null +++ b/workflows/charts/test/templates/serviceaccount.yaml @@ -0,0 +1,26 @@ +# Copyright (c) 2024 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +{{if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "chart-test.serviceAccountName" . }} + labels: + {{- include "chart-test.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/workflows/charts/test/templates/tests/test-connection.yaml b/workflows/charts/test/templates/tests/test-connection.yaml new file mode 100644 index 00000000..eb4466f3 --- /dev/null +++ b/workflows/charts/test/templates/tests/test-connection.yaml @@ -0,0 +1,30 @@ +# yamllint disable-file +# Copyright (c) 2024 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "chart-test.fullname" . }}-test-connection" + labels: + {{- include "chart-test.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "chart-test.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/workflows/charts/test/values.yaml b/workflows/charts/test/values.yaml new file mode 100644 index 00000000..479b2dd3 --- /dev/null +++ b/workflows/charts/test/values.yaml @@ -0,0 +1,41 @@ +# Copyright (c) 2024 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Default values for chart-test. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: nginx + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +service: + type: ClusterIP + port: 80