Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[GHA] OV provider interface updates (#26636)

Alina Kladieva4bfe725cf23a
diff --git a/.github/actions/common/artifact_utils.py b/.github/actions/common/artifact_utils.py
index b5e95c65d52..58c96fbe5de 100644
--- a/.github/actions/common/artifact_utils.py
+++ b/.github/actions/common/artifact_utils.py
@@ -3,7 +3,7 @@ from __future__ import annotations
import argparse
import os
from pathlib import Path
-from .constants import EventType, ProductType
+from .constants import EventType, ProductType, PlatformKey
def add_common_args(parser: argparse.ArgumentParser):
@@ -12,10 +12,14 @@ def add_common_args(parser: argparse.ArgumentParser):
default=os.getenv('GITHUB_BASE_REF') or os.getenv('GITHUB_REF_NAME'))
parser.add_argument('-e', '--event_name', help='Name of GitHub event', required=False,
default=os.getenv('GITHUB_EVENT_NAME'))
- parser.add_argument('--storage_dir', help='Subdirectory name for artifacts, same as product type', required=True,
- choices=[product_type.value for product_type in ProductType])
parser.add_argument('--storage_root', help='Root path of the artifacts storage', required=False,
default=os.getenv('ARTIFACTS_SHARE'))
+ group = parser.add_mutually_exclusive_group(required=True)
+ group.add_argument('-d', '--storage_dir', help='Subdirectory name for artifacts, same as product type',
+ choices=[platform_key.value for platform_key in ProductType])
+ group.add_argument('-p', '--platform', type=str,
+ help='Platform for which to restore artifacts. Used if storage_dir is not set',
+ choices=[product_type.value for product_type in PlatformKey])
def get_event_type(event_name: str = os.getenv('GITHUB_EVENT_NAME')) -> str:
diff --git a/.github/actions/common/constants.py b/.github/actions/common/constants.py
index 01b705f1375..da55ece2ee4 100644
--- a/.github/actions/common/constants.py
+++ b/.github/actions/common/constants.py
@@ -18,3 +18,27 @@ productTypes = (
'public_windows_vs2019_Debug',
)
ProductType = Enum('ProductType', {t.upper(): t for t in productTypes})
+
+
+platformKeys = (
+ 'centos7_x86_64',
+ 'debian10_armhf',
+ 'rhel8_x86_64',
+ 'ubuntu20_arm64',
+ 'ubuntu20_x86_64',
+ 'ubuntu22_x86_64',
+ 'ubuntu24_x86_64',
+ 'macos_12_6_arm64',
+ 'macos_12_6_x86_64',
+ 'windows_x86_64',
+)
+PlatformKey = Enum('PlatformKey', {t.upper(): t for t in platformKeys})
+
+PlatformMapping = {
+ PlatformKey.DEBIAN10_ARMHF: ProductType.PUBLIC_LINUX_DEBIAN_10_ARM_RELEASE,
+ PlatformKey.UBUNTU20_X86_64: ProductType.PUBLIC_LINUX_UBUNTU_20_04_X86_64_RELEASE,
+ PlatformKey.UBUNTU20_ARM64: ProductType.PUBLIC_LINUX_UBUNTU_20_04_ARM64_RELEASE,
+ PlatformKey.UBUNTU22_X86_64: ProductType.PUBLIC_LINUX_UBUNTU_22_04_X86_64_RELEASE,
+ PlatformKey.UBUNTU24_X86_64: ProductType.PUBLIC_LINUX_UBUNTU_24_04_X86_64_RELEASE,
+ PlatformKey.WINDOWS_X86_64: ProductType.PUBLIC_WINDOWS_VS2019_RELEASE,
+}
diff --git a/.github/actions/openvino_provider/action.yml b/.github/actions/openvino_provider/action.yml
index 85c304f43d9..8cc865c5f5b 100644
--- a/.github/actions/openvino_provider/action.yml
+++ b/.github/actions/openvino_provider/action.yml
@@ -2,7 +2,8 @@ name: 'OpenVINO provider'
description: 'Provides OpenVINO build artifacts from a requested source'
inputs:
revision:
- description: 'Version of OpenVINO to provide - latest_available | HEAD | specific commit hash'
+ description: 'Version of OpenVINO to provide - latest_available_commit | HEAD | specific commit hash |
+ latest_nightly | specific package version (e.g. 2024.4.0rc2)'
required: true
branch_name:
description: 'Branch of OpenVINO to take the revision from if no specific hash was provided.
@@ -11,21 +12,25 @@ inputs:
ov_artifact_name:
description: "Name under which to upload provided OpenVINO build artifacts, set automatically by default"
required: false
+ platform:
+ description: "Platform for which to get artifacts: centos7 | debian10 | rhel8 | ubuntu20 |
+ ubuntu20 | ubuntu22 | ubuntu24 | macos | macos_12_6 | windows"
+ required: false
+ arch:
+ description: "Architecture for which to get artifacts: x86_64 | armhf | arm64"
+ default: "x86_64"
+ required: false
+ install_dir:
+ description: 'Local path to install OpenVINO package to. If not specified, package is installed to GitHub workspace
+ and uploaded to GitHub'
+ required: false
commit_packages_to_provide:
description: "Comma-separated list of OpenVINO packages from post-commit to provide ('all' to get everything)"
required: false
- commit_build_key:
- description: 'public_linux_ubuntu_20_04_release | public_linux_ubuntu_22_04_release |
- public_linux_ubuntu_24_04_release | public_windows_vs2019_release'
- required: false
commit_share_path:
description: 'Path to share holding OpenVINO post-commit artifacts'
required: false
default: '/mount/build-artifacts'
- nightly_build_key:
- description: 'centos7_x86_64 | debian9_armhf | rhel8_x86_64 | ubuntu20_arm64 | ubuntu20_x86_64 | ubuntu22_x86_64 |
- ubuntu24_x86_64 | macos_12_6_arm64 | macos_12_6_x86_64 | windows_x86_64'
- required: false
nightly_package_source:
description: 'Source URL hosting OpenVINO nightly archives'
required: false
@@ -34,40 +39,44 @@ inputs:
description: 'Source URL hosting OpenVINO wheels, for passing to pip as --extra-index-url'
required: false
default: 'https://storage.openvinotoolkit.org/simple/wheels'
- package_url:
- description: 'Direct URL to OpenVINO archive to use, if neither post-commit nor nightly archives are required'
- required: false
+
outputs:
ov_artifact_name:
description: "Name of the artifact to upload OpenVINO build artifacts under"
- value: ${{ steps.openvino_download.outputs.ov_artifact_name || steps.openvino_commit_output.outputs.ov_artifact_name }}
- ov_package_path:
- description: "Path to OpenVINO core package relative to the root of uploaded artifacts"
- value: ${{ steps.openvino_download.outputs.ov_package_path || steps.openvino_commit_output.outputs.ov_package_path }}
- ov_wheel_input:
- description: "Input for pip to install OpenVINO python wheel"
- value: ${{ steps.openvino_wheel.outputs.ov_wheel_input || steps.openvino_commit_wheel.outputs.ov_wheel_input }}
+ value: ${{ steps.openvino_s3_download.outputs.ov_artifact_name || steps.openvino_commit_output.outputs.ov_artifact_name }}
ov_wheel_source:
description: "Pip option for custom OV wheel location (--find-links or --extra-index-url)"
- value: ${{ steps.openvino_wheel.outputs.ov_wheel_source || steps.openvino_commit_wheel.outputs.ov_wheel_source }}
+ value: ${{ steps.openvino_s3_wheel.outputs.ov_wheel_source || steps.openvino_commit_wheel.outputs.ov_wheel_source }}
+ ov_version:
+ description: "OpenVINO product version"
+ value: ${{ steps.openvino_s3_wheel.outputs.ov_version || steps.openvino_commit_wheel.outputs.ov_version }}
runs:
using: "composite"
steps:
- - name: Verify parameters
- if: ${{ !inputs.package_url && !inputs.nightly_build_key && !inputs.commit_build_key }}
+ - name: Identify artifacts source
+ id: get_source
shell: bash
run: |
- echo "Please, set one parameter for action - nightly_build_key, commit_build_key or package_url"
- exit 1
+ artifacts_source="postcommit"
+ if [[ "${{ inputs.revision }}" == "latest_nightly" || "${{ inputs.revision }}" =~ ^[0-9]{4}\.[0-9]+\.*[0-9]* ]]; then
+ artifacts_source="s3"
+ fi
+ echo "artifacts_source=$artifacts_source" >> $GITHUB_OUTPUT
+
+ - name: Get action revision
+ id: get_action_revision
+ run: echo "action_ref=${{ env.ACTION_REF }}" >> $GITHUB_OUTPUT
+ shell: bash
+ env:
+ ACTION_REF: ${{ github.action_ref || github.base_ref || github.event.merge_group.base_ref || github.ref }}
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: 'openvinotoolkit/openvino'
- ref: ${{ inputs.branch_name || github.base_ref || github.event.merge_group.base_ref || github.ref }}
+ ref: ${{ steps.get_action_revision.outputs.action_ref }}
sparse-checkout: .github/actions
- # --- Post-commit case ---
- name: Clone OpenVINO to get HEAD commit
if: inputs.revision == 'HEAD'
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
@@ -84,18 +93,25 @@ runs:
head=$(git -C openvino rev-parse HEAD)
echo "head=$head" >> $GITHUB_OUTPUT
+ - name: Create install dir
+ if: inputs.install_dir
+ shell: bash
+ run: |
+ mkdir -p ${{ inputs.install_dir }}
+
+ # --- Post-commit case ---
- name: Download post-commit OpenVINO archives
id: openvino_commit_download
- if: inputs.commit_build_key
+ if: steps.get_source.outputs.artifacts_source == 'postcommit'
uses: ./.github/actions/restore_artifacts
with:
- storage_dir: ${{ inputs.commit_build_key }}
+ platform: ${{ inputs.platform }}_${{ inputs.arch }}
storage_root: ${{ inputs.commit_share_path }}
event_name: "commit"
trigger_repo_sha: ${{ env.OV_REVISION }}
branch_name: ${{ inputs.branch_name }}
- artifacts_key: ${{ inputs.ov_artifact_name || inputs.commit_build_key }}
to_restore: ${{ inputs.commit_packages_to_provide }}
+ target_dir: ${{ inputs.install_dir }}
env:
OV_REVISION: ${{ inputs.revision == 'HEAD' && steps.get_openvino_head_commit.outputs.head || inputs.revision }}
@@ -104,79 +120,98 @@ runs:
if: steps.openvino_commit_download.outcome == 'success'
shell: bash
run: |
- ov_artifact_name=${{ inputs.ov_artifact_name || steps.openvino_commit_download.outputs.restored_artifacts_key }}
- cd ${{ steps.openvino_commit_download.outputs.artifacts_workspace_path }}
+ ov_artifact_name=${{ inputs.ov_artifact_name || inputs.platform }}
+ workspace_path=${{ steps.openvino_commit_download.outputs.artifacts_path }}
+ cd $workspace_path
ov_package_path=$(find . -name 'openvino_package*' -printf "%P\n" -quit)
[ -z "$ov_package_path" ] && echo "No openvino_package found in restored artifacts" && exit 1
+ mv $ov_package_path/* . && rm -rf $ov_package_path
echo "ov_artifact_name=$ov_artifact_name" >> $GITHUB_OUTPUT
- echo "ov_package_path=$ov_package_path" >> $GITHUB_OUTPUT
+ echo "ov_package_path=$workspace_path" >> $GITHUB_OUTPUT
- name: Get commit wheel
id: openvino_commit_wheel
if: steps.openvino_commit_download.outcome == 'success'
shell: bash
run: |
- cd ${{ steps.openvino_commit_download.outputs.artifacts_workspace_path }}
+ artifacts_path=${{ steps.openvino_commit_download.outputs.artifacts_path }}
+ cd $artifacts_path
version=$(yq eval '.components.dldt.custom_params.wheel_product_version' manifest.yml)
- wheel_path=${{ steps.openvino_commit_output.outputs.ov_package_path }}/tools
- default_find_links_cmd="--find-links=./$wheel_path"
+ wheel_path=${{ inputs.install_dir && '$artifacts_path/tools' || './tools' }}
+ default_find_links_cmd="--find-links=$wheel_path"
find_links_cmd=$([[ -n "$PIP_FIND_LINKS" ]] && echo "" || echo "$default_find_links_cmd")
- wheel_input="$find_links_cmd openvino==$version"
- echo "ov_wheel_input=$wheel_input" >> $GITHUB_OUTPUT
+ echo "ov_version=$version" >> $GITHUB_OUTPUT
echo "ov_wheel_source=$default_find_links_cmd" >> $GITHUB_OUTPUT
+ - name: Upload commit OpenVINO archives
+ if: steps.openvino_commit_download.outcome == 'success' && !inputs.install_dir
+ uses: actions/upload-artifact@v4
+ with:
+ name: ${{ steps.openvino_commit_output.outputs.ov_artifact_name }}
+ path: ${{ steps.openvino_commit_output.outputs.ov_package_path }}
+ if-no-files-found: 'error'
- # --- S3 case (nightly or direct URL) ---
- - name: Verify parameters
- if: (inputs.nightly_build_key || inputs.package_url) && inputs.revision != 'latest_available'
+ # --- S3 case ---
+ - name: Get a specific S3 package URL
+ id: get_s3_package
+ if: steps.get_source.outputs.artifacts_source == 's3' && inputs.revision != 'latest_nightly'
shell: bash
- run: |
- echo "Nightly and package_url build sources provide only 'latest' artifacts, specific revision not supported"
- exit 1
+ run: >-
+ python3 -m venv venv && . venv/bin/activate &&
+ pip install -r $GITHUB_ACTION_PATH/requirements.txt &&
+ python $GITHUB_ACTION_PATH/get_s3_package.py --product openvino --platform ${{ inputs.platform }} --arch ${{ inputs.arch }}
+ --version ${{ inputs.revision }}
- - name: Download OpenVINO archives
- id: openvino_download
- if: inputs.nightly_build_key || inputs.package_url
+ - name: Download nightly OpenVINO archives
+ id: openvino_s3_download
+ if: steps.get_source.outputs.artifacts_source == 's3'
shell: bash
run: |
- if [ ${{ inputs.package_url }} ]; then
- ov_package_url=${{ inputs.package_url }}
+ if [ ${{ steps.get_s3_package.outcome }} != 'skipped' ]; then
+ ov_package_url=${{ steps.get_s3_package.outputs.package_url }}
else
- ov_package_url=$(curl -s ${{ inputs.nightly_package_source }} | jq -r '.${{ inputs.nightly_build_key }}')
+ ov_package_url=$(curl -s ${{ inputs.nightly_package_source }} | jq -r '.${{ inputs.platform }}_${{ inputs.arch }}')
fi
+ cd ${{ inputs.install_dir || env.GITHUB_WORKSPACE }}
package_basename=$(basename $ov_package_url)
wget $ov_package_url --progress=bar:force:noscroll -O $package_basename
- package_folder=${package_basename%.*} && mkdir $package_folder
- [[ "$package_basename" == *.zip ]] && unzip "$package_basename" -d $package_folder || tar -xvf "$package_basename" -C $package_folder
+ package_folder=${package_basename%.*}
+ [[ "$package_basename" == *.zip ]] && unzip "$package_basename" || tar -xvf "$package_basename"
+ rm $package_basename
+ if [ ${{ inputs.install_dir }} ]; then
+ mv $package_folder/* . && rm -rf $package_folder
+ fi
ov_artifact_name=$([ ${{ inputs.ov_artifact_name }} ] && echo ${{ inputs.ov_artifact_name }} || echo $package_folder)
+ echo "ov_package_url=$ov_package_url" >> $GITHUB_OUTPUT
echo "ov_artifact_name=$ov_artifact_name" >> $GITHUB_OUTPUT
echo "ov_package_path=$package_folder" >> $GITHUB_OUTPUT
- name: Upload OpenVINO archives
- if: steps.openvino_download.outcome == 'success'
+ if: steps.openvino_s3_download.outcome == 'success' && !inputs.install_dir
uses: actions/upload-artifact@v4
with:
- name: ${{ steps.openvino_download.outputs.ov_artifact_name }}
- path: ${{ steps.openvino_download.outputs.ov_package_path }}
+ name: ${{ steps.openvino_s3_download.outputs.ov_artifact_name }}
+ path: ${{ steps.openvino_s3_download.outputs.ov_package_path }}
if-no-files-found: 'error'
- name: Get wheel
- id: openvino_wheel
- if: steps.openvino_download.outcome == 'success'
+ id: openvino_s3_wheel
+ if: steps.openvino_s3_download.outcome == 'success'
shell: bash
run: |
- rc_version=$(echo ${{ inputs.package_url }} |
+ rc_version=$(echo ${{ steps.openvino_s3_download.outputs.ov_package_url }} |
grep -oP '(?<=pre-release\/)\d{4}\.\d+\.\d+rc\d+' || true)
- release_version=$(echo ${{ steps.openvino_download.outputs.ov_package_path }} |
+ release_version=$(echo ${{ steps.openvino_s3_download.outputs.ov_package_path }} |
grep -oP '_\K\d{4}\.\d+\.\d+')
- dev_version=$(echo ${{ steps.openvino_download.outputs.ov_package_path }} |
+ dev_version=$(echo ${{ steps.openvino_s3_download.outputs.ov_package_path }} |
grep -oP "${release_version//./\\.}\.dev\d{8}" || true)
version=${rc_version:-${dev_version:-$release_version}}
+
extra_index="--pre --extra-index-url ${{ inputs.pip_extra_url }}/nightly \
--extra-index-url ${{ inputs.pip_extra_url }}/pre-release"
- wheel_input="$extra_index openvino==$version"
- echo "ov_wheel_input=$wheel_input" >> $GITHUB_OUTPUT
+
+ echo "ov_version=$version" >> $GITHUB_OUTPUT
echo "ov_wheel_source=$extra_index" >> $GITHUB_OUTPUT
diff --git a/.github/actions/openvino_provider/get_s3_package.py b/.github/actions/openvino_provider/get_s3_package.py
new file mode 100644
index 00000000000..df253a42242
--- /dev/null
+++ b/.github/actions/openvino_provider/get_s3_package.py
@@ -0,0 +1,77 @@
+import requests
+import re
+import argparse
+import logging
+import sys
+
+from pathlib import Path
+
+sys.path.append(str(Path(__file__).parents[1]))
+from common import action_utils
+
+
+# Function to download the JSON file
+def load_json_file(url):
+ response = requests.get(url)
+ if response.status_code == 200:
+ return response.json()
+ else:
+ raise Exception(f"Failed to download the file, status code: {response.status_code}")
+
+
+# Function to recursively gather all file paths from the JSON structure
+def gather_all_files(node, base_path=''):
+ all_files = []
+ if 'children' in node:
+ for child in node['children']:
+ new_base = f"{base_path}/{child['name']}"
+ if 'children' in child:
+ all_files += gather_all_files(child, new_base)
+ else:
+ all_files.append(new_base)
+ return all_files
+
+
+# Function to filter files based on the product, version, platform, architecture, and folder
+def filter_files_by_criteria(files, product, version_pattern, platform, arch, folder):
+ matching_files = []
+ for file in files:
+ if re.search(
+ fr"{product}/packages/{folder}(/?.*/)?{version_pattern}/.*{platform}.*{arch}.*\.(tar\.gz|tgz|zip)$",
+ file):
+ matching_files.append(file)
+ return matching_files
+
+
+# Main function to load the JSON, gather file paths, and filter based on criteria
+def main(product, version_pattern, platform, arch, folder):
+ action_utils.init_logger()
+ logger = logging.getLogger(__name__)
+
+ url = 'https://storage.openvinotoolkit.org/filetree.json'
+ filetree = load_json_file(url)
+ all_files = gather_all_files(filetree)
+ matching_files = filter_files_by_criteria(all_files, product, version_pattern, platform, arch, folder)
+ if matching_files:
+ logger.info(f"Matching packages: {sorted(matching_files)}")
+ package_url = f"https://storage.openvinotoolkit.org{sorted(matching_files)[-1]}"
+ logger.info(f"Returning package URL: {package_url}")
+ action_utils.set_github_output("package_url", package_url)
+ else:
+ logger.error("No matching files found.")
+ sys.exit(1)
+
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(
+ description='Search OpenVINO archives based on product, version, platform, architecture, and folder.')
+ parser.add_argument('--product', required=True, choices=['openvino', 'openvino_genai', 'openvino_tokenizers'],
+ help='Product name')
+ parser.add_argument('--version', required=True, help='Version pattern (supports regex)')
+ parser.add_argument('--platform', default='ubuntu22', help='Platform (default: ubuntu22)')
+ parser.add_argument('--arch', default='x86_64', help='Architecture (default: x86_64)')
+ parser.add_argument('--folder', default='(.*/)?', help='Folder type (e.g., pre-release, nightly, default: (.*)?')
+
+ args = parser.parse_args()
+
+ main(args.product, args.version, args.platform, args.arch, args.folder)
diff --git a/.github/actions/openvino_provider/requirements.txt b/.github/actions/openvino_provider/requirements.txt
new file mode 100644
index 00000000000..fb1be95648e
--- /dev/null
+++ b/.github/actions/openvino_provider/requirements.txt
@@ -0,0 +1 @@
+requests~=2.32
diff --git a/.github/actions/restore_artifacts/action.yml b/.github/actions/restore_artifacts/action.yml
index f86bd006086..efa0dfe87ae 100644
--- a/.github/actions/restore_artifacts/action.yml
+++ b/.github/actions/restore_artifacts/action.yml
@@ -1,9 +1,12 @@
name: 'Restore artifacts'
-description: 'Take artifacts from a shared drive and load them back to GitHub'
+description: 'Take artifacts from a shared drive and store them in a workspace'
inputs:
storage_dir:
- description: "Subdirectory name for artifacts, same as product type"
- required: true
+ description: "Subdirectory name for artifacts, same as product type. Optional if 'platform' argument is set"
+ required: false
+ platform:
+ description: "Platform for which to restore artifacts. Used if 'storage_dir' is not set"
+ required: false
storage_root:
description: "Root path of the artifacts storage"
required: true
@@ -16,9 +19,6 @@ inputs:
trigger_repo_sha:
description: "Commit hash of a trigger repo. If not set - taken from github context"
required: false
- artifacts_key:
- description: "A key under which to upload the artifacts to storage, product type by default"
- required: false
to_restore:
description: "Comma-separated list of packages to restore, all available by default"
required: false
@@ -26,28 +26,27 @@ inputs:
description: "Whether to unpack all artifact archives once retrieved"
required: false
default: 'true'
-
+ target_dir:
+ description: "Where to place artifact archives once retrieved"
+ required: false
outputs:
- artifacts_workspace_path:
- description: "Path within the workspace where the artifacts are stored"
- value: ${{ steps.restore.outputs.artifacts_workspace_path }}
- restored_artifacts_key:
- description: "Key under which the restored artifacts, if any, were uploaded to GitHub"
- value: ${{ steps.restore.outputs.restored_artifacts_key }}
+ artifacts_path:
+ description: "Path where the artifacts are stored"
+ value: ${{ steps.restore.outputs.artifacts_path }}
runs:
using: "composite"
steps:
- name: Restore artifacts
id: restore
- if: "!inputs.artifacts"
shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}
run: >-
python3 ${{ env.ACTION_PATH }}/restore_artifacts.py
- -t "${{ env.GITHUB_WORKSPACE }}/${{ inputs.storage_dir }}"
- --storage_dir "${{ inputs.storage_dir }}" --storage_root "${{ inputs.storage_root }}"
+ -t "${{ inputs.target_dir || env.DEFAULT_TARGET_DIR }}"
+ --storage_root "${{ inputs.storage_root }}"
-s "${{ inputs.trigger_repo_sha || github.event.pull_request.head.sha || github.sha }}"
+ ${{ inputs.storage_dir && env.STORAGE_PARAM || env.PLATFORM_PARAM }}
${{ inputs.unpack_archives == 'true' && '--unpack_archives' || '' }}
${{ inputs.branch_name && env.BRANCH_PARAM || '' }}
${{ inputs.event_name && env.EVENT_PARAM || '' }}
@@ -55,14 +54,9 @@ runs:
env:
ACTION_PATH: ${{ runner.os == 'Windows' && '$env:GITHUB_ACTION_PATH' || '$GITHUB_ACTION_PATH' }}
GITHUB_WORKSPACE: ${{ runner.os == 'Windows' && '$env:GITHUB_WORKSPACE' || '$GITHUB_WORKSPACE' }}
+ STORAGE_PARAM: "--storage_dir ${{ inputs.storage_dir }}"
+ PLATFORM_PARAM: "--platform ${{ inputs.platform }}"
BRANCH_PARAM: "-b ${{ inputs.branch_name }}"
EVENT_PARAM: "-e ${{ inputs.event_name }}"
TO_RESTORE: "-r ${{ inputs.to_restore }}"
-
- - name: Upload artifacts
- if: "!inputs.artifacts"
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
- with:
- name: ${{ inputs.artifacts_key || steps.restore.outputs.restored_artifacts_key }}
- path: ${{ steps.restore.outputs.artifacts_workspace_path }}
- if-no-files-found: 'error'
+ DEFAULT_TARGET_DIR: "${{ env.GITHUB_WORKSPACE }}/${{ inputs.storage_dir || inputs.platform }}"
diff --git a/.github/actions/restore_artifacts/restore_artifacts.py b/.github/actions/restore_artifacts/restore_artifacts.py
index 8a780ce1744..d79388a27f5 100644
--- a/.github/actions/restore_artifacts/restore_artifacts.py
+++ b/.github/actions/restore_artifacts/restore_artifacts.py
@@ -14,16 +14,13 @@ from pathlib import Path, PureWindowsPath
sys.path.append(str(Path(__file__).parents[1]))
from common import artifact_utils, action_utils
-
+from common.constants import PlatformMapping, PlatformKey
def parse_args():
parser = argparse.ArgumentParser(description='Returns a path to artifacts for a given revision on a shared drive')
artifact_utils.add_common_args(parser)
parser.add_argument('-t', '--target_dir', type=str, help='Path to a dir in a workspace to download artifacts into',
required=True)
- parser.add_argument('-k', '--artifact_key', type=str,
- help='A key under which to upload the artifacts to storage, product type by default',
- required=False)
parser.add_argument('-r', '--to_restore', type=str, required=False,
help='Comma-separated list of packages to restore, all available by default')
parser.add_argument('-u', '--unpack_archives', action='store_true', required=False,
@@ -49,20 +46,22 @@ def main():
logger = logging.getLogger(__name__)
args = parse_args()
- if args.commit_sha == 'latest_available':
- latest_artifacts_link = artifact_utils.get_latest_artifacts_link(args.storage_dir, args.storage_root,
+ storage_dir = args.storage_dir or PlatformMapping[PlatformKey[args.platform.upper()]].value
+
+ if args.commit_sha == 'latest_available_commit':
+ latest_artifacts_link = artifact_utils.get_latest_artifacts_link(storage_dir, args.storage_root,
args.branch_name, args.event_name)
latest_artifacts_path = PureWindowsPath(latest_artifacts_link.read_text())
normalized_path = latest_artifacts_path.as_posix() if os.name == 'posix' else latest_artifacts_path
storage = Path(args.storage_root) / normalized_path
else:
- storage = artifact_utils.get_storage_dir(args.storage_dir, args.commit_sha, args.storage_root, args.branch_name,
+ storage = artifact_utils.get_storage_dir(storage_dir, args.commit_sha, args.storage_root, args.branch_name,
args.event_name)
action_utils.set_github_output("artifacts_storage_path", str(storage))
logger.info(f"Artifacts are taken from here: {storage}")
- main_package_extension = 'zip' if 'windows' in args.storage_dir else 'tar.gz'
+ main_package_extension = 'zip' if 'windows' in storage_dir else 'tar.gz'
main_package_name = f'openvino_package.{main_package_extension}'
defaults = [main_package_name, 'manifest.yml']
to_restore = set(args.to_restore.split(',')).union(defaults) if args.to_restore else defaults
@@ -82,8 +81,7 @@ def main():
shutil.unpack_archive(file, output_dir)
file.unlink()
- action_utils.set_github_output("artifacts_workspace_path", args.target_dir)
- action_utils.set_github_output("restored_artifacts_key", args.artifact_key or args.storage_dir)
+ action_utils.set_github_output("artifacts_path", args.target_dir)
if __name__ == '__main__':
diff --git a/.github/actions/store_artifacts/action.yml b/.github/actions/store_artifacts/action.yml
index 2ada54cd8e7..4e50953d8c9 100644
--- a/.github/actions/store_artifacts/action.yml
+++ b/.github/actions/store_artifacts/action.yml
@@ -4,9 +4,12 @@ inputs:
artifacts:
description: "Multi-line list of artifacts to store"
required: true
+ platform:
+ description: "Platform for which to restore artifacts. Used if 'storage_dir' is not set"
+ required: false
storage_dir:
- description: "Subdirectory name for stored artifacts, same as product type"
- required: true
+ description: "Subdirectory name for stored artifacts, same as product type. Optional if 'platform' argument is set"
+ required: false
storage_root:
description: "Root path to place artifacts to"
required: true
@@ -45,12 +48,15 @@ runs:
shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}
run: >-
python3 ${{ env.ACTION_PATH }}/store_artifacts.py
- --storage_dir "${{ inputs.storage_dir }}" --storage_root "${{ inputs.storage_root }}"
+ --storage_root "${{ inputs.storage_root }}"
-a "${{ inputs.artifacts }}"
-s "${{ inputs.trigger_repo_sha || github.event.pull_request.head.sha || github.sha }}"
+ ${{ inputs.storage_dir && env.STORAGE_PARAM || env.PLATFORM_PARAM }}
${{ inputs.branch_name && env.BRANCH_PARAM || '' }}
${{ inputs.event_name && env.EVENT_PARAM || '' }}
env:
ACTION_PATH: ${{ runner.os == 'Windows' && '$env:GITHUB_ACTION_PATH' || '$GITHUB_ACTION_PATH' }}
BRANCH_PARAM: "-b ${{ inputs.branch_name }}"
EVENT_PARAM: "-e ${{ inputs.event_name }}"
+ STORAGE_PARAM: "--storage_dir ${{ inputs.storage_dir }}"
+ PLATFORM_PARAM: "--platform ${{ inputs.platform }}"
diff --git a/.github/actions/store_artifacts/store_artifacts.py b/.github/actions/store_artifacts/store_artifacts.py
index bbab2c8e694..75cd452b562 100644
--- a/.github/actions/store_artifacts/store_artifacts.py
+++ b/.github/actions/store_artifacts/store_artifacts.py
@@ -13,6 +13,7 @@ from pathlib import Path
sys.path.append(str(Path(__file__).parents[1]))
from common import artifact_utils, action_utils
+from common.constants import PlatformMapping, PlatformKey
def parse_args():
@@ -67,7 +68,8 @@ def main():
args = parse_args()
storage_root = args.storage_root or os.getenv('ARTIFACTS_SHARE')
- storage = artifact_utils.get_storage_dir(args.storage_dir, args.commit_sha, args.storage_root, args.branch_name,
+ storage_dir = args.storage_dir or PlatformMapping[PlatformKey[args.platform.upper()]].value
+ storage = artifact_utils.get_storage_dir(storage_dir, args.commit_sha, args.storage_root, args.branch_name,
args.event_name)
action_utils.set_github_output("artifacts_storage_path", str(storage))
@@ -96,7 +98,7 @@ def main():
with open(storage / 'workflow_link.txt', 'w') as file:
file.write(workflow_link)
- latest_artifacts_for_branch = artifact_utils.get_latest_artifacts_link(args.storage_dir, args.storage_root,
+ latest_artifacts_for_branch = artifact_utils.get_latest_artifacts_link(storage_dir, args.storage_root,
args.branch_name, args.event_name)
# Overwrite path to "latest" built artifacts only if a given commit is the head of a given branch
if args.event_name != 'pull_request' and args.commit_sha == os.getenv('GITHUB_SHA'):