From db2f5fc0c9f4f795a11c1accf25062b36e1c98d8 Mon Sep 17 00:00:00 2001 From: letonghan <106566639+letonghan@users.noreply.github.com> Date: Wed, 20 Jul 2022 11:11:33 +0800 Subject: [PATCH 001/271] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000000..6f401c61650 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,36 @@ +# Python package +# Create and test a Python package on multiple Python versions. +# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/python + +trigger: +- master + +pool: + vmImage: ubuntu-latest +strategy: + matrix: + Python27: + python.version: '2.7' + Python35: + python.version: '3.5' + Python36: + python.version: '3.6' + Python37: + python.version: '3.7' + +steps: +- task: UsePythonVersion@0 + inputs: + versionSpec: '$(python.version)' + displayName: 'Use Python $(python.version)' + +- script: | + python -m pip install --upgrade pip + pip install -r requirements.txt + displayName: 'Install dependencies' + +- script: | + pip install pytest pytest-azurepipelines + pytest + displayName: 'pytest' From 02819667f2c4ad32cee585885286f259796f5b48 Mon Sep 17 00:00:00 2001 From: letonghan <106566639+letonghan@users.noreply.github.com> Date: Fri, 22 Jul 2022 16:45:07 +0800 Subject: [PATCH 002/271] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 93 ++++++++++++++++++++++++++++++--------------- 1 file changed, 62 insertions(+), 31 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6f401c61650..7530cb8974d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,36 +1,67 @@ -# Python package -# Create and test a Python package on multiple Python versions. -# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more: -# https://docs.microsoft.com/azure/devops/pipelines/languages/python +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml -trigger: -- master +pr: + - main -pool: - vmImage: ubuntu-latest -strategy: - matrix: - Python27: - python.version: '2.7' - Python35: - python.version: '3.5' - Python36: - python.version: '3.6' - Python37: - python.version: '3.7' +pool: wenjiao-test -steps: -- task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - displayName: 'Use Python $(python.version)' +stages: + - stage: pylint + jobs: + - job: pylint_test + steps: + - task: Bash@3 + inputs: + targetType: "inline" + script: | + pwd + pip install pylint==2.12.1 + pip install intel-tensorflow + python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto --ignored-modules=tensorflow,torch,torch.quantization,torch.tensor,torchvision,mxnet,onnx,onnxruntime ./neural_compressor > /lpot-pylint.json + # # exit_code=$? + # # if [ ${exit_code} -ne 0 ] ; then + # # echo "PyLint exited with non-zero exit code."; exit 1 + # # fi + # # exit 0 -- script: | - python -m pip install --upgrade pip - pip install -r requirements.txt - displayName: 'Install dependencies' + - stage: bandit + jobs: + - job: bandit_test + steps: + - task: Bash@3 + inputs: + targetType: "inline" +# script: | +# pip install bandit +# # python -m bandit -r -lll -iii neural_compressor > ${WORKSPACE}/lpot-bandit.log +# # exit_code=$? +# # if [ ${exit_code} -ne 0 ] ; then +# # echo "Bandit exited with non-zero exit code."; exit 1 +# # fi +# # exit 0 -- script: | - pip install pytest pytest-azurepipelines - pytest - displayName: 'pytest' + # - stage: pyspelling + # jobs: + # - job: pyspelling_test +# steps: +# - task: Bash@3 +# inputs: +# targetType: "inline" +# script: | +# pip install pyspelling +# # Update paths to validation and lpot repositories +# # VAL_REPO=${WORKSPACE} + +# # sed -i "s|\${VAL_REPO}|$VAL_REPO|g" ${VAL_REPO}/pyspelling_conf.yaml +# # sed -i "s|\${LPOT_REPO}|$REPO_DIR|g" ${VAL_REPO}/pyspelling_conf.yaml +# # echo "Modified config:" +# # cat ${VAL_REPO}/pyspelling_conf.yaml +# # pyspelling -c ${VAL_REPO}/pyspelling_conf.yaml > ${WORKSPACE}/pyspelling_output.log +# # exit_code=$? +# # if [ ${exit_code} -ne 0 ] ; then +# # echo "Pyspelling exited with non-zero exit code."; exit 1 +# # fi +# # exit 0 From ecedb0a3a8d3dd764aa3941c0630de81b37ff02f Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Thu, 28 Jul 2022 14:32:27 +0800 Subject: [PATCH 003/271] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines-1.yml | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 azure-pipelines-1.yml diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml new file mode 100644 index 00000000000..b384d61c2fb --- /dev/null +++ b/azure-pipelines-1.yml @@ -0,0 +1,40 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +pr: +- wenxin-test + +pool: + vmImage: ubuntu-latest + +variables: + PYTHON: 'python3.8' + INC_VER: '1.12' + IMAGE_NAME: 'neural-compressor' + IMAGE_TAG: '1.12' + INC_BRANCH: 'master' + +stages: +- stage: Build + displayName: Build and push stage + jobs: + - job: Build + displayName: Build + steps: + - script: docker build --build-arg PYTHON=${PYTHON} --build-arg INC_BRANCH=${INC_BRANCH} -f docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + displayName: 'Build Container' + + - script: | + docker images | grep -i neural-compressor + displayName: 'Check docker' + + - script: | + Workspace=`pwd` + docker run --init --name=test-inc -d -u root:root -w ${Workspace} ${IMAGE_NAME}:${IMAGE_TAG} tail -f /dev/null + docker exec test-inc python3 -c "import neural_compressor as nc;print(nc.version.__version__)" + docker exec test-inc python3.8 -c "import neural_compressor as nc;print(nc.version.__version__)" + docker exec test-inc pwd && ls -l && pip list && python test/test_metrics.py + + displayName: 'Run python sciprt' From e2e9e01cb9817021a59e011e2d910ccd3d840dd7 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Thu, 28 Jul 2022 14:42:47 +0800 Subject: [PATCH 004/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index b384d61c2fb..788bc4c4d6f 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -33,8 +33,8 @@ stages: - script: | Workspace=`pwd` docker run --init --name=test-inc -d -u root:root -w ${Workspace} ${IMAGE_NAME}:${IMAGE_TAG} tail -f /dev/null - docker exec test-inc python3 -c "import neural_compressor as nc;print(nc.version.__version__)" - docker exec test-inc python3.8 -c "import neural_compressor as nc;print(nc.version.__version__)" + docker exec test-inc /usr/local/bin/python3 -c "import neural_compressor as nc;print(nc.version.__version__)" + docker exec test-inc /usr/local/bin/python -c "import neural_compressor as nc;print(nc.version.__version__)" docker exec test-inc pwd && ls -l && pip list && python test/test_metrics.py displayName: 'Run python sciprt' From 6635449cb58c0054b36f2930d2ed418485c467bd Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Thu, 28 Jul 2022 14:51:29 +0800 Subject: [PATCH 005/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 788bc4c4d6f..42fb8a94795 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -10,7 +10,7 @@ pool: vmImage: ubuntu-latest variables: - PYTHON: 'python3.8' + PYTHON: 'python' INC_VER: '1.12' IMAGE_NAME: 'neural-compressor' IMAGE_TAG: '1.12' @@ -32,9 +32,10 @@ stages: - script: | Workspace=`pwd` + docker run ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python -c "import neural_compressor as nc;print(nc.version.__version__)" docker run --init --name=test-inc -d -u root:root -w ${Workspace} ${IMAGE_NAME}:${IMAGE_TAG} tail -f /dev/null docker exec test-inc /usr/local/bin/python3 -c "import neural_compressor as nc;print(nc.version.__version__)" docker exec test-inc /usr/local/bin/python -c "import neural_compressor as nc;print(nc.version.__version__)" - docker exec test-inc pwd && ls -l && pip list && python test/test_metrics.py + docker exec test-inc pip install numpy && pip list && python test/test_metrics.py displayName: 'Run python sciprt' From 37cc4c4de821812a3d4fc1483903679cb3b7a5a8 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Thu, 28 Jul 2022 14:53:34 +0800 Subject: [PATCH 006/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 42fb8a94795..f69a0649ed0 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -10,7 +10,7 @@ pool: vmImage: ubuntu-latest variables: - PYTHON: 'python' + PYTHON: 'python3.8' INC_VER: '1.12' IMAGE_NAME: 'neural-compressor' IMAGE_TAG: '1.12' From 92ff7200ba934ca625dbc351e2f9f04b3662e801 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Thu, 28 Jul 2022 14:58:20 +0800 Subject: [PATCH 007/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index f69a0649ed0..3609cc94963 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -33,6 +33,7 @@ stages: - script: | Workspace=`pwd` docker run ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python -c "import neural_compressor as nc;print(nc.version.__version__)" + docker run ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python test/test_metrics.py docker run --init --name=test-inc -d -u root:root -w ${Workspace} ${IMAGE_NAME}:${IMAGE_TAG} tail -f /dev/null docker exec test-inc /usr/local/bin/python3 -c "import neural_compressor as nc;print(nc.version.__version__)" docker exec test-inc /usr/local/bin/python -c "import neural_compressor as nc;print(nc.version.__version__)" From 81f28ee9af7eef957f9fa3d668ce09ec2a665a17 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Thu, 28 Jul 2022 15:21:58 +0800 Subject: [PATCH 008/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 3609cc94963..95c3c4a08af 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -32,8 +32,8 @@ stages: - script: | Workspace=`pwd` - docker run ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python -c "import neural_compressor as nc;print(nc.version.__version__)" - docker run ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python test/test_metrics.py + docker run -w ${Workspace} ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python -c "import neural_compressor as nc;print(nc.version.__version__)" + docker run -w ${Workspace} ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python /neural-compressor/test/test_metrics.py docker run --init --name=test-inc -d -u root:root -w ${Workspace} ${IMAGE_NAME}:${IMAGE_TAG} tail -f /dev/null docker exec test-inc /usr/local/bin/python3 -c "import neural_compressor as nc;print(nc.version.__version__)" docker exec test-inc /usr/local/bin/python -c "import neural_compressor as nc;print(nc.version.__version__)" From f3b5d2b6dea51b4da4087b934fe61f4503aaa3dd Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Thu, 28 Jul 2022 15:28:40 +0800 Subject: [PATCH 009/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 95c3c4a08af..1be74fcdb9d 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -32,8 +32,8 @@ stages: - script: | Workspace=`pwd` - docker run -w ${Workspace} ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python -c "import neural_compressor as nc;print(nc.version.__version__)" - docker run -w ${Workspace} ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python /neural-compressor/test/test_metrics.py + docker run ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python -c "import neural_compressor as nc;print(nc.version.__version__)" + docker run ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python /neural-compressor/test/test_metrics.py docker run --init --name=test-inc -d -u root:root -w ${Workspace} ${IMAGE_NAME}:${IMAGE_TAG} tail -f /dev/null docker exec test-inc /usr/local/bin/python3 -c "import neural_compressor as nc;print(nc.version.__version__)" docker exec test-inc /usr/local/bin/python -c "import neural_compressor as nc;print(nc.version.__version__)" From 931b25196afbf6e723a26b957d01e4c6eaf8ba63 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Thu, 28 Jul 2022 15:44:38 +0800 Subject: [PATCH 010/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 1be74fcdb9d..50c31f2bd52 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -32,11 +32,12 @@ stages: - script: | Workspace=`pwd` + docker run ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -c "pwd && ls -l && pip list" docker run ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python -c "import neural_compressor as nc;print(nc.version.__version__)" - docker run ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python /neural-compressor/test/test_metrics.py + docker run ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python /neural-compressor/test/config/test_config.py docker run --init --name=test-inc -d -u root:root -w ${Workspace} ${IMAGE_NAME}:${IMAGE_TAG} tail -f /dev/null docker exec test-inc /usr/local/bin/python3 -c "import neural_compressor as nc;print(nc.version.__version__)" docker exec test-inc /usr/local/bin/python -c "import neural_compressor as nc;print(nc.version.__version__)" - docker exec test-inc pip install numpy && pip list && python test/test_metrics.py + docker exec test-inc /usr/local/bin/python test/test_metrics.py displayName: 'Run python sciprt' From 0dc83f9ebd153c74b1048bea75926ab41a1cb62c Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Thu, 28 Jul 2022 15:55:05 +0800 Subject: [PATCH 011/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 50c31f2bd52..59c944a15c2 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -34,10 +34,8 @@ stages: Workspace=`pwd` docker run ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -c "pwd && ls -l && pip list" docker run ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python -c "import neural_compressor as nc;print(nc.version.__version__)" - docker run ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python /neural-compressor/test/config/test_config.py + docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python /neural-compressor/test/config/test_config.py docker run --init --name=test-inc -d -u root:root -w ${Workspace} ${IMAGE_NAME}:${IMAGE_TAG} tail -f /dev/null docker exec test-inc /usr/local/bin/python3 -c "import neural_compressor as nc;print(nc.version.__version__)" - docker exec test-inc /usr/local/bin/python -c "import neural_compressor as nc;print(nc.version.__version__)" - docker exec test-inc /usr/local/bin/python test/test_metrics.py displayName: 'Run python sciprt' From a83a2481abec6d3d980d8df606b92a9737fb3c55 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Thu, 28 Jul 2022 16:01:03 +0800 Subject: [PATCH 012/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 59c944a15c2..af56bf8e184 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -31,11 +31,7 @@ stages: displayName: 'Check docker' - script: | - Workspace=`pwd` - docker run ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -c "pwd && ls -l && pip list" docker run ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python -c "import neural_compressor as nc;print(nc.version.__version__)" docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python /neural-compressor/test/config/test_config.py - docker run --init --name=test-inc -d -u root:root -w ${Workspace} ${IMAGE_NAME}:${IMAGE_TAG} tail -f /dev/null - docker exec test-inc /usr/local/bin/python3 -c "import neural_compressor as nc;print(nc.version.__version__)" displayName: 'Run python sciprt' From 1fbd878160d6a9c4f1003a9b0d67f9bb57490ab8 Mon Sep 17 00:00:00 2001 From: letonghan <106566639+letonghan@users.noreply.github.com> Date: Wed, 20 Jul 2022 11:11:33 +0800 Subject: [PATCH 013/271] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000000..6f401c61650 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,36 @@ +# Python package +# Create and test a Python package on multiple Python versions. +# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/python + +trigger: +- master + +pool: + vmImage: ubuntu-latest +strategy: + matrix: + Python27: + python.version: '2.7' + Python35: + python.version: '3.5' + Python36: + python.version: '3.6' + Python37: + python.version: '3.7' + +steps: +- task: UsePythonVersion@0 + inputs: + versionSpec: '$(python.version)' + displayName: 'Use Python $(python.version)' + +- script: | + python -m pip install --upgrade pip + pip install -r requirements.txt + displayName: 'Install dependencies' + +- script: | + pip install pytest pytest-azurepipelines + pytest + displayName: 'pytest' From 0518a4f98404a42ac7948c777d46e3e0d0a8e0f7 Mon Sep 17 00:00:00 2001 From: letonghan <106566639+letonghan@users.noreply.github.com> Date: Fri, 22 Jul 2022 16:45:07 +0800 Subject: [PATCH 014/271] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 93 ++++++++++++++++++++++++++++++--------------- 1 file changed, 62 insertions(+), 31 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6f401c61650..7530cb8974d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,36 +1,67 @@ -# Python package -# Create and test a Python package on multiple Python versions. -# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more: -# https://docs.microsoft.com/azure/devops/pipelines/languages/python +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml -trigger: -- master +pr: + - main -pool: - vmImage: ubuntu-latest -strategy: - matrix: - Python27: - python.version: '2.7' - Python35: - python.version: '3.5' - Python36: - python.version: '3.6' - Python37: - python.version: '3.7' +pool: wenjiao-test -steps: -- task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - displayName: 'Use Python $(python.version)' +stages: + - stage: pylint + jobs: + - job: pylint_test + steps: + - task: Bash@3 + inputs: + targetType: "inline" + script: | + pwd + pip install pylint==2.12.1 + pip install intel-tensorflow + python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto --ignored-modules=tensorflow,torch,torch.quantization,torch.tensor,torchvision,mxnet,onnx,onnxruntime ./neural_compressor > /lpot-pylint.json + # # exit_code=$? + # # if [ ${exit_code} -ne 0 ] ; then + # # echo "PyLint exited with non-zero exit code."; exit 1 + # # fi + # # exit 0 -- script: | - python -m pip install --upgrade pip - pip install -r requirements.txt - displayName: 'Install dependencies' + - stage: bandit + jobs: + - job: bandit_test + steps: + - task: Bash@3 + inputs: + targetType: "inline" +# script: | +# pip install bandit +# # python -m bandit -r -lll -iii neural_compressor > ${WORKSPACE}/lpot-bandit.log +# # exit_code=$? +# # if [ ${exit_code} -ne 0 ] ; then +# # echo "Bandit exited with non-zero exit code."; exit 1 +# # fi +# # exit 0 -- script: | - pip install pytest pytest-azurepipelines - pytest - displayName: 'pytest' + # - stage: pyspelling + # jobs: + # - job: pyspelling_test +# steps: +# - task: Bash@3 +# inputs: +# targetType: "inline" +# script: | +# pip install pyspelling +# # Update paths to validation and lpot repositories +# # VAL_REPO=${WORKSPACE} + +# # sed -i "s|\${VAL_REPO}|$VAL_REPO|g" ${VAL_REPO}/pyspelling_conf.yaml +# # sed -i "s|\${LPOT_REPO}|$REPO_DIR|g" ${VAL_REPO}/pyspelling_conf.yaml +# # echo "Modified config:" +# # cat ${VAL_REPO}/pyspelling_conf.yaml +# # pyspelling -c ${VAL_REPO}/pyspelling_conf.yaml > ${WORKSPACE}/pyspelling_output.log +# # exit_code=$? +# # if [ ${exit_code} -ne 0 ] ; then +# # echo "Pyspelling exited with non-zero exit code."; exit 1 +# # fi +# # exit 0 From 1f428c93243d006863c588144624e7afba187a43 Mon Sep 17 00:00:00 2001 From: letonghan <106566639+letonghan@users.noreply.github.com> Date: Thu, 4 Aug 2022 10:49:05 +0800 Subject: [PATCH 015/271] create pipeline [skip ci] --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7530cb8974d..77719aa486b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -4,7 +4,7 @@ # https://aka.ms/yaml pr: - - main + - letong_performance pool: wenjiao-test From 6cd0f3430d1f1e64cf8389926b55f2e2ae90f42a Mon Sep 17 00:00:00 2001 From: WenjiaoYue <108783334+WenjiaoYue@users.noreply.github.com> Date: Thu, 4 Aug 2022 14:01:41 +0800 Subject: [PATCH 016/271] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines-1.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 azure-pipelines-1.yml diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml new file mode 100644 index 00000000000..27a798ad834 --- /dev/null +++ b/azure-pipelines-1.yml @@ -0,0 +1,19 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +trigger: +- master + +pool: + vmImage: ubuntu-latest + +steps: +- script: echo Hello, world! + displayName: 'Run a one-line script' + +- script: | + echo Add other tasks to build, test, and deploy your project. + echo See https://aka.ms/yaml + displayName: 'Run a multi-line script' From 4a2a86266ab30cddcafb4a4510cdccece6b199f6 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Thu, 4 Aug 2022 15:58:03 +0800 Subject: [PATCH 017/271] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines-1.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index af56bf8e184..7704f650db5 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -6,8 +6,7 @@ pr: - wenxin-test -pool: - vmImage: ubuntu-latest +pool: suyue-test variables: PYTHON: 'python3.8' From 1bca1623f8752a611b7f7161ce46b48ae4197b1b Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Fri, 5 Aug 2022 15:46:17 +0800 Subject: [PATCH 018/271] Update Dockerfile.devel --- docker/Dockerfile.devel | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/docker/Dockerfile.devel b/docker/Dockerfile.devel index 52854413542..66d7d76c81c 100644 --- a/docker/Dockerfile.devel +++ b/docker/Dockerfile.devel @@ -46,13 +46,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ libgl1-mesa-glx \ libglib2.0-0 -ARG INC_BRANCH=v1.12 -RUN git clone --single-branch --branch=${INC_BRANCH} https://github.com/intel/neural-compressor.git && \ - cd neural-compressor && \ - git submodule sync && \ - git submodule update --init --recursive && \ - python -m pip install --no-cache-dir pycocotools && \ - python -m pip install --no-cache-dir -r requirements.txt && \ - python setup.py install - +#ARG INC_BRANCH=v1.12 +#RUN git clone --single-branch --branch=${INC_BRANCH} https://github.com/intel/neural-compressor.git && \ +# cd neural-compressor && \ +# git submodule sync && \ +# git submodule update --init --recursive && \ +# python -m pip install --no-cache-dir pycocotools && \ +# python -m pip install --no-cache-dir -r requirements.txt && \ +# python setup.py install + +WORKDIR / +COPY ./ /neural_compressor +RUN pwd +RUN ls -l +RUN ${PYTHON} setup.py install WORKDIR /neural-compressor From f5d61841aa2977401d390625d885c0be3240fe03 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Fri, 5 Aug 2022 17:07:20 +0800 Subject: [PATCH 019/271] Update Dockerfile.devel --- docker/Dockerfile.devel | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docker/Dockerfile.devel b/docker/Dockerfile.devel index 66d7d76c81c..11204ca98db 100644 --- a/docker/Dockerfile.devel +++ b/docker/Dockerfile.devel @@ -56,8 +56,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ # python setup.py install WORKDIR / -COPY ./ /neural_compressor -RUN pwd -RUN ls -l -RUN ${PYTHON} setup.py install -WORKDIR /neural-compressor +#COPY ./ /neural_compressor +#RUN pwd +#RUN ls -l +#RUN ${PYTHON} setup.py install +#WORKDIR /neural-compressor From 3af7637b7e22839e522741a688f89f5ca26ca4ea Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Fri, 5 Aug 2022 17:13:14 +0800 Subject: [PATCH 020/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 7704f650db5..72fb9b777d4 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -10,10 +10,8 @@ pool: suyue-test variables: PYTHON: 'python3.8' - INC_VER: '1.12' IMAGE_NAME: 'neural-compressor' - IMAGE_TAG: '1.12' - INC_BRANCH: 'master' + IMAGE_TAG: 'py38' stages: - stage: Build @@ -22,15 +20,10 @@ stages: - job: Build displayName: Build steps: - - script: docker build --build-arg PYTHON=${PYTHON} --build-arg INC_BRANCH=${INC_BRANCH} -f docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + - script: docker build --build-arg PYTHON=${PYTHON} -f docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . displayName: 'Build Container' - script: | docker images | grep -i neural-compressor displayName: 'Check docker' - - script: | - docker run ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python -c "import neural_compressor as nc;print(nc.version.__version__)" - docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} /usr/local/bin/python /neural-compressor/test/config/test_config.py - - displayName: 'Run python sciprt' From 9e054a84b27662f84163e05097ed48dad584e410 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Fri, 5 Aug 2022 17:14:44 +0800 Subject: [PATCH 021/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 72fb9b777d4..1d56cb16da4 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -6,7 +6,7 @@ pr: - wenxin-test -pool: suyue-test +pool: docker-agent variables: PYTHON: 'python3.8' From e19e702d24308339c9dfc49217dc14b937b31599 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Fri, 5 Aug 2022 18:45:36 +0800 Subject: [PATCH 022/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 1d56cb16da4..0ba880ebe07 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -20,8 +20,10 @@ stages: - job: Build displayName: Build steps: - - script: docker build --build-arg PYTHON=${PYTHON} -f docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - displayName: 'Build Container' + - script: | + pwd + ls -l + displayName: 'find repo' - script: | docker images | grep -i neural-compressor From b23d2bf769638bd56d322b7ad00e75e47ef07364 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Fri, 5 Aug 2022 18:52:04 +0800 Subject: [PATCH 023/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 0ba880ebe07..e696823dc0f 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -23,6 +23,7 @@ stages: - script: | pwd ls -l + docker run -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python setup.py install" displayName: 'find repo' - script: | From a1eb428b29caed009e807fb4201de9293c3ff87f Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Fri, 5 Aug 2022 18:54:55 +0800 Subject: [PATCH 024/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index e696823dc0f..603989fb69d 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -23,7 +23,7 @@ stages: - script: | pwd ls -l - docker run -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python setup.py install" + docker run -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir pycocotools && python -m pip install --no-cache-dir -r requirements.txt && python setup.py install && pip list" displayName: 'find repo' - script: | From 9a846e0acf8b73fe84b50c37c8694a86cfdd7141 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Fri, 5 Aug 2022 19:17:19 +0800 Subject: [PATCH 025/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 603989fb69d..c7c95197e27 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -23,7 +23,7 @@ stages: - script: | pwd ls -l - docker run -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir pycocotools && python -m pip install --no-cache-dir -r requirements.txt && python setup.py install && pip list" + docker run ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir pycocotools && python -m pip install --no-cache-dir -r requirements.txt && python setup.py install && pip list" displayName: 'find repo' - script: | From 3273a9f0ec91633c7bde9761db440917fe57d4d7 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Fri, 5 Aug 2022 19:21:08 +0800 Subject: [PATCH 026/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index c7c95197e27..fb729f22c63 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -23,7 +23,7 @@ stages: - script: | pwd ls -l - docker run ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir pycocotools && python -m pip install --no-cache-dir -r requirements.txt && python setup.py install && pip list" + #docker run ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir pycocotools && python -m pip install --no-cache-dir -r requirements.txt && python setup.py install && pip list" displayName: 'find repo' - script: | From 121d43c9b810ae3c3b718bcb614c137728b61bb3 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Fri, 5 Aug 2022 19:24:52 +0800 Subject: [PATCH 027/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index fb729f22c63..603989fb69d 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -23,7 +23,7 @@ stages: - script: | pwd ls -l - #docker run ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir pycocotools && python -m pip install --no-cache-dir -r requirements.txt && python setup.py install && pip list" + docker run -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir pycocotools && python -m pip install --no-cache-dir -r requirements.txt && python setup.py install && pip list" displayName: 'find repo' - script: | From 5ad83d2d3987e3b6fdd7581628a4047ffd6c2864 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Fri, 5 Aug 2022 19:35:25 +0800 Subject: [PATCH 028/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 603989fb69d..61675fc255d 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -23,10 +23,11 @@ stages: - script: | pwd ls -l - docker run -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir pycocotools && python -m pip install --no-cache-dir -r requirements.txt && python setup.py install && pip list" + docker run -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir pycocotools && python -m pip install --no-cache-dir -r requirements.txt && python setup.py install && pip list && python test/test_basic.py" displayName: 'find repo' - script: | docker images | grep -i neural-compressor + docker ps displayName: 'Check docker' From e9e76f0f014f12cb17eae78c08d5b17331ff6a4e Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Fri, 5 Aug 2022 19:39:42 +0800 Subject: [PATCH 029/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 61675fc255d..252d4d60056 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -21,13 +21,16 @@ stages: displayName: Build steps: - script: | - pwd - ls -l - docker run -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir pycocotools && python -m pip install --no-cache-dir -r requirements.txt && python setup.py install && pip list && python test/test_basic.py" + pwd + ls -l + docker run -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir pycocotools && python -m pip install --no-cache-dir -r requirements.txt && python setup.py install && pip list && python test/test_basic.py" displayName: 'find repo' - script: | docker images | grep -i neural-compressor docker ps displayName: 'Check docker' - + + - script: | + sudo rm -fr /home/azureuser-inc/myagent/workspace/1/s/* + displayName: 'clean up' From df26b3ef1a6eb450c5565020ffb3fde3607e47d7 Mon Sep 17 00:00:00 2001 From: "chen,suyue" Date: Sun, 7 Aug 2022 21:22:46 +0800 Subject: [PATCH 030/271] add azure pipeline for ut --- .azure-pipelines/docker/Dockerfile.devel | 53 +++++++++ .azure-pipelines/scripts/ut/run_basic.sh | 4 + .../scripts/ut/run_basic_adaptor.sh | 4 + .../scripts/ut/run_basic_adaptor_tfnewapi.sh | 4 + .azure-pipelines/scripts/ut/run_ncoder.sh | 4 + .azure-pipelines/scripts/ut/run_ux.sh | 4 + .azure-pipelines/ut-basic.yml | 104 ++++++++++++++++++ .azure-pipelines/ut-ncoder.yml | 44 ++++++++ .azure-pipelines/ut-ux.yml | 45 ++++++++ 9 files changed, 266 insertions(+) create mode 100644 .azure-pipelines/docker/Dockerfile.devel create mode 100644 .azure-pipelines/scripts/ut/run_basic.sh create mode 100644 .azure-pipelines/scripts/ut/run_basic_adaptor.sh create mode 100644 .azure-pipelines/scripts/ut/run_basic_adaptor_tfnewapi.sh create mode 100644 .azure-pipelines/scripts/ut/run_ncoder.sh create mode 100644 .azure-pipelines/scripts/ut/run_ux.sh create mode 100644 .azure-pipelines/ut-basic.yml create mode 100644 .azure-pipelines/ut-ncoder.yml create mode 100644 .azure-pipelines/ut-ux.yml diff --git a/.azure-pipelines/docker/Dockerfile.devel b/.azure-pipelines/docker/Dockerfile.devel new file mode 100644 index 00000000000..e7ef3909552 --- /dev/null +++ b/.azure-pipelines/docker/Dockerfile.devel @@ -0,0 +1,53 @@ +# +# Copyright (c) 2022 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. + +ARG UBUNTU_VER=20.04 +FROM ubuntu:${UBUNTU_VER} as devel + +# See http://bugs.python.org/issue19846 +ENV LANG C.UTF-8 + +ARG PYTHON=python3.8 +ARG REPO=x +ARG TARGET_BRANCH=y +ARG SOURCE_BRANCH=z +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ + python3 \ + python3-pip \ + ${PYTHON}-dev \ + ${PYTHON}-distutils \ + autoconf \ + build-essential \ + git \ + libgl1-mesa-glx \ + libglib2.0-0 + +RUN ln -sf $(which ${PYTHON}) /usr/bin/python && \ + ln -sf $(which ${PYTHON}) /usr/bin/python3 + +RUN ${PYTHON} -m pip --no-cache-dir install --upgrade \ + pip \ + setuptools + +RUN git clone --single-branch --branch=${SOURCE_BRANCH} ${REPO} neural-compressor && \ + cd neural-compressor && \ + python -m pip install --no-cache-dir pycocotools && \ + python -m pip install --no-cache-dir -r requirements.txt && \ + python setup.py install + +WORKDIR /neural-compressor +RUN git rev-parse HEAD diff --git a/.azure-pipelines/scripts/ut/run_basic.sh b/.azure-pipelines/scripts/ut/run_basic.sh new file mode 100644 index 00000000000..ec312e3a26e --- /dev/null +++ b/.azure-pipelines/scripts/ut/run_basic.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -x +python -c "import neural_compressor as nc;print(nc.version.__version__)" +echo "run basic" \ No newline at end of file diff --git a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh new file mode 100644 index 00000000000..b1b4ea1df24 --- /dev/null +++ b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +python -c "import neural_compressor as nc;print(nc.version.__version__)" +echo "run basic adaptor" diff --git a/.azure-pipelines/scripts/ut/run_basic_adaptor_tfnewapi.sh b/.azure-pipelines/scripts/ut/run_basic_adaptor_tfnewapi.sh new file mode 100644 index 00000000000..fdcf2730401 --- /dev/null +++ b/.azure-pipelines/scripts/ut/run_basic_adaptor_tfnewapi.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -x +python -c "import neural_compressor as nc;print(nc.version.__version__)" +echo "run basic adaptor tfnewapi" \ No newline at end of file diff --git a/.azure-pipelines/scripts/ut/run_ncoder.sh b/.azure-pipelines/scripts/ut/run_ncoder.sh new file mode 100644 index 00000000000..9a13fbb4ce9 --- /dev/null +++ b/.azure-pipelines/scripts/ut/run_ncoder.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -x +python -c "import neural_compressor as nc;print(nc.version.__version__)" +echo "run coder" \ No newline at end of file diff --git a/.azure-pipelines/scripts/ut/run_ux.sh b/.azure-pipelines/scripts/ut/run_ux.sh new file mode 100644 index 00000000000..d331242fa6b --- /dev/null +++ b/.azure-pipelines/scripts/ut/run_ux.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -x +python -c "import neural_compressor as nc;print(nc.version.__version__)" +echo "run ux" \ No newline at end of file diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml new file mode 100644 index 00000000000..16c3dc4109d --- /dev/null +++ b/.azure-pipelines/ut-basic.yml @@ -0,0 +1,104 @@ +trigger: none + +pr: + branches: + include: + - master + paths: + include: + - neural_compressor + exclude: + - neural_compressor.ux + +pool: suyue-test + +variables: + PYTHON: 'python3.8' + IMAGE_NAME: 'neural-compressor' + IMAGE_TAG: 'pr' + +stages: +- stage: + displayName: Unit Test FWKs adaptor + dependsOn: [] + jobs: + - job: + variables: + INC_BRANCH: $(System.PullRequest.SourceBranch) + REPO: $(Build.Repository.Uri) + steps: + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + env | sort + displayName: 'Clean Docker' + + - script: | + echo ${INC_BRANCH} + echo ${REPO} + docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + displayName: 'Build Image' + + - script: | + docker images | grep -i neural-compressor + displayName: 'Check docker image' + + - script: | + docker run -tid --disable-content-trust --privileged --name="pr-test" --hostname="pr-test-container" ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/.azure-pipelines/scripts/ut/run_basic_adaptor.sh + displayName: 'Run UT' + +- stage: + displayName: Unit Test tf newAPI + dependsOn: [] + jobs: + - job: + variables: + INC_BRANCH: $(System.PullRequest.SourceBranch) + REPO: $(Build.Repository.Uri) + steps: + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: 'Clean Docker' + + - script: | + echo ${INC_BRANCH} + echo ${REPO} + docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f $BUILD_SOURCESDIRECTORY/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + displayName: 'Build Image' + + - script: | + docker images | grep -i neural-compressor + displayName: 'Check docker Image' + + - script: | + docker run -tid --disable-content-trust --privileged --name="pr-test" --hostname="pr-test-container" ${IMAGE_NAME}:${IMAGE_TAG} /usr/bin/python /neural-compressor/.azure-pipelines/scripts/ut/run_basic_adaptor.sh + displayName: 'Run UT' + +- stage: + displayName: Unit Test other basic case + dependsOn: [] + jobs: + - job: + variables: + INC_BRANCH: $(System.PullRequest.SourceBranch) + REPO: $(Build.Repository.Uri) + steps: + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: 'Clean Docker' + + - script: | + echo ${INC_BRANCH} + echo ${REPO} + docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f $BUILD_SOURCESDIRECTORY/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + displayName: 'Build Image' + + - script: | + docker images | grep -i neural-compressor + displayName: 'Check docker Image' + - script: | + docker run -tid --disable-content-trust --privileged --name="pr-test" --hostname="pr-test-container" ${IMAGE_NAME}:${IMAGE_TAG} /usr/bin/python /neural-compressor/.azure-pipelines/scripts/ut/run_basic_adaptor.sh + displayName: 'Run UT' + diff --git a/.azure-pipelines/ut-ncoder.yml b/.azure-pipelines/ut-ncoder.yml new file mode 100644 index 00000000000..dd7dde5c113 --- /dev/null +++ b/.azure-pipelines/ut-ncoder.yml @@ -0,0 +1,44 @@ +trigger: none + +pr: + branches: + include: + - master + path: + include: + - neural_coder + +pool: suyue-test + +variables: + PYTHON: 'python3.8' + IMAGE_NAME: 'neural-compressor' + IMAGE_TAG: 'pr' + +stages: +- stage: + displayName: Unit Test for Neural Coder + jobs: + - job: + variables: + INC_BRANCH: $(System.PullRequest.SourceBranch) + REPO: $(Build.Repository.Uri) + steps: + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + env | sort + displayName: 'Clean Docker' + - script: | + echo ${INC_BRANCH} + echo ${REPO} + docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f $SYSTEM_DEFAULTWORKINGDIRECTORY/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + displayName: 'Build Image' + + - script: | + docker images | grep -i neural-compressor + displayName: 'Check docker Image' + + - script: | + docker run -tid --disable-content-trust --privileged --name="pr-test" --hostname="pr-test-container" ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/.azure-pipelines/scripts/ut/run_ncoder.sh + displayName: 'Run UT' \ No newline at end of file diff --git a/.azure-pipelines/ut-ux.yml b/.azure-pipelines/ut-ux.yml new file mode 100644 index 00000000000..11d4b025816 --- /dev/null +++ b/.azure-pipelines/ut-ux.yml @@ -0,0 +1,45 @@ +trigger: none + +pr: + branches: + include: + - master + path: + include: + - neural_compressor.ux + +pool: suyue-test + +variables: + PYTHON: 'python3.8' + IMAGE_NAME: 'neural-compressor' + IMAGE_TAG: 'pr' + +stages: +- stage: + displayName: Unit Test for UX + jobs: + - job: + variables: + INC_BRANCH: $(System.PullRequest.SourceBranch) + REPO: $(Build.Repository.Uri) + steps: + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + env | sort + displayName: 'Clean Docker' + + - script: | + echo ${INC_BRANCH} + echo ${REPO} + docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f $BUILD_SOURCESDIRECTORY/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + displayName: 'Build Image' + + - script: | + docker images | grep -i neural-compressor + displayName: 'Check docker Image' + + - script: | + docker run -tid --disable-content-trust --privileged --name="pr-test" --hostname="pr-test-container" ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/.azure-pipelines/scripts/ut/run_ux.sh + displayName: 'Run UT' \ No newline at end of file From 2e659df87a93848a953580a27ae45c2c7d11ba4d Mon Sep 17 00:00:00 2001 From: "chen,suyue" Date: Sun, 7 Aug 2022 22:12:42 +0800 Subject: [PATCH 031/271] run adaptor test --- .azure-pipelines/scripts/ut/env_setup.sh | 36 ++++++ .../scripts/ut/run_basic_adaptor.sh | 16 +++ .../ut/{run_basic.sh => run_basic_others.sh} | 3 +- .azure-pipelines/ut-basic.yml | 114 +++++++++--------- 4 files changed, 114 insertions(+), 55 deletions(-) create mode 100644 .azure-pipelines/scripts/ut/env_setup.sh rename .azure-pipelines/scripts/ut/{run_basic.sh => run_basic_others.sh} (83%) diff --git a/.azure-pipelines/scripts/ut/env_setup.sh b/.azure-pipelines/scripts/ut/env_setup.sh new file mode 100644 index 00000000000..4391db81842 --- /dev/null +++ b/.azure-pipelines/scripts/ut/env_setup.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +if [[ "${tensorflow_version}" == *"-official" ]]; then + pip install tensorflow==${tensorflow_version%-official} +elif [[ "${tensorflow_version}" != "" ]]; then + pip install intel-tensorflow==${tensorflow_version} + pip install protobuf==3.20.1 +fi + +pip install torch==${pytorch_version} -f https://download.pytorch.org/whl/torch_stable.html +pip install torchvision==${torchvision_version} -f https://download.pytorch.org/whl/torch_stable.html + +pip install onnx==${onnx_version} +pip install onnxruntime==${onnxruntime_version} + +pip install mxnet==${mxnet_version} + +cd /neural-compressor/test +if [ -f "requirements.txt" ]; then + sed -i '/^neural-compressor/d' requirements.txt + sed -i '/^intel-tensorflow/d' requirements.txt + sed -i '/find-links https:\/\/download.pytorch.org\/whl\/torch_stable.html/d' requirements.txt + sed -i '/^torch/d' requirements.txt + sed -i '/^mxnet-mkl/d' requirements.txt + sed -i '/^onnx>=/d;/^onnx==/d;/^onnxruntime>=/d;/^onnxruntime==/d' requirements.txt + n=0 + until [ "$n" -ge 3 ] + do + python -m pip install --no-cache-dir -r requirements.txt && break + n=$((n+1)) + sleep 5 + done + pip list +else + echo "Not found requirements.txt file." +fi diff --git a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh index b1b4ea1df24..7c46e0436e1 100644 --- a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh +++ b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh @@ -2,3 +2,19 @@ python -c "import neural_compressor as nc;print(nc.version.__version__)" echo "run basic adaptor" + +echo "set up UT env..." +bash env_setup.sh + +cd adaptor +find . -name "test*.py" | sed 's,\.\/,python ,g' | sed 's/$/ --verbose/' > run.sh +ut_log_name=${WORKSPACE}/ut_tf_${tensorflow_version}_pt_${pytorch_version}.log + +echo "cat run.sh..." +cat run.sh +echo "-------------" +bash run.sh 2>&1 | tee ${ut_log_name} + +if [ $(grep -c "FAILED" ${ut_log_name}) != 0 ] || [ $(grep -c "OK" ${ut_log_name}) == 0 ];then + exit 1 +fi \ No newline at end of file diff --git a/.azure-pipelines/scripts/ut/run_basic.sh b/.azure-pipelines/scripts/ut/run_basic_others.sh similarity index 83% rename from .azure-pipelines/scripts/ut/run_basic.sh rename to .azure-pipelines/scripts/ut/run_basic_others.sh index ec312e3a26e..de450dd2a61 100644 --- a/.azure-pipelines/scripts/ut/run_basic.sh +++ b/.azure-pipelines/scripts/ut/run_basic_others.sh @@ -1,4 +1,5 @@ #!/bin/bash set -x python -c "import neural_compressor as nc;print(nc.version.__version__)" -echo "run basic" \ No newline at end of file +echo "run basic" + diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml index 16c3dc4109d..900f5f2f22b 100644 --- a/.azure-pipelines/ut-basic.yml +++ b/.azure-pipelines/ut-basic.yml @@ -16,6 +16,12 @@ variables: PYTHON: 'python3.8' IMAGE_NAME: 'neural-compressor' IMAGE_TAG: 'pr' + tensorflow_version: '2.9.1' + pytorch_version: '1.11.0+cpu' + torchvision_version: '0.12.0' + onnx_version: '1.9.0' + onnxruntime_version: '1.10.0' + mxnet_version: '1.7.0' stages: - stage: @@ -47,58 +53,58 @@ stages: docker run -tid --disable-content-trust --privileged --name="pr-test" --hostname="pr-test-container" ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/.azure-pipelines/scripts/ut/run_basic_adaptor.sh displayName: 'Run UT' -- stage: - displayName: Unit Test tf newAPI - dependsOn: [] - jobs: - - job: - variables: - INC_BRANCH: $(System.PullRequest.SourceBranch) - REPO: $(Build.Repository.Uri) - steps: - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: 'Clean Docker' - - - script: | - echo ${INC_BRANCH} - echo ${REPO} - docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f $BUILD_SOURCESDIRECTORY/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - displayName: 'Build Image' - - - script: | - docker images | grep -i neural-compressor - displayName: 'Check docker Image' - - - script: | - docker run -tid --disable-content-trust --privileged --name="pr-test" --hostname="pr-test-container" ${IMAGE_NAME}:${IMAGE_TAG} /usr/bin/python /neural-compressor/.azure-pipelines/scripts/ut/run_basic_adaptor.sh - displayName: 'Run UT' - -- stage: - displayName: Unit Test other basic case - dependsOn: [] - jobs: - - job: - variables: - INC_BRANCH: $(System.PullRequest.SourceBranch) - REPO: $(Build.Repository.Uri) - steps: - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: 'Clean Docker' - - - script: | - echo ${INC_BRANCH} - echo ${REPO} - docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f $BUILD_SOURCESDIRECTORY/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - displayName: 'Build Image' - - - script: | - docker images | grep -i neural-compressor - displayName: 'Check docker Image' - - script: | - docker run -tid --disable-content-trust --privileged --name="pr-test" --hostname="pr-test-container" ${IMAGE_NAME}:${IMAGE_TAG} /usr/bin/python /neural-compressor/.azure-pipelines/scripts/ut/run_basic_adaptor.sh - displayName: 'Run UT' +#- stage: +# displayName: Unit Test tf newAPI +# dependsOn: [] +# jobs: +# - job: +# variables: +# INC_BRANCH: $(System.PullRequest.SourceBranch) +# REPO: $(Build.Repository.Uri) +# steps: +# - script: | +# docker stop $(docker ps -aq) +# docker rm -vf $(docker ps -aq) || true +# displayName: 'Clean Docker' +# +# - script: | +# echo ${INC_BRANCH} +# echo ${REPO} +# docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f $BUILD_SOURCESDIRECTORY/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . +# displayName: 'Build Image' +# +# - script: | +# docker images | grep -i neural-compressor +# displayName: 'Check docker Image' +# +# - script: | +# docker run -tid --disable-content-trust --privileged --name="pr-test" --hostname="pr-test-container" ${IMAGE_NAME}:${IMAGE_TAG} /usr/bin/python /neural-compressor/.azure-pipelines/scripts/ut/run_basic_adaptor_tfnewapi.sh +# displayName: 'Run UT' +# +#- stage: +# displayName: Unit Test other basic case +# dependsOn: [] +# jobs: +# - job: +# variables: +# INC_BRANCH: $(System.PullRequest.SourceBranch) +# REPO: $(Build.Repository.Uri) +# steps: +# - script: | +# docker stop $(docker ps -aq) +# docker rm -vf $(docker ps -aq) || true +# displayName: 'Clean Docker' +# +# - script: | +# echo ${INC_BRANCH} +# echo ${REPO} +# docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f $BUILD_SOURCESDIRECTORY/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . +# displayName: 'Build Image' +# +# - script: | +# docker images | grep -i neural-compressor +# displayName: 'Check docker Image' +# - script: | +# docker run -tid --disable-content-trust --privileged --name="pr-test" --hostname="pr-test-container" ${IMAGE_NAME}:${IMAGE_TAG} /usr/bin/python /neural-compressor/.azure-pipelines/scripts/ut/run_basic_others.sh +# displayName: 'Run UT' From 190c4a4dded05b6e62186eddf8fbde7a144f7ed5 Mon Sep 17 00:00:00 2001 From: "chen,suyue" Date: Sun, 7 Aug 2022 22:13:30 +0800 Subject: [PATCH 032/271] for test --- neural_compressor/version.py | 1 + 1 file changed, 1 insertion(+) diff --git a/neural_compressor/version.py b/neural_compressor/version.py index aa09939a643..d9478f11caa 100644 --- a/neural_compressor/version.py +++ b/neural_compressor/version.py @@ -14,5 +14,6 @@ # 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. +# for test __version__ = "1.13" From b9822a0c840e20317f0dc5a4a781737c02b0bb1d Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Sun, 7 Aug 2022 22:34:36 +0800 Subject: [PATCH 033/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 252d4d60056..8c045913eac 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -23,7 +23,7 @@ stages: - script: | pwd ls -l - docker run -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir pycocotools && python -m pip install --no-cache-dir -r requirements.txt && python setup.py install && pip list && python test/test_basic.py" + docker run -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir pycocotools && python -m pip install --no-cache-dir -r requirements.txt && pip install intel-tensorflow && python setup.py install && pip list && python test/test_algorithm.py" displayName: 'find repo' - script: | From 5c83569e47f46625f9e7ee329a1670ebfa341212 Mon Sep 17 00:00:00 2001 From: "chen,suyue" Date: Sun, 7 Aug 2022 23:30:46 +0800 Subject: [PATCH 034/271] test --- .azure-pipelines/scripts/ut/run_basic_adaptor.sh | 1 + .azure-pipelines/ut-basic.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh index 7c46e0436e1..ab7227784bc 100644 --- a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh +++ b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -x python -c "import neural_compressor as nc;print(nc.version.__version__)" echo "run basic adaptor" diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml index 900f5f2f22b..73d554f8238 100644 --- a/.azure-pipelines/ut-basic.yml +++ b/.azure-pipelines/ut-basic.yml @@ -50,7 +50,7 @@ stages: displayName: 'Check docker image' - script: | - docker run -tid --disable-content-trust --privileged --name="pr-test" --hostname="pr-test-container" ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/.azure-pipelines/scripts/ut/run_basic_adaptor.sh + docker run --disable-content-trust --privileged --name="pr-test" --hostname="pr-test-container" ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/.azure-pipelines/scripts/ut/run_basic_adaptor.sh displayName: 'Run UT' #- stage: From eade71931dec88c18eba812383df68468b6be3c7 Mon Sep 17 00:00:00 2001 From: "chen,suyue" Date: Sun, 7 Aug 2022 23:48:14 +0800 Subject: [PATCH 035/271] print env --- .azure-pipelines/scripts/ut/run_basic_adaptor.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh index ab7227784bc..b786d9d4457 100644 --- a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh +++ b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh @@ -3,7 +3,7 @@ set -x python -c "import neural_compressor as nc;print(nc.version.__version__)" echo "run basic adaptor" - +env | sort echo "set up UT env..." bash env_setup.sh From 5bd154a41e8a5b00946821c403161a3e857f6262 Mon Sep 17 00:00:00 2001 From: "chen,suyue" Date: Mon, 8 Aug 2022 00:11:51 +0800 Subject: [PATCH 036/271] update --- .azure-pipelines/scripts/ut/run_basic_adaptor.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh index b786d9d4457..05f84521e57 100644 --- a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh +++ b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh @@ -3,11 +3,19 @@ set -x python -c "import neural_compressor as nc;print(nc.version.__version__)" echo "run basic adaptor" + env | sort +echo ${tensorflow_version} +echo ${pytorch_version} +export onnx_version='1.9.0' +export onnxruntime_version='1.10.0' +export mxnet_version='1.7.0' + + echo "set up UT env..." -bash env_setup.sh +bash /neural-compressor/.azure-pipelines/scripts/ut/env_setup.sh -cd adaptor +cd /neural-compressor/test/adaptor || exit 1 find . -name "test*.py" | sed 's,\.\/,python ,g' | sed 's/$/ --verbose/' > run.sh ut_log_name=${WORKSPACE}/ut_tf_${tensorflow_version}_pt_${pytorch_version}.log From 6ee7533983223854d37469b3a4bc07f6c3bba9a3 Mon Sep 17 00:00:00 2001 From: "chen,suyue" Date: Mon, 8 Aug 2022 00:38:18 +0800 Subject: [PATCH 037/271] remove image --- .azure-pipelines/ut-basic.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml index 73d554f8238..08daabd7aa1 100644 --- a/.azure-pipelines/ut-basic.yml +++ b/.azure-pipelines/ut-basic.yml @@ -36,6 +36,7 @@ stages: - script: | docker stop $(docker ps -aq) docker rm -vf $(docker ps -aq) || true + docker image rm neural-compressor:pr || true env | sort displayName: 'Clean Docker' From 9deaefdcbe05d302bb450e506761030373781afe Mon Sep 17 00:00:00 2001 From: "chen,suyue" Date: Mon, 8 Aug 2022 11:25:00 +0800 Subject: [PATCH 038/271] test for python --- .azure-pipelines/docker/Dockerfile.devel | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.azure-pipelines/docker/Dockerfile.devel b/.azure-pipelines/docker/Dockerfile.devel index e7ef3909552..34d6f48a186 100644 --- a/.azure-pipelines/docker/Dockerfile.devel +++ b/.azure-pipelines/docker/Dockerfile.devel @@ -28,18 +28,17 @@ ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ python3 \ python3-pip \ - ${PYTHON}-dev \ - ${PYTHON}-distutils \ + python3-dev \ + python3-distutils \ autoconf \ build-essential \ git \ libgl1-mesa-glx \ libglib2.0-0 -RUN ln -sf $(which ${PYTHON}) /usr/bin/python && \ - ln -sf $(which ${PYTHON}) /usr/bin/python3 +RUN ln -sf $(which python3) /usr/bin/python -RUN ${PYTHON} -m pip --no-cache-dir install --upgrade \ +RUN python -m pip --no-cache-dir install --upgrade \ pip \ setuptools @@ -49,5 +48,7 @@ RUN git clone --single-branch --branch=${SOURCE_BRANCH} ${REPO} neural-compresso python -m pip install --no-cache-dir -r requirements.txt && \ python setup.py install +RUN pip list + WORKDIR /neural-compressor RUN git rev-parse HEAD From a906f4637ac1d37222083a47e2ff30ed97045b99 Mon Sep 17 00:00:00 2001 From: "chen,suyue" Date: Mon, 8 Aug 2022 11:32:02 +0800 Subject: [PATCH 039/271] test for python --- .azure-pipelines/docker/Dockerfile.devel | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/docker/Dockerfile.devel b/.azure-pipelines/docker/Dockerfile.devel index 34d6f48a186..ca8a11eda31 100644 --- a/.azure-pipelines/docker/Dockerfile.devel +++ b/.azure-pipelines/docker/Dockerfile.devel @@ -13,13 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -ARG UBUNTU_VER=20.04 +ARG UBUNTU_VER=22.04 FROM ubuntu:${UBUNTU_VER} as devel # See http://bugs.python.org/issue19846 ENV LANG C.UTF-8 -ARG PYTHON=python3.8 ARG REPO=x ARG TARGET_BRANCH=y ARG SOURCE_BRANCH=z @@ -48,7 +47,7 @@ RUN git clone --single-branch --branch=${SOURCE_BRANCH} ${REPO} neural-compresso python -m pip install --no-cache-dir -r requirements.txt && \ python setup.py install -RUN pip list +RUN pip list | grep neural WORKDIR /neural-compressor RUN git rev-parse HEAD From bcb42e55cc4c4f057b9b55381f6e776dc2bbb272 Mon Sep 17 00:00:00 2001 From: "chen,suyue" Date: Mon, 8 Aug 2022 11:38:26 +0800 Subject: [PATCH 040/271] test for python --- .azure-pipelines/docker/Dockerfile.devel | 3 ++- .azure-pipelines/ut-basic.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/docker/Dockerfile.devel b/.azure-pipelines/docker/Dockerfile.devel index ca8a11eda31..a1ab4886017 100644 --- a/.azure-pipelines/docker/Dockerfile.devel +++ b/.azure-pipelines/docker/Dockerfile.devel @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -ARG UBUNTU_VER=22.04 +ARG UBUNTU_VER=20.04 FROM ubuntu:${UBUNTU_VER} as devel # See http://bugs.python.org/issue19846 @@ -47,6 +47,7 @@ RUN git clone --single-branch --branch=${SOURCE_BRANCH} ${REPO} neural-compresso python -m pip install --no-cache-dir -r requirements.txt && \ python setup.py install +RUN pip list RUN pip list | grep neural WORKDIR /neural-compressor diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml index 08daabd7aa1..8d7a6786527 100644 --- a/.azure-pipelines/ut-basic.yml +++ b/.azure-pipelines/ut-basic.yml @@ -43,7 +43,7 @@ stages: - script: | echo ${INC_BRANCH} echo ${REPO} - docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + docker build --build-arg --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . displayName: 'Build Image' - script: | From 6fc988a54c0fa90a1709ea450e8517d96dd2a96e Mon Sep 17 00:00:00 2001 From: "chen,suyue" Date: Mon, 8 Aug 2022 11:40:59 +0800 Subject: [PATCH 041/271] bug fix --- .azure-pipelines/ut-basic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml index 8d7a6786527..4cbd5e908ad 100644 --- a/.azure-pipelines/ut-basic.yml +++ b/.azure-pipelines/ut-basic.yml @@ -43,7 +43,7 @@ stages: - script: | echo ${INC_BRANCH} echo ${REPO} - docker build --build-arg --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + docker build --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . displayName: 'Build Image' - script: | From 40924ede0e918d164d70c0d9ebaf27de2e8c0b28 Mon Sep 17 00:00:00 2001 From: "chen,suyue" Date: Mon, 8 Aug 2022 11:45:31 +0800 Subject: [PATCH 042/271] test --- .azure-pipelines/docker/Dockerfile.devel | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/docker/Dockerfile.devel b/.azure-pipelines/docker/Dockerfile.devel index a1ab4886017..2c670f051ca 100644 --- a/.azure-pipelines/docker/Dockerfile.devel +++ b/.azure-pipelines/docker/Dockerfile.devel @@ -38,11 +38,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ RUN ln -sf $(which python3) /usr/bin/python RUN python -m pip --no-cache-dir install --upgrade \ - pip \ - setuptools + pip RUN git clone --single-branch --branch=${SOURCE_BRANCH} ${REPO} neural-compressor && \ cd neural-compressor && \ + python -m pip install --no-cache-dir setuptools && \ python -m pip install --no-cache-dir pycocotools && \ python -m pip install --no-cache-dir -r requirements.txt && \ python setup.py install From d24f9a10721e260e5cc42a0c814ba8b6a558f387 Mon Sep 17 00:00:00 2001 From: "chen,suyue" Date: Mon, 8 Aug 2022 11:55:07 +0800 Subject: [PATCH 043/271] test --- .azure-pipelines/docker/Dockerfile.devel | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.azure-pipelines/docker/Dockerfile.devel b/.azure-pipelines/docker/Dockerfile.devel index 2c670f051ca..cdec5db4e34 100644 --- a/.azure-pipelines/docker/Dockerfile.devel +++ b/.azure-pipelines/docker/Dockerfile.devel @@ -37,8 +37,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ RUN ln -sf $(which python3) /usr/bin/python -RUN python -m pip --no-cache-dir install --upgrade \ - pip +RUN python -m pip --no-cache-dir install --upgrade pip RUN git clone --single-branch --branch=${SOURCE_BRANCH} ${REPO} neural-compressor && \ cd neural-compressor && \ From 65c516f82badab6a446e95fce048f02c9754e89e Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 12:03:36 +0800 Subject: [PATCH 044/271] Update Dockerfile.devel --- docker/Dockerfile.devel | 46 ++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 30 deletions(-) diff --git a/docker/Dockerfile.devel b/docker/Dockerfile.devel index 11204ca98db..f46e15967a5 100644 --- a/docker/Dockerfile.devel +++ b/docker/Dockerfile.devel @@ -12,52 +12,38 @@ # 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. - ARG UBUNTU_VER=20.04 FROM ubuntu:${UBUNTU_VER} as devel - # See http://bugs.python.org/issue19846 ENV LANG C.UTF-8 -ARG PYTHON=python3.8 -ARG DEBIAN_FRONTEND=noninteractive - +ARG REPO=x +ARG TARGET_BRANCH=y +ARG SOURCE_BRANCH=z RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ python3 \ - python3-pip - -RUN ${PYTHON} -m pip --no-cache-dir install --upgrade \ - pip \ - setuptools - -RUN ln -sf $(which ${PYTHON}) /usr/local/bin/python && \ - ln -sf $(which ${PYTHON}) /usr/local/bin/python3 && \ - ln -sf $(which ${PYTHON}) /usr/bin/python && \ - ln -sf $(which ${PYTHON}) /usr/bin/python3 - -RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ - ${PYTHON}-dev \ - ${PYTHON}-distutils \ + python3-pip \ + python3-dev \ + python3-distutils \ autoconf \ build-essential \ - cmake \ - g++ \ git \ libgl1-mesa-glx \ libglib2.0-0 -#ARG INC_BRANCH=v1.12 -#RUN git clone --single-branch --branch=${INC_BRANCH} https://github.com/intel/neural-compressor.git && \ +RUN ln -sf $(which python3) /usr/bin/python + +RUN python -m pip --no-cache-dir install --upgrade pip +RUN python -m pip install --no-cache-dir setuptools + +#RUN git clone --single-branch --branch=${SOURCE_BRANCH} ${REPO} neural-compressor && \ # cd neural-compressor && \ -# git submodule sync && \ -# git submodule update --init --recursive && \ +# python -m pip install --no-cache-dir setuptools && \ # python -m pip install --no-cache-dir pycocotools && \ # python -m pip install --no-cache-dir -r requirements.txt && \ # python setup.py install +RUN pip list +RUN pip list | grep neural + WORKDIR / -#COPY ./ /neural_compressor -#RUN pwd -#RUN ls -l -#RUN ${PYTHON} setup.py install -#WORKDIR /neural-compressor From 4d67f9564adfec277a4d01e00b546daeafe2fb6f Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 12:29:54 +0800 Subject: [PATCH 045/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 8c045913eac..bfb42dc756b 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -23,7 +23,7 @@ stages: - script: | pwd ls -l - docker run -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir pycocotools && python -m pip install --no-cache-dir -r requirements.txt && pip install intel-tensorflow && python setup.py install && pip list && python test/test_algorithm.py" + docker run -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir setuptools && python -m pip install --no-cache-dir -r requirements.txt && pip install intel-tensorflow && python setup.py install && pip list && python test/test_algorithm.py" displayName: 'find repo' - script: | From a7a60a97852cb3cff275565656e43ef7d712d079 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 13:23:35 +0800 Subject: [PATCH 046/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index bfb42dc756b..f6cb5a9d582 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -23,7 +23,7 @@ stages: - script: | pwd ls -l - docker run -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir setuptools && python -m pip install --no-cache-dir -r requirements.txt && pip install intel-tensorflow && python setup.py install && pip list && python test/test_algorithm.py" + docker run -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir -r requirements.txt && pip install intel-tensorflow && python setup.py install && pip list && python test/test_algorithm.py" displayName: 'find repo' - script: | From f68fd52749b2996bccc72b50f4a5cf12652a73bc Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 14:48:14 +0800 Subject: [PATCH 047/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index f6cb5a9d582..dac4e136921 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -23,7 +23,7 @@ stages: - script: | pwd ls -l - docker run -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir -r requirements.txt && pip install intel-tensorflow && python setup.py install && pip list && python test/test_algorithm.py" + docker run -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir -r requirements.txt && pip install intel-tensorflow && python setup.py sdist bdist_wheel && pip install dist/neural_compressor-1.13-py3-none-any.whl && pip list && python test/strategy/test_bayesian.py" displayName: 'find repo' - script: | From 4d83173e04b884ed4f3bbf1af12dcdbbc3eba61b Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 17:42:10 +0800 Subject: [PATCH 048/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index dac4e136921..c6c776420a5 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -23,7 +23,7 @@ stages: - script: | pwd ls -l - docker run -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir -r requirements.txt && pip install intel-tensorflow && python setup.py sdist bdist_wheel && pip install dist/neural_compressor-1.13-py3-none-any.whl && pip list && python test/strategy/test_bayesian.py" + docker run --rm -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir -r requirements.txt && pip install intel-tensorflow && python setup.py sdist bdist_wheel && pip install dist/neural_compressor-1.13-py3-none-any.whl && pip list && python test/strategy/test_bayesian.py" displayName: 'find repo' - script: | @@ -32,5 +32,6 @@ stages: displayName: 'Check docker' - script: | - sudo rm -fr /home/azureuser-inc/myagent/workspace/1/s/* + #sudo rm -fr /home/azureuser-inc/myagent/workspace/1/s/* + echo "clean up" displayName: 'clean up' From 49d6585d67ccc9ff511063e971e19dcaa7b65293 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 20:03:09 +0800 Subject: [PATCH 049/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index c6c776420a5..80ba51b5478 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -19,7 +19,10 @@ stages: jobs: - job: Build displayName: Build - steps: + steps: + - checkout: self + clean: true + - script: | pwd ls -l @@ -32,6 +35,5 @@ stages: displayName: 'Check docker' - script: | - #sudo rm -fr /home/azureuser-inc/myagent/workspace/1/s/* - echo "clean up" + sudo rm -fr /home/azureuser-inc/myagent/workspace/1/s/* displayName: 'clean up' From 6afaaa74aba6e910346d2b2b04e95b9ff389b523 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 20:10:13 +0800 Subject: [PATCH 050/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 80ba51b5478..b501b6eb6e9 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -20,9 +20,14 @@ stages: - job: Build displayName: Build steps: + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: 'Clean Docker' + - checkout: self clean: true - + - script: | pwd ls -l From 16eca55a380bd1b304a5cc9e40d223feacfcd85e Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 20:16:44 +0800 Subject: [PATCH 051/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index b501b6eb6e9..4b49e14e340 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -17,6 +17,10 @@ stages: - stage: Build displayName: Build and push stage jobs: + - job: Clean + workspace: + clean: all + - job: Build displayName: Build steps: @@ -24,7 +28,7 @@ stages: docker stop $(docker ps -aq) docker rm -vf $(docker ps -aq) || true displayName: 'Clean Docker' - + - checkout: self clean: true From 5bcb46ed69ed6dd8e0dc33738d6a8b79f1e7c692 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 20:23:11 +0800 Subject: [PATCH 052/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 4b49e14e340..f3ea8af14d9 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -18,8 +18,10 @@ stages: displayName: Build and push stage jobs: - job: Clean - workspace: - clean: all + steps: + - script: sudo rm -fr $(Agent.BuildDirectory) || true + #workspace: + # clean: all - job: Build displayName: Build From 660aa6fdf8c3b0a9fb9312e3cc2739ccd0ea78f4 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 20:25:15 +0800 Subject: [PATCH 053/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index f3ea8af14d9..1e659d8cb96 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -19,7 +19,9 @@ stages: jobs: - job: Clean steps: + - checkout: none - script: sudo rm -fr $(Agent.BuildDirectory) || true + - script: echo $(Pipeline.Workspace) && echo $(Agent.BuildDirectory) #workspace: # clean: all From 8fdacae27ef0d05e16c09b876b93682da0676621 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 20:28:46 +0800 Subject: [PATCH 054/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 1e659d8cb96..bca5cd0fff4 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -21,24 +21,19 @@ stages: steps: - checkout: none - script: sudo rm -fr $(Agent.BuildDirectory) || true - - script: echo $(Pipeline.Workspace) && echo $(Agent.BuildDirectory) - #workspace: - # clean: all - - - job: Build - displayName: Build - steps: + displayName: 'Clean workspace' - script: | docker stop $(docker ps -aq) docker rm -vf $(docker ps -aq) || true displayName: 'Clean Docker' - + + - job: Build + displayName: Build + steps: - checkout: self clean: true - script: | - pwd - ls -l docker run --rm -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir -r requirements.txt && pip install intel-tensorflow && python setup.py sdist bdist_wheel && pip install dist/neural_compressor-1.13-py3-none-any.whl && pip list && python test/strategy/test_bayesian.py" displayName: 'find repo' From 00f155edb00c7278b67b4fbff7e01a6e608acf74 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 20:32:34 +0800 Subject: [PATCH 055/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index bca5cd0fff4..83ca3a5a056 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -22,17 +22,17 @@ stages: - checkout: none - script: sudo rm -fr $(Agent.BuildDirectory) || true displayName: 'Clean workspace' - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: 'Clean Docker' - job: Build displayName: Build steps: - checkout: self clean: true - + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: 'Clean Docker' + - script: | docker run --rm -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir -r requirements.txt && pip install intel-tensorflow && python setup.py sdist bdist_wheel && pip install dist/neural_compressor-1.13-py3-none-any.whl && pip list && python test/strategy/test_bayesian.py" displayName: 'find repo' From 0bb62c734ba1c43e7a7ceda476acd684deebfc2f Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 22:37:54 +0800 Subject: [PATCH 056/271] Update Dockerfile.devel --- docker/Dockerfile.devel | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile.devel b/docker/Dockerfile.devel index f46e15967a5..b692fea48e5 100644 --- a/docker/Dockerfile.devel +++ b/docker/Dockerfile.devel @@ -17,9 +17,7 @@ FROM ubuntu:${UBUNTU_VER} as devel # See http://bugs.python.org/issue19846 ENV LANG C.UTF-8 -ARG REPO=x -ARG TARGET_BRANCH=y -ARG SOURCE_BRANCH=z + RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ python3 \ python3-pip \ @@ -44,6 +42,6 @@ RUN python -m pip install --no-cache-dir setuptools # python setup.py install RUN pip list -RUN pip list | grep neural +# RUN pip list | grep neural WORKDIR / From 2599a350c300001285cd01f0603dcc7a3c136f5b Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 23:19:24 +0800 Subject: [PATCH 057/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 83ca3a5a056..7be48da4b34 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -17,31 +17,35 @@ stages: - stage: Build displayName: Build and push stage jobs: - - job: Clean - steps: - - checkout: none - - script: sudo rm -fr $(Agent.BuildDirectory) || true - displayName: 'Clean workspace' - - job: Build displayName: Build steps: + - checkout: none + + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + displayName: 'Clean workspace' + - checkout: self - clean: true + + - script: | + if [[ ! $(docker images | grep -i neural-compressor) ]]; then + docker build -f docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + displayName: "build images" + - script: | docker stop $(docker ps -aq) docker rm -vf $(docker ps -aq) || true displayName: 'Clean Docker' - + - script: | - docker run --rm -v /home/azureuser-inc/myagent/workspace/1/s:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir -r requirements.txt && pip install intel-tensorflow && python setup.py sdist bdist_wheel && pip install dist/neural_compressor-1.13-py3-none-any.whl && pip list && python test/strategy/test_bayesian.py" + docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir -r requirements.txt && pip install intel-tensorflow && python setup.py sdist bdist_wheel && pip install dist/neural_compressor-*.whl && pip list && python test/strategy/test_bayesian.py" displayName: 'find repo' - script: | docker images | grep -i neural-compressor docker ps displayName: 'Check docker' - - - script: | - sudo rm -fr /home/azureuser-inc/myagent/workspace/1/s/* - displayName: 'clean up' + From 4d981d3c884c3d3b84231005666315e9751d7a4a Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 23:27:14 +0800 Subject: [PATCH 058/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 7be48da4b34..902e39d1b20 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -27,7 +27,9 @@ stages: sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true displayName: 'Clean workspace' - - checkout: self + - script: | + git -c fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin + displayName: "checkout repo" - script: | if [[ ! $(docker images | grep -i neural-compressor) ]]; then From 9f4c5a2ae3e1b28729fbc71781654bd3383903ff Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 23:31:47 +0800 Subject: [PATCH 059/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 902e39d1b20..ac5f487eb64 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -28,7 +28,7 @@ stages: displayName: 'Clean workspace' - script: | - git -c fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin + git -c fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin ${BUILD_SOURCESDIRECTORY} displayName: "checkout repo" - script: | From 40336db2707a3f305d2c3aeb92582a567c15cbd8 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 23:37:18 +0800 Subject: [PATCH 060/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index ac5f487eb64..79389431355 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -28,7 +28,9 @@ stages: displayName: 'Clean workspace' - script: | - git -c fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin ${BUILD_SOURCESDIRECTORY} + cd ${BUILD_SOURCESDIRECTORY} + git clone --single-branch --branch=$(System.PullRequest.SourceBranch) $(Build.Repository.Uri) + #git -c fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin ${BUILD_SOURCESDIRECTORY} displayName: "checkout repo" - script: | From c663af84f156dbabf958cdaee4f5826f836c2b9e Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 23:39:49 +0800 Subject: [PATCH 061/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 79389431355..7cfbca35191 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -28,7 +28,7 @@ stages: displayName: 'Clean workspace' - script: | - cd ${BUILD_SOURCESDIRECTORY} + mkdir -p ${BUILD_SOURCESDIRECTORY} && cd ${BUILD_SOURCESDIRECTORY} git clone --single-branch --branch=$(System.PullRequest.SourceBranch) $(Build.Repository.Uri) #git -c fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin ${BUILD_SOURCESDIRECTORY} displayName: "checkout repo" From a7b771755f94ac73782bff26025267dbbea408ab Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 23:41:18 +0800 Subject: [PATCH 062/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 7cfbca35191..97af95bb87a 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -28,7 +28,7 @@ stages: displayName: 'Clean workspace' - script: | - mkdir -p ${BUILD_SOURCESDIRECTORY} && cd ${BUILD_SOURCESDIRECTORY} + #mkdir -p ${BUILD_SOURCESDIRECTORY} && cd ${BUILD_SOURCESDIRECTORY} git clone --single-branch --branch=$(System.PullRequest.SourceBranch) $(Build.Repository.Uri) #git -c fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin ${BUILD_SOURCESDIRECTORY} displayName: "checkout repo" From fae699f938fa9500c22e391952d8c20677105f50 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 23:43:53 +0800 Subject: [PATCH 063/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 97af95bb87a..36783b7f762 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -20,16 +20,18 @@ stages: - job: Build displayName: Build steps: - - checkout: none - script: | echo ${BUILD_SOURCESDIRECTORY} sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true displayName: 'Clean workspace' + - checkout: self + - script: | + echo "checkout repo" #mkdir -p ${BUILD_SOURCESDIRECTORY} && cd ${BUILD_SOURCESDIRECTORY} - git clone --single-branch --branch=$(System.PullRequest.SourceBranch) $(Build.Repository.Uri) + #git clone --single-branch --branch=$(System.PullRequest.SourceBranch) $(Build.Repository.Uri) #git -c fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin ${BUILD_SOURCESDIRECTORY} displayName: "checkout repo" From a999df52499d5f8c99b2deee75a7bc53077dfc72 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Mon, 8 Aug 2022 23:45:49 +0800 Subject: [PATCH 064/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 36783b7f762..5dbfa8e2542 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -27,7 +27,7 @@ stages: displayName: 'Clean workspace' - checkout: self - + - script: | echo "checkout repo" #mkdir -p ${BUILD_SOURCESDIRECTORY} && cd ${BUILD_SOURCESDIRECTORY} @@ -36,6 +36,7 @@ stages: displayName: "checkout repo" - script: | + sudo chmod 666 /var/run/docker.sock if [[ ! $(docker images | grep -i neural-compressor) ]]; then docker build -f docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi From add65e47a254cb57607875158190faa828b3d7fb Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Tue, 9 Aug 2022 11:06:11 +0800 Subject: [PATCH 065/271] Update azure-pipelines-1.yml for Azure Pipelines --- azure-pipelines-1.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 5dbfa8e2542..843c6c1d9e7 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -27,20 +27,13 @@ stages: displayName: 'Clean workspace' - checkout: self - - - script: | - echo "checkout repo" - #mkdir -p ${BUILD_SOURCESDIRECTORY} && cd ${BUILD_SOURCESDIRECTORY} - #git clone --single-branch --branch=$(System.PullRequest.SourceBranch) $(Build.Repository.Uri) - #git -c fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin ${BUILD_SOURCESDIRECTORY} - displayName: "checkout repo" + displayName: "Checkout out Repo" - script: | - sudo chmod 666 /var/run/docker.sock if [[ ! $(docker images | grep -i neural-compressor) ]]; then docker build -f docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi - displayName: "build images" + displayName: "Build Devel Images" - script: | docker stop $(docker ps -aq) @@ -49,7 +42,7 @@ stages: - script: | docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir -r requirements.txt && pip install intel-tensorflow && python setup.py sdist bdist_wheel && pip install dist/neural_compressor-*.whl && pip list && python test/strategy/test_bayesian.py" - displayName: 'find repo' + displayName: 'Build Binary and Run UT' - script: | docker images | grep -i neural-compressor From 00c5a1efa2e5107aecead97b76af0933a1d19b2d Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Tue, 9 Aug 2022 11:26:44 +0800 Subject: [PATCH 066/271] Rename azure-pipelines-1.yml to azure-pipelines-wenxin.yml --- azure-pipelines-1.yml => azure-pipelines-wenxin.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename azure-pipelines-1.yml => azure-pipelines-wenxin.yml (100%) diff --git a/azure-pipelines-1.yml b/azure-pipelines-wenxin.yml similarity index 100% rename from azure-pipelines-1.yml rename to azure-pipelines-wenxin.yml From d0ecc8ab93570a1e5534962e087cb51ba1719f2d Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Tue, 9 Aug 2022 11:50:23 +0800 Subject: [PATCH 067/271] Update azure-pipelines-wenxin.yml for Azure Pipelines --- azure-pipelines-wenxin.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/azure-pipelines-wenxin.yml b/azure-pipelines-wenxin.yml index 843c6c1d9e7..5a55b6b0d3b 100644 --- a/azure-pipelines-wenxin.yml +++ b/azure-pipelines-wenxin.yml @@ -9,7 +9,6 @@ pr: pool: docker-agent variables: - PYTHON: 'python3.8' IMAGE_NAME: 'neural-compressor' IMAGE_TAG: 'py38' @@ -41,7 +40,7 @@ stages: displayName: 'Clean Docker' - script: | - docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir -r requirements.txt && pip install intel-tensorflow && python setup.py sdist bdist_wheel && pip install dist/neural_compressor-*.whl && pip list && python test/strategy/test_bayesian.py" + docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir -r requirements.txt && python setup.py sdist bdist_wheel && pip install dist/neural_compressor-*.whl && pip list && pip install intel-tensorflow && python test/strategy/test_bayesian.py" displayName: 'Build Binary and Run UT' - script: | From c467c3b450a083fb750274a53bbce65719b517e3 Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Tue, 9 Aug 2022 14:12:27 +0800 Subject: [PATCH 068/271] Update and rename azure-pipelines-wenxin.yml to .azure-pipelines/azure-pipelines-demo.yml --- .../azure-pipelines-demo.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) rename azure-pipelines-wenxin.yml => .azure-pipelines/azure-pipelines-demo.yml (95%) diff --git a/azure-pipelines-wenxin.yml b/.azure-pipelines/azure-pipelines-demo.yml similarity index 95% rename from azure-pipelines-wenxin.yml rename to .azure-pipelines/azure-pipelines-demo.yml index 5a55b6b0d3b..7ad0938dd32 100644 --- a/azure-pipelines-wenxin.yml +++ b/.azure-pipelines/azure-pipelines-demo.yml @@ -3,6 +3,7 @@ # Add steps that build, run tests, deploy, and more: # https://aka.ms/yaml +trigger: none pr: - wenxin-test @@ -19,7 +20,6 @@ stages: - job: Build displayName: Build steps: - - script: | echo ${BUILD_SOURCESDIRECTORY} sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true @@ -32,6 +32,8 @@ stages: if [[ ! $(docker images | grep -i neural-compressor) ]]; then docker build -f docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi + docker images | grep -i neural-compressor + [[ $? -ne 0 ]] && exit 1 displayName: "Build Devel Images" - script: | @@ -43,8 +45,4 @@ stages: docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir -r requirements.txt && python setup.py sdist bdist_wheel && pip install dist/neural_compressor-*.whl && pip list && pip install intel-tensorflow && python test/strategy/test_bayesian.py" displayName: 'Build Binary and Run UT' - - script: | - docker images | grep -i neural-compressor - docker ps - displayName: 'Check docker' From e739875dabe086f971a869a47bc6e40569fb3cde Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Tue, 9 Aug 2022 14:14:28 +0800 Subject: [PATCH 069/271] Update Dockerfile.devel --- docker/Dockerfile.devel | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/docker/Dockerfile.devel b/docker/Dockerfile.devel index b692fea48e5..441c68aa705 100644 --- a/docker/Dockerfile.devel +++ b/docker/Dockerfile.devel @@ -14,10 +14,10 @@ # limitations under the License. ARG UBUNTU_VER=20.04 FROM ubuntu:${UBUNTU_VER} as devel + # See http://bugs.python.org/issue19846 ENV LANG C.UTF-8 - RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ python3 \ python3-pip \ @@ -34,14 +34,6 @@ RUN ln -sf $(which python3) /usr/bin/python RUN python -m pip --no-cache-dir install --upgrade pip RUN python -m pip install --no-cache-dir setuptools -#RUN git clone --single-branch --branch=${SOURCE_BRANCH} ${REPO} neural-compressor && \ -# cd neural-compressor && \ -# python -m pip install --no-cache-dir setuptools && \ -# python -m pip install --no-cache-dir pycocotools && \ -# python -m pip install --no-cache-dir -r requirements.txt && \ -# python setup.py install - RUN pip list -# RUN pip list | grep neural WORKDIR / From 92111efd7a8288daf0a92d0aaa4cdd94bf555322 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Tue, 9 Aug 2022 14:21:07 +0800 Subject: [PATCH 070/271] update dockerfile name --- .../docker/{Dockerfile.devel => Dockerfile-inc.devel} | 0 .azure-pipelines/ut-basic.yml | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) rename .azure-pipelines/docker/{Dockerfile.devel => Dockerfile-inc.devel} (100%) diff --git a/.azure-pipelines/docker/Dockerfile.devel b/.azure-pipelines/docker/Dockerfile-inc.devel similarity index 100% rename from .azure-pipelines/docker/Dockerfile.devel rename to .azure-pipelines/docker/Dockerfile-inc.devel diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml index 4cbd5e908ad..3949fd789ef 100644 --- a/.azure-pipelines/ut-basic.yml +++ b/.azure-pipelines/ut-basic.yml @@ -43,7 +43,7 @@ stages: - script: | echo ${INC_BRANCH} echo ${REPO} - docker build --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile-inc.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . displayName: 'Build Image' - script: | @@ -71,7 +71,7 @@ stages: # - script: | # echo ${INC_BRANCH} # echo ${REPO} -# docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f $BUILD_SOURCESDIRECTORY/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . +# docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f $BUILD_SOURCESDIRECTORY/.azure-pipelines/docker/Dockerfile-inc.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . # displayName: 'Build Image' # # - script: | @@ -99,7 +99,7 @@ stages: # - script: | # echo ${INC_BRANCH} # echo ${REPO} -# docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f $BUILD_SOURCESDIRECTORY/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . +# docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f $BUILD_SOURCESDIRECTORY/.azure-pipelines/docker/Dockerfile-inc.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . # displayName: 'Build Image' # # - script: | From 8fcd6492a53ec0162d42e699ac82507a046537c7 Mon Sep 17 00:00:00 2001 From: sys-lpot-val Date: Wed, 10 Aug 2022 13:57:40 +0800 Subject: [PATCH 071/271] clean up --- .azure-pipelines/docker/Dockerfile.devel | 28 ++++++------------------ 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/.azure-pipelines/docker/Dockerfile.devel b/.azure-pipelines/docker/Dockerfile.devel index e7ef3909552..441c68aa705 100644 --- a/.azure-pipelines/docker/Dockerfile.devel +++ b/.azure-pipelines/docker/Dockerfile.devel @@ -12,42 +12,28 @@ # 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. - ARG UBUNTU_VER=20.04 FROM ubuntu:${UBUNTU_VER} as devel # See http://bugs.python.org/issue19846 ENV LANG C.UTF-8 -ARG PYTHON=python3.8 -ARG REPO=x -ARG TARGET_BRANCH=y -ARG SOURCE_BRANCH=z -ARG DEBIAN_FRONTEND=noninteractive - RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ python3 \ python3-pip \ - ${PYTHON}-dev \ - ${PYTHON}-distutils \ + python3-dev \ + python3-distutils \ autoconf \ build-essential \ git \ libgl1-mesa-glx \ libglib2.0-0 -RUN ln -sf $(which ${PYTHON}) /usr/bin/python && \ - ln -sf $(which ${PYTHON}) /usr/bin/python3 +RUN ln -sf $(which python3) /usr/bin/python -RUN ${PYTHON} -m pip --no-cache-dir install --upgrade \ - pip \ - setuptools +RUN python -m pip --no-cache-dir install --upgrade pip +RUN python -m pip install --no-cache-dir setuptools -RUN git clone --single-branch --branch=${SOURCE_BRANCH} ${REPO} neural-compressor && \ - cd neural-compressor && \ - python -m pip install --no-cache-dir pycocotools && \ - python -m pip install --no-cache-dir -r requirements.txt && \ - python setup.py install +RUN pip list -WORKDIR /neural-compressor -RUN git rev-parse HEAD +WORKDIR / From df6b7b1c9caacc890022052934f6a84a243452dc Mon Sep 17 00:00:00 2001 From: sys-lpot-val Date: Wed, 10 Aug 2022 13:59:26 +0800 Subject: [PATCH 072/271] clean up --- docker/Dockerfile.devel | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/docker/Dockerfile.devel b/docker/Dockerfile.devel index 441c68aa705..31afb67c918 100644 --- a/docker/Dockerfile.devel +++ b/docker/Dockerfile.devel @@ -12,28 +12,51 @@ # 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. + ARG UBUNTU_VER=20.04 FROM ubuntu:${UBUNTU_VER} as devel # See http://bugs.python.org/issue19846 ENV LANG C.UTF-8 +ARG PYTHON=python3.8 +ARG DEBIAN_FRONTEND=noninteractive + RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ python3 \ - python3-pip \ - python3-dev \ - python3-distutils \ + python3-pip + +RUN ${PYTHON} -m pip --no-cache-dir install --upgrade \ + pip \ + setuptools + +RUN ln -sf $(which ${PYTHON}) /usr/local/bin/python && \ + ln -sf $(which ${PYTHON}) /usr/local/bin/python3 && \ + ln -sf $(which ${PYTHON}) /usr/bin/python && \ + ln -sf $(which ${PYTHON}) /usr/bin/python3 + +RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ + ${PYTHON}-dev \ + ${PYTHON}-distutils \ autoconf \ build-essential \ + cmake \ + g++ \ git \ libgl1-mesa-glx \ libglib2.0-0 -RUN ln -sf $(which python3) /usr/bin/python - -RUN python -m pip --no-cache-dir install --upgrade pip -RUN python -m pip install --no-cache-dir setuptools +ARG INC_BRANCH=v1.12 +RUN git clone --single-branch --branch=${INC_BRANCH} https://github.com/intel/neural-compressor.git && \ + cd neural-compressor && \ + git submodule sync && \ + git submodule update --init --recursive && \ + python -m pip install --no-cache-dir pycocotools && \ + python -m pip install --no-cache-dir -r requirements.txt && \ + python setup.py install -RUN pip list +WORKDIR /neural-compressor -WORKDIR / +ADD https://raw.githubusercontent.com/intel/neural-compressor/v${INC_VER}/third-party-programs.txt /licenses/ +ADD https://raw.githubusercontent.com/intel/neural-compressor/v${INC_VER}/docker/third-party-programs-docker.txt /licenses/ +ADD https://raw.githubusercontent.com/intel/neural-compressor/v${INC_VER}/LICENSE /licenses/ From de4a174bbd80cad7d32e074bf861b675788e02d1 Mon Sep 17 00:00:00 2001 From: sys-lpot-val Date: Wed, 10 Aug 2022 14:01:51 +0800 Subject: [PATCH 073/271] clean up --- .azure-pipelines/azure-pipelines-demo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/azure-pipelines-demo.yml b/.azure-pipelines/azure-pipelines-demo.yml index 7ad0938dd32..b9fd5baf592 100644 --- a/.azure-pipelines/azure-pipelines-demo.yml +++ b/.azure-pipelines/azure-pipelines-demo.yml @@ -30,7 +30,7 @@ stages: - script: | if [[ ! $(docker images | grep -i neural-compressor) ]]; then - docker build -f docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi docker images | grep -i neural-compressor [[ $? -ne 0 ]] && exit 1 From 2236cba8ad1a837ea2a63856e7fda47848485bcf Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Tue, 9 Aug 2022 14:44:00 +0800 Subject: [PATCH 074/271] Update azure-pipelines-demo.yml --- .azure-pipelines/azure-pipelines-demo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/azure-pipelines-demo.yml b/.azure-pipelines/azure-pipelines-demo.yml index b9fd5baf592..7c1ae3953fe 100644 --- a/.azure-pipelines/azure-pipelines-demo.yml +++ b/.azure-pipelines/azure-pipelines-demo.yml @@ -42,7 +42,7 @@ stages: displayName: 'Clean Docker' - script: | - docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir -r requirements.txt && python setup.py sdist bdist_wheel && pip install dist/neural_compressor-*.whl && pip list && pip install intel-tensorflow && python test/strategy/test_bayesian.py" + docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir -r requirements.txt && python setup.py sdist bdist_wheel && pip install dist/neural_compressor-*.whl && pip list && python test/strategy/test_bayesian.py" displayName: 'Build Binary and Run UT' From ce20191cd47802c348ff71db0004ea3c707cc26f Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Tue, 9 Aug 2022 14:48:25 +0800 Subject: [PATCH 075/271] Update azure-pipelines-demo.yml for Azure Pipelines --- .azure-pipelines/azure-pipelines-demo.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/azure-pipelines-demo.yml b/.azure-pipelines/azure-pipelines-demo.yml index 7c1ae3953fe..0fc6a1968f4 100644 --- a/.azure-pipelines/azure-pipelines-demo.yml +++ b/.azure-pipelines/azure-pipelines-demo.yml @@ -29,11 +29,14 @@ stages: displayName: "Checkout out Repo" - script: | - if [[ ! $(docker images | grep -i neural-compressor) ]]; then + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi - docker images | grep -i neural-compressor - [[ $? -ne 0 ]] && exit 1 + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi displayName: "Build Devel Images" - script: | From f0f27c95ab7e6a841889b1313b123f39d8df06fa Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Tue, 9 Aug 2022 16:07:33 +0800 Subject: [PATCH 076/271] Update azure-pipelines-demo.yml --- .azure-pipelines/azure-pipelines-demo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/azure-pipelines-demo.yml b/.azure-pipelines/azure-pipelines-demo.yml index 0fc6a1968f4..b6eb669b2f6 100644 --- a/.azure-pipelines/azure-pipelines-demo.yml +++ b/.azure-pipelines/azure-pipelines-demo.yml @@ -45,7 +45,7 @@ stages: displayName: 'Clean Docker' - script: | - docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir -r requirements.txt && python setup.py sdist bdist_wheel && pip install dist/neural_compressor-*.whl && pip list && python test/strategy/test_bayesian.py" + docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && python -m pip install --no-cache-dir -r requirements.txt && python setup.py sdist bdist_wheel && pip install dist/neural_compressor-*.whl && pip list && pip install intel-tensorflow && python test/strategy/test_bayesian.py" displayName: 'Build Binary and Run UT' From 123e210681b01b6213b937468772565f74f4ac6c Mon Sep 17 00:00:00 2001 From: VincyZhang Date: Tue, 9 Aug 2022 17:06:27 +0800 Subject: [PATCH 077/271] Update README.md --- docker/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/README.md b/docker/README.md index dd8b285c1ab..dc3923e1ec4 100644 --- a/docker/README.md +++ b/docker/README.md @@ -6,7 +6,7 @@ https://pypi.org/project/neural-compressor/#history ```console $ PYTHON=python3.8 -$ INC_VER=1.12 +$ INC_VER=1.13 $ IMAGE_NAME=neural-compressor $ IMAGE_TAG=${INC_VER} $ docker build --build-arg PYTHON=${PYTHON} --build-arg INC_VER=${INC_VER} -f Dockerfile -t ${IMAGE_NAME}:${IMAGE_TAG} . @@ -20,7 +20,7 @@ then please modify the tag so that the tagging requirement is met. For example r ```console $ PYTHON=python3.8 -$ INC_BRANCH=v1.12 +$ INC_BRANCH=v1.13 $ IMAGE_NAME=neural-compressor $ IMAGE_TAG=${INC_BRANCH}-devel $ docker build --build-arg PYTHON=${PYTHON} --build-arg INC_BRANCH=${INC_BRANCH} -f Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . From 13ed112d37b03bfad2c22e58cf91b0ef417ce30e Mon Sep 17 00:00:00 2001 From: chensuyue Date: Tue, 9 Aug 2022 21:58:47 +0800 Subject: [PATCH 078/271] resolve conflict --- .../docker/{Dockerfile-inc.devel => DockerfileWithNC.devel} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .azure-pipelines/docker/{Dockerfile-inc.devel => DockerfileWithNC.devel} (98%) diff --git a/.azure-pipelines/docker/Dockerfile-inc.devel b/.azure-pipelines/docker/DockerfileWithNC.devel similarity index 98% rename from .azure-pipelines/docker/Dockerfile-inc.devel rename to .azure-pipelines/docker/DockerfileWithNC.devel index cdec5db4e34..113fdead9b9 100644 --- a/.azure-pipelines/docker/Dockerfile-inc.devel +++ b/.azure-pipelines/docker/DockerfileWithNC.devel @@ -50,4 +50,4 @@ RUN pip list RUN pip list | grep neural WORKDIR /neural-compressor -RUN git rev-parse HEAD +RUN git rev-parse HEAD \ No newline at end of file From 368cd034d9cee7f80c46baadb127b38f366e37bf Mon Sep 17 00:00:00 2001 From: chensuyue Date: Tue, 9 Aug 2022 22:01:07 +0800 Subject: [PATCH 079/271] resolve conflict --- .azure-pipelines/docker/Dockerfile.devel | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .azure-pipelines/docker/Dockerfile.devel diff --git a/.azure-pipelines/docker/Dockerfile.devel b/.azure-pipelines/docker/Dockerfile.devel new file mode 100644 index 00000000000..ea08201046b --- /dev/null +++ b/.azure-pipelines/docker/Dockerfile.devel @@ -0,0 +1,39 @@ +# +# Copyright (c) 2022 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. +ARG UBUNTU_VER=20.04 +FROM ubuntu:${UBUNTU_VER} as devel + +# See http://bugs.python.org/issue19846 +ENV LANG C.UTF-8 + +RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ + python3 \ + python3-pip \ + python3-dev \ + python3-distutils \ + autoconf \ + build-essential \ + git \ + libgl1-mesa-glx \ + libglib2.0-0 + +RUN ln -sf $(which python3) /usr/bin/python + +RUN python -m pip --no-cache-dir install --upgrade pip +RUN python -m pip install --no-cache-dir setuptools + +RUN pip list + +WORKDIR / \ No newline at end of file From 054ef05e7ed60667208e560da64f9efcc56e517d Mon Sep 17 00:00:00 2001 From: chensuyue Date: Tue, 9 Aug 2022 22:55:34 +0800 Subject: [PATCH 080/271] update ut test --- .azure-pipelines/scripts/install_nc.sh | 7 +++ .azure-pipelines/scripts/install_nc_full.sh | 7 +++ .azure-pipelines/scripts/ut/env_setup.sh | 1 - .../scripts/ut/run_basic_adaptor.sh | 15 +++---- .azure-pipelines/ut-basic.yml | 44 +++++++++---------- 5 files changed, 40 insertions(+), 34 deletions(-) create mode 100644 .azure-pipelines/scripts/install_nc.sh create mode 100644 .azure-pipelines/scripts/install_nc_full.sh diff --git a/.azure-pipelines/scripts/install_nc.sh b/.azure-pipelines/scripts/install_nc.sh new file mode 100644 index 00000000000..8fdd193d8c6 --- /dev/null +++ b/.azure-pipelines/scripts/install_nc.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +cd /neural_compressor +python -m pip install --no-cache-dir -r requirements.txt +python setup.py sdist bdist_wheel +pip install dist/neural_compressor-*.whl +pip list \ No newline at end of file diff --git a/.azure-pipelines/scripts/install_nc_full.sh b/.azure-pipelines/scripts/install_nc_full.sh new file mode 100644 index 00000000000..0e0cca549fc --- /dev/null +++ b/.azure-pipelines/scripts/install_nc_full.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +cd /neural_compressor +python -m pip install --no-cache-dir -r requirements.txt +python setup.py --full sdist bdist_wheel +pip install dist/neural_compressor-*.whl +pip list \ No newline at end of file diff --git a/.azure-pipelines/scripts/ut/env_setup.sh b/.azure-pipelines/scripts/ut/env_setup.sh index 4391db81842..4b2145a7e48 100644 --- a/.azure-pipelines/scripts/ut/env_setup.sh +++ b/.azure-pipelines/scripts/ut/env_setup.sh @@ -4,7 +4,6 @@ if [[ "${tensorflow_version}" == *"-official" ]]; then pip install tensorflow==${tensorflow_version%-official} elif [[ "${tensorflow_version}" != "" ]]; then pip install intel-tensorflow==${tensorflow_version} - pip install protobuf==3.20.1 fi pip install torch==${pytorch_version} -f https://download.pytorch.org/whl/torch_stable.html diff --git a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh index 05f84521e57..d3b1f592022 100644 --- a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh +++ b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh @@ -1,22 +1,19 @@ #!/bin/bash set -x -python -c "import neural_compressor as nc;print(nc.version.__version__)" -echo "run basic adaptor" - -env | sort -echo ${tensorflow_version} -echo ${pytorch_version} +echo "specify fwk version..." +export tensorflow_version='2.9.1' +export pytorch_version='1.11.0+cpu' +export torchvision_version='0.12.0' export onnx_version='1.9.0' export onnxruntime_version='1.10.0' export mxnet_version='1.7.0' - echo "set up UT env..." bash /neural-compressor/.azure-pipelines/scripts/ut/env_setup.sh -cd /neural-compressor/test/adaptor || exit 1 -find . -name "test*.py" | sed 's,\.\/,python ,g' | sed 's/$/ --verbose/' > run.sh +cd /neural-compressor/test || exit 1 +find ./adaptor -name "test*.py" | sed 's,\.\/,python ,g' | sed 's/$/ --verbose/' > run.sh ut_log_name=${WORKSPACE}/ut_tf_${tensorflow_version}_pt_${pytorch_version}.log echo "cat run.sh..." diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml index 3949fd789ef..ebb92afeeb6 100644 --- a/.azure-pipelines/ut-basic.yml +++ b/.azure-pipelines/ut-basic.yml @@ -13,15 +13,8 @@ pr: pool: suyue-test variables: - PYTHON: 'python3.8' IMAGE_NAME: 'neural-compressor' - IMAGE_TAG: 'pr' - tensorflow_version: '2.9.1' - pytorch_version: '1.11.0+cpu' - torchvision_version: '0.12.0' - onnx_version: '1.9.0' - onnxruntime_version: '1.10.0' - mxnet_version: '1.7.0' + IMAGE_TAG: 'py38' stages: - stage: @@ -29,30 +22,33 @@ stages: dependsOn: [] jobs: - job: - variables: - INC_BRANCH: $(System.PullRequest.SourceBranch) - REPO: $(Build.Repository.Uri) steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + displayName: 'Clean workspace' + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Docker Image" - script: | docker stop $(docker ps -aq) docker rm -vf $(docker ps -aq) || true - docker image rm neural-compressor:pr || true env | sort displayName: 'Clean Docker' - script: | - echo ${INC_BRANCH} - echo ${REPO} - docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile-inc.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - displayName: 'Build Image' - - - script: | - docker images | grep -i neural-compressor - displayName: 'Check docker image' - - - script: | - docker run --disable-content-trust --privileged --name="pr-test" --hostname="pr-test-container" ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/.azure-pipelines/scripts/ut/run_basic_adaptor.sh - displayName: 'Run UT' + 'docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} + bash -x -c "cd /neural-compressor/.azure-pipelines/scripts + && bash install_nc.sh + && bash ut/run_basic_adaptor.sh"' + displayName: 'Install Neural Compressor and Run UT' #- stage: # displayName: Unit Test tf newAPI From 94ae9f21be43958dd28a0e2054582c80560a18ee Mon Sep 17 00:00:00 2001 From: chensuyue Date: Tue, 9 Aug 2022 23:21:12 +0800 Subject: [PATCH 081/271] for test --- .azure-pipelines/ut-basic.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml index ebb92afeeb6..0ecb3fbc56a 100644 --- a/.azure-pipelines/ut-basic.yml +++ b/.azure-pipelines/ut-basic.yml @@ -23,10 +23,6 @@ stages: jobs: - job: steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - displayName: 'Clean workspace' - script: | if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . @@ -65,8 +61,6 @@ stages: # displayName: 'Clean Docker' # # - script: | -# echo ${INC_BRANCH} -# echo ${REPO} # docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f $BUILD_SOURCESDIRECTORY/.azure-pipelines/docker/Dockerfile-inc.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . # displayName: 'Build Image' # From 085576c19de071a33655ee0b0be6ce2562daba6d Mon Sep 17 00:00:00 2001 From: chensuyue Date: Tue, 9 Aug 2022 23:23:21 +0800 Subject: [PATCH 082/271] fix bug --- .azure-pipelines/ut-basic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml index 0ecb3fbc56a..9f822a33545 100644 --- a/.azure-pipelines/ut-basic.yml +++ b/.azure-pipelines/ut-basic.yml @@ -24,7 +24,7 @@ stages: - job: steps: - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi docker images | grep -i ${IMAGE_NAME} From 7be4c4c449e781342cbd56f8d8ed7dce3d0bc3be Mon Sep 17 00:00:00 2001 From: chensuyue Date: Tue, 9 Aug 2022 23:31:20 +0800 Subject: [PATCH 083/271] bug fix --- .azure-pipelines/ut-basic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml index 9f822a33545..36d69361031 100644 --- a/.azure-pipelines/ut-basic.yml +++ b/.azure-pipelines/ut-basic.yml @@ -40,7 +40,7 @@ stages: displayName: 'Clean Docker' - script: | - 'docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} + 'docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash -x -c "cd /neural-compressor/.azure-pipelines/scripts && bash install_nc.sh && bash ut/run_basic_adaptor.sh"' From 17fded4760e44d81af740495d378f683b9aec3ed Mon Sep 17 00:00:00 2001 From: chensuyue Date: Tue, 9 Aug 2022 23:34:40 +0800 Subject: [PATCH 084/271] test --- .azure-pipelines/ut-basic.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml index 36d69361031..cb373323f9c 100644 --- a/.azure-pipelines/ut-basic.yml +++ b/.azure-pipelines/ut-basic.yml @@ -40,10 +40,10 @@ stages: displayName: 'Clean Docker' - script: | - 'docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} - bash -x -c "cd /neural-compressor/.azure-pipelines/scripts - && bash install_nc.sh - && bash ut/run_basic_adaptor.sh"' + docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} + bash -x -c "cd /neural-compressor/.azure-pipelines/scripts \ + && bash install_nc.sh \ + && bash ut/run_basic_adaptor.sh" displayName: 'Install Neural Compressor and Run UT' #- stage: From 9482fe7af24daa8a5c7d69f235132ca5b5754529 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Tue, 9 Aug 2022 23:40:59 +0800 Subject: [PATCH 085/271] test 1 --- .azure-pipelines/ut-basic.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml index cb373323f9c..11f1b813438 100644 --- a/.azure-pipelines/ut-basic.yml +++ b/.azure-pipelines/ut-basic.yml @@ -40,8 +40,8 @@ stages: displayName: 'Clean Docker' - script: | - docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} - bash -x -c "cd /neural-compressor/.azure-pipelines/scripts \ + docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} \ + bash -c "cd /neural-compressor/.azure-pipelines/scripts \ && bash install_nc.sh \ && bash ut/run_basic_adaptor.sh" displayName: 'Install Neural Compressor and Run UT' From 9827f74a5c3aedbc6ddc80d6ce4cc20b59d2f860 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Tue, 9 Aug 2022 23:47:15 +0800 Subject: [PATCH 086/271] bug fix --- .azure-pipelines/scripts/install_nc.sh | 2 +- .azure-pipelines/scripts/install_nc_full.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/scripts/install_nc.sh b/.azure-pipelines/scripts/install_nc.sh index 8fdd193d8c6..5b6fdc6460d 100644 --- a/.azure-pipelines/scripts/install_nc.sh +++ b/.azure-pipelines/scripts/install_nc.sh @@ -1,6 +1,6 @@ #!/bin/bash -cd /neural_compressor +cd /neural-compressor python -m pip install --no-cache-dir -r requirements.txt python setup.py sdist bdist_wheel pip install dist/neural_compressor-*.whl diff --git a/.azure-pipelines/scripts/install_nc_full.sh b/.azure-pipelines/scripts/install_nc_full.sh index 0e0cca549fc..b99d2ab305f 100644 --- a/.azure-pipelines/scripts/install_nc_full.sh +++ b/.azure-pipelines/scripts/install_nc_full.sh @@ -1,6 +1,6 @@ #!/bin/bash -cd /neural_compressor +cd /neural-compressor python -m pip install --no-cache-dir -r requirements.txt python setup.py --full sdist bdist_wheel pip install dist/neural_compressor-*.whl From 1cc8d7c81f8cbb5c99154aa51978cccbdfbf02a5 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Tue, 9 Aug 2022 23:52:32 +0800 Subject: [PATCH 087/271] add log_dir --- .azure-pipelines/scripts/ut/run_basic_adaptor.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh index d3b1f592022..faf89569b15 100644 --- a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh +++ b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh @@ -14,7 +14,9 @@ bash /neural-compressor/.azure-pipelines/scripts/ut/env_setup.sh cd /neural-compressor/test || exit 1 find ./adaptor -name "test*.py" | sed 's,\.\/,python ,g' | sed 's/$/ --verbose/' > run.sh -ut_log_name=${WORKSPACE}/ut_tf_${tensorflow_version}_pt_${pytorch_version}.log + +LOG_DIR=/neural-compressor/log_dir +ut_log_name=${LOG_DIR}/ut_tf_${tensorflow_version}_pt_${pytorch_version}.log echo "cat run.sh..." cat run.sh From 2eacf82627cc38b7ffcd0463c983ded85119c408 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Wed, 10 Aug 2022 00:14:36 +0800 Subject: [PATCH 088/271] for test --- .azure-pipelines/docker/Dockerfile.devel | 5 +- .azure-pipelines/ut-basic.yml | 110 ++++++++++++----------- 2 files changed, 62 insertions(+), 53 deletions(-) diff --git a/.azure-pipelines/docker/Dockerfile.devel b/.azure-pipelines/docker/Dockerfile.devel index e670744fa12..5e9db3f57b7 100644 --- a/.azure-pipelines/docker/Dockerfile.devel +++ b/.azure-pipelines/docker/Dockerfile.devel @@ -27,7 +27,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ build-essential \ git \ libgl1-mesa-glx \ - libglib2.0-0 + libglib2.0-0 \ + numactl \ + time \ + wget RUN ln -sf $(which python3) /usr/bin/python diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml index 11f1b813438..36936fa4bb1 100644 --- a/.azure-pipelines/ut-basic.yml +++ b/.azure-pipelines/ut-basic.yml @@ -24,6 +24,8 @@ stages: - job: steps: - script: | + # for test + docker image rm ${IMAGE_NAME}:${IMAGE_TAG} if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi @@ -46,56 +48,60 @@ stages: && bash ut/run_basic_adaptor.sh" displayName: 'Install Neural Compressor and Run UT' -#- stage: -# displayName: Unit Test tf newAPI -# dependsOn: [] -# jobs: -# - job: -# variables: -# INC_BRANCH: $(System.PullRequest.SourceBranch) -# REPO: $(Build.Repository.Uri) -# steps: -# - script: | -# docker stop $(docker ps -aq) -# docker rm -vf $(docker ps -aq) || true -# displayName: 'Clean Docker' -# -# - script: | -# docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f $BUILD_SOURCESDIRECTORY/.azure-pipelines/docker/Dockerfile-inc.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . -# displayName: 'Build Image' -# -# - script: | -# docker images | grep -i neural-compressor -# displayName: 'Check docker Image' -# -# - script: | -# docker run -tid --disable-content-trust --privileged --name="pr-test" --hostname="pr-test-container" ${IMAGE_NAME}:${IMAGE_TAG} /usr/bin/python /neural-compressor/.azure-pipelines/scripts/ut/run_basic_adaptor_tfnewapi.sh -# displayName: 'Run UT' -# -#- stage: -# displayName: Unit Test other basic case -# dependsOn: [] -# jobs: -# - job: -# variables: -# INC_BRANCH: $(System.PullRequest.SourceBranch) -# REPO: $(Build.Repository.Uri) -# steps: -# - script: | -# docker stop $(docker ps -aq) -# docker rm -vf $(docker ps -aq) || true -# displayName: 'Clean Docker' -# -# - script: | -# echo ${INC_BRANCH} -# echo ${REPO} -# docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f $BUILD_SOURCESDIRECTORY/.azure-pipelines/docker/Dockerfile-inc.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . -# displayName: 'Build Image' -# -# - script: | -# docker images | grep -i neural-compressor -# displayName: 'Check docker Image' -# - script: | -# docker run -tid --disable-content-trust --privileged --name="pr-test" --hostname="pr-test-container" ${IMAGE_NAME}:${IMAGE_TAG} /usr/bin/python /neural-compressor/.azure-pipelines/scripts/ut/run_basic_others.sh -# displayName: 'Run UT' +- stage: + displayName: Unit Test tf newAPI + dependsOn: [] + jobs: + - job: + steps: + - script: | + if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Docker Image" + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + env | sort + displayName: 'Clean Docker' + + - script: | + docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} \ + bash -c "cd /neural-compressor/.azure-pipelines/scripts \ + && bash install_nc.sh \ + && bash ut/run_basic_adaptor_tfnewapi.sh" + displayName: 'Install Neural Compressor and Run UT' + +- stage: + displayName: Unit Test other basic case + dependsOn: [] + jobs: + - job: + steps: + - script: | + if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Docker Image" + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + env | sort + displayName: 'Clean Docker' + - script: | + docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} \ + bash -c "cd /neural-compressor/.azure-pipelines/scripts \ + && bash install_nc.sh \ + && bash ut/run_basic_others.sh" + displayName: 'Install Neural Compressor and Run UT' From a98444dae136bbec1e93b98019884b004fd0d4d7 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Wed, 10 Aug 2022 00:23:02 +0800 Subject: [PATCH 089/271] fix bug --- .azure-pipelines/ut-basic.yml | 122 ++++++++++++++++++++-------------- 1 file changed, 73 insertions(+), 49 deletions(-) diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml index 36936fa4bb1..08328399a1a 100644 --- a/.azure-pipelines/ut-basic.yml +++ b/.azure-pipelines/ut-basic.yml @@ -23,6 +23,14 @@ stages: jobs: - job: steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + displayName: 'Clean workspace' + + - checkout: self + displayName: "Checkout out Repo" + - script: | # for test docker image rm ${IMAGE_NAME}:${IMAGE_TAG} @@ -34,74 +42,90 @@ stages: echo "NO Such Image ${IMAGE_NAME}" exit 1 fi - displayName: "Build Devel Docker Image" + displayName: "Build develop docker image" - script: | docker stop $(docker ps -aq) docker rm -vf $(docker ps -aq) || true env | sort - displayName: 'Clean Docker' + displayName: 'Clean docker' - script: | docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} \ bash -c "cd /neural-compressor/.azure-pipelines/scripts \ && bash install_nc.sh \ && bash ut/run_basic_adaptor.sh" - displayName: 'Install Neural Compressor and Run UT' + displayName: 'Install Neural Compressor and run UT' - stage: displayName: Unit Test tf newAPI dependsOn: [] jobs: - - job: - steps: - - script: | - if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Docker Image" - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - env | sort - displayName: 'Clean Docker' + - job: + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + displayName: 'Clean workspace' - - script: | - docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} \ - bash -c "cd /neural-compressor/.azure-pipelines/scripts \ - && bash install_nc.sh \ - && bash ut/run_basic_adaptor_tfnewapi.sh" - displayName: 'Install Neural Compressor and Run UT' + - checkout: self + displayName: "Checkout out Repo" + + - script: | + if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build develop docker image" + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + env | sort + displayName: 'Clean docker' + + - script: | + docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} \ + bash -c "cd /neural-compressor/.azure-pipelines/scripts \ + && bash install_nc.sh \ + && bash ut/run_basic_adaptor_tfnewapi.sh" + displayName: 'Install Neural Compressor and run UT' - stage: displayName: Unit Test other basic case dependsOn: [] jobs: - - job: - steps: - - script: | - if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Docker Image" - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - env | sort - displayName: 'Clean Docker' + - job: + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + displayName: 'Clean workspace' + + - checkout: self + displayName: "Checkout out Repo" - - script: | - docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} \ - bash -c "cd /neural-compressor/.azure-pipelines/scripts \ - && bash install_nc.sh \ - && bash ut/run_basic_others.sh" - displayName: 'Install Neural Compressor and Run UT' + - script: | + if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build develop docker image" + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + env | sort + displayName: 'Clean docker' + + - script: | + docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} \ + bash -c "cd /neural-compressor/.azure-pipelines/scripts \ + && bash install_nc.sh \ + && bash ut/run_basic_others.sh" + displayName: 'Install Neural Compressor and run UT' From f103ee7f32d14473c18f4174c940c4c8c28a8486 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Wed, 10 Aug 2022 00:24:27 +0800 Subject: [PATCH 090/271] fix bug --- .azure-pipelines/ut-basic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml index 08328399a1a..d4079e0898a 100644 --- a/.azure-pipelines/ut-basic.yml +++ b/.azure-pipelines/ut-basic.yml @@ -98,7 +98,7 @@ stages: dependsOn: [] jobs: - job: - steps: + steps: - script: | echo ${BUILD_SOURCESDIRECTORY} sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true From 0402808c2b2f113e0e0b1443508e151874cc2378 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Wed, 10 Aug 2022 00:47:35 +0800 Subject: [PATCH 091/271] update basic ut --- .azure-pipelines/scripts/ut/env_setup.sh | 24 +++++++++++---- .../scripts/ut/run_basic_adaptor.sh | 4 +-- .../scripts/ut/run_basic_adaptor_tfnewapi.sh | 23 ++++++++++++++- .../scripts/ut/run_basic_others.sh | 29 +++++++++++++++++++ .azure-pipelines/ut-basic.yml | 2 +- 5 files changed, 73 insertions(+), 9 deletions(-) diff --git a/.azure-pipelines/scripts/ut/env_setup.sh b/.azure-pipelines/scripts/ut/env_setup.sh index 4b2145a7e48..9be21c9024b 100644 --- a/.azure-pipelines/scripts/ut/env_setup.sh +++ b/.azure-pipelines/scripts/ut/env_setup.sh @@ -2,17 +2,31 @@ if [[ "${tensorflow_version}" == *"-official" ]]; then pip install tensorflow==${tensorflow_version%-official} +elif [[ "${tensorflow_version}" == "spr-base" ]]; then + pip install /tf_dataset/tf_binary/tensorflow*.whl elif [[ "${tensorflow_version}" != "" ]]; then pip install intel-tensorflow==${tensorflow_version} fi -pip install torch==${pytorch_version} -f https://download.pytorch.org/whl/torch_stable.html -pip install torchvision==${torchvision_version} -f https://download.pytorch.org/whl/torch_stable.html +if [[ "${pytorch_version}" != "" ]]; then + pip install torch==${pytorch_version} -f https://download.pytorch.org/whl/torch_stable.html +fi + +if [[ "${torchvision_version}" != "" ]]; then + pip install torchvision==${torchvision_version} -f https://download.pytorch.org/whl/torch_stable.html +fi -pip install onnx==${onnx_version} -pip install onnxruntime==${onnxruntime_version} +if [[ "${onnx}" != "" ]]; then + pip install onnx==${onnx_version} +fi -pip install mxnet==${mxnet_version} +if [[ "${onnxruntime}" != "" ]]; then + pip install onnxruntime==${onnxruntime_version} +fi + +if [[ "${mxnet}" != "" ]]; then + pip install mxnet==${mxnet_version} +fi cd /neural-compressor/test if [ -f "requirements.txt" ]; then diff --git a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh index faf89569b15..f54f2df1117 100644 --- a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh +++ b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh @@ -19,9 +19,9 @@ LOG_DIR=/neural-compressor/log_dir ut_log_name=${LOG_DIR}/ut_tf_${tensorflow_version}_pt_${pytorch_version}.log echo "cat run.sh..." -cat run.sh +cat run.sh | tee ${ut_log_name} echo "-------------" -bash run.sh 2>&1 | tee ${ut_log_name} +bash run.sh 2>&1 | tee -a ${ut_log_name} if [ $(grep -c "FAILED" ${ut_log_name}) != 0 ] || [ $(grep -c "OK" ${ut_log_name}) == 0 ];then exit 1 diff --git a/.azure-pipelines/scripts/ut/run_basic_adaptor_tfnewapi.sh b/.azure-pipelines/scripts/ut/run_basic_adaptor_tfnewapi.sh index fdcf2730401..f0aa8e72ba5 100644 --- a/.azure-pipelines/scripts/ut/run_basic_adaptor_tfnewapi.sh +++ b/.azure-pipelines/scripts/ut/run_basic_adaptor_tfnewapi.sh @@ -1,4 +1,25 @@ #!/bin/bash set -x python -c "import neural_compressor as nc;print(nc.version.__version__)" -echo "run basic adaptor tfnewapi" \ No newline at end of file +echo "run basic adaptor tfnewapi" + +echo "specify fwk version..." +export tensorflow_version='spr-base' + +echo "set up UT env..." +bash /neural-compressor/.azure-pipelines/scripts/ut/env_setup.sh + +cd /neural-compressor/test || exit 1 +find ./tfnewapi -name "test*.py" | sed 's,\.\/,python ,g' | sed 's/$/ --verbose/' > run.sh + +LOG_DIR=/neural-compressor/log_dir +ut_log_name=${LOG_DIR}/ut_tf_newapi.log + +echo "cat run.sh..." +cat run.sh | tee ${ut_log_name} +echo "-------------" +bash run.sh 2>&1 | tee -a ${ut_log_name} + +if [ $(grep -c "FAILED" ${ut_log_name}) != 0 ] || [ $(grep -c "OK" ${ut_log_name}) == 0 ];then + exit 1 +fi \ No newline at end of file diff --git a/.azure-pipelines/scripts/ut/run_basic_others.sh b/.azure-pipelines/scripts/ut/run_basic_others.sh index de450dd2a61..e0e98116548 100644 --- a/.azure-pipelines/scripts/ut/run_basic_others.sh +++ b/.azure-pipelines/scripts/ut/run_basic_others.sh @@ -3,3 +3,32 @@ set -x python -c "import neural_compressor as nc;print(nc.version.__version__)" echo "run basic" +echo "specify fwk version..." +export tensorflow_version='2.9.1' +export pytorch_version='1.11.0+cpu' +export torchvision_version='0.12.0' +export onnx_version='1.9.0' +export onnxruntime_version='1.10.0' +export mxnet_version='1.7.0' + +echo "set up UT env..." +bash /neural-compressor/.azure-pipelines/scripts/ut/env_setup.sh + +cd /neural-compressor/test || exit 1 +find . -name "test*.py" | sed 's,\.\/,python ,g' | sed 's/$/ --verbose/' > run.sh +sed -i '/ adaptor\//d' run.sh +sed -i '/ tfnewapi\//d' run.sh +sed -i '/ ux\//d' run.sh +sed -i '/ neural_coder\//d' run.sh + +LOG_DIR=/neural-compressor/log_dir +ut_log_name=${LOG_DIR}/ut_tf_${tensorflow_version}_pt_${pytorch_version}.log + +echo "cat run.sh..." +cat run.sh | tee ${ut_log_name} +echo "-------------" +bash run.sh 2>&1 | tee -a ${ut_log_name} + +if [ $(grep -c "FAILED" ${ut_log_name}) != 0 ] || [ $(grep -c "OK" ${ut_log_name}) == 0 ];then + exit 1 +fi \ No newline at end of file diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml index d4079e0898a..e7561454836 100644 --- a/.azure-pipelines/ut-basic.yml +++ b/.azure-pipelines/ut-basic.yml @@ -87,7 +87,7 @@ stages: displayName: 'Clean docker' - script: | - docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} \ + docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor -v /tf_dataset:/tf_dataset ${IMAGE_NAME}:${IMAGE_TAG} \ bash -c "cd /neural-compressor/.azure-pipelines/scripts \ && bash install_nc.sh \ && bash ut/run_basic_adaptor_tfnewapi.sh" From 088bdf638e3e3f04196f7796c417525e54a3f725 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Wed, 10 Aug 2022 01:00:32 +0800 Subject: [PATCH 092/271] add all ut test --- .azure-pipelines/scripts/ut/run_ncoder.sh | 20 +++++++++- .azure-pipelines/scripts/ut/run_ux.sh | 27 +++++++++++++- .azure-pipelines/ut-basic.yml | 3 ++ .azure-pipelines/ut-ncoder.yml | 45 ++++++++++++++--------- .azure-pipelines/ut-ux.yml | 44 +++++++++++++--------- 5 files changed, 103 insertions(+), 36 deletions(-) diff --git a/.azure-pipelines/scripts/ut/run_ncoder.sh b/.azure-pipelines/scripts/ut/run_ncoder.sh index 9a13fbb4ce9..2a4c662defc 100644 --- a/.azure-pipelines/scripts/ut/run_ncoder.sh +++ b/.azure-pipelines/scripts/ut/run_ncoder.sh @@ -1,4 +1,22 @@ #!/bin/bash set -x python -c "import neural_compressor as nc;print(nc.version.__version__)" -echo "run coder" \ No newline at end of file +echo "run coder" + +echo "no FWKs need to be installed..." +echo "no requirements need to be installed..." + +cd /neural-compressor/test || exit 1 +find ./neural_coder -name "test*.py" | sed 's,\.\/,python ,g' | sed 's/$/ --verbose/' > run.sh + +LOG_DIR=/neural-compressor/log_dir +ut_log_name=${LOG_DIR}/ut_neural_coder.log + +echo "cat run.sh..." +cat run.sh | tee ${ut_log_name} +echo "-------------" +bash run.sh 2>&1 | tee -a ${ut_log_name} + +if [ $(grep -c "FAILED" ${ut_log_name}) != 0 ] || [ $(grep -c "OK" ${ut_log_name}) == 0 ];then + exit 1 +fi \ No newline at end of file diff --git a/.azure-pipelines/scripts/ut/run_ux.sh b/.azure-pipelines/scripts/ut/run_ux.sh index d331242fa6b..86d5a32e44a 100644 --- a/.azure-pipelines/scripts/ut/run_ux.sh +++ b/.azure-pipelines/scripts/ut/run_ux.sh @@ -1,4 +1,29 @@ #!/bin/bash set -x python -c "import neural_compressor as nc;print(nc.version.__version__)" -echo "run ux" \ No newline at end of file +echo "run ux" + +echo "specify fwk version..." +export tensorflow_version='2.9.1' +export pytorch_version='1.11.0+cpu' +export torchvision_version='0.12.0' +export onnx_version='1.9.0' +export onnxruntime_version='1.10.0' + +echo "set up UT env..." +bash /neural-compressor/.azure-pipelines/scripts/ut/env_setup.sh + +cd /neural-compressor/test || exit 1 +find ./ux -name "test*.py" | sed 's,\.\/,python ,g' | sed 's/$/ --verbose/' > run.sh + +LOG_DIR=/neural-compressor/log_dir +ut_log_name=${LOG_DIR}/ut_tf_${tensorflow_version}_pt_${pytorch_version}.log + +echo "cat run.sh..." +cat run.sh | tee ${ut_log_name} +echo "-------------" +bash run.sh 2>&1 | tee -a ${ut_log_name} + +if [ $(grep -c "FAILED" ${ut_log_name}) != 0 ] || [ $(grep -c "OK" ${ut_log_name}) == 0 ];then + exit 1 +fi \ No newline at end of file diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml index e7561454836..eaf21dd0676 100644 --- a/.azure-pipelines/ut-basic.yml +++ b/.azure-pipelines/ut-basic.yml @@ -43,6 +43,7 @@ stages: exit 1 fi displayName: "Build develop docker image" + - script: | docker stop $(docker ps -aq) docker rm -vf $(docker ps -aq) || true @@ -80,6 +81,7 @@ stages: exit 1 fi displayName: "Build develop docker image" + - script: | docker stop $(docker ps -aq) docker rm -vf $(docker ps -aq) || true @@ -117,6 +119,7 @@ stages: exit 1 fi displayName: "Build develop docker image" + - script: | docker stop $(docker ps -aq) docker rm -vf $(docker ps -aq) || true diff --git a/.azure-pipelines/ut-ncoder.yml b/.azure-pipelines/ut-ncoder.yml index dd7dde5c113..8c3195d99d1 100644 --- a/.azure-pipelines/ut-ncoder.yml +++ b/.azure-pipelines/ut-ncoder.yml @@ -11,34 +11,45 @@ pr: pool: suyue-test variables: - PYTHON: 'python3.8' IMAGE_NAME: 'neural-compressor' - IMAGE_TAG: 'pr' + IMAGE_TAG: 'py38' stages: - stage: displayName: Unit Test for Neural Coder jobs: - job: - variables: - INC_BRANCH: $(System.PullRequest.SourceBranch) - REPO: $(Build.Repository.Uri) steps: - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - env | sort - displayName: 'Clean Docker' + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + displayName: 'Clean workspace' + + - checkout: self + displayName: "Checkout out Repo" + - script: | - echo ${INC_BRANCH} - echo ${REPO} - docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f $SYSTEM_DEFAULTWORKINGDIRECTORY/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - displayName: 'Build Image' + # for test + docker image rm ${IMAGE_NAME}:${IMAGE_TAG} + if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build develop docker image" - script: | - docker images | grep -i neural-compressor - displayName: 'Check docker Image' + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + env | sort + displayName: 'Clean docker' - script: | - docker run -tid --disable-content-trust --privileged --name="pr-test" --hostname="pr-test-container" ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/.azure-pipelines/scripts/ut/run_ncoder.sh - displayName: 'Run UT' \ No newline at end of file + docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} \ + bash -c "cd /neural-compressor/.azure-pipelines/scripts \ + && bash install_nc_full.sh \ + && bash ut/run_ncoder.sh" + displayName: 'Install Neural Compressor and run UT' \ No newline at end of file diff --git a/.azure-pipelines/ut-ux.yml b/.azure-pipelines/ut-ux.yml index 11d4b025816..93d3e86c3ad 100644 --- a/.azure-pipelines/ut-ux.yml +++ b/.azure-pipelines/ut-ux.yml @@ -11,35 +11,45 @@ pr: pool: suyue-test variables: - PYTHON: 'python3.8' IMAGE_NAME: 'neural-compressor' - IMAGE_TAG: 'pr' + IMAGE_TAG: 'py38' stages: - stage: displayName: Unit Test for UX jobs: - job: - variables: - INC_BRANCH: $(System.PullRequest.SourceBranch) - REPO: $(Build.Repository.Uri) steps: - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - env | sort - displayName: 'Clean Docker' + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + displayName: 'Clean workspace' + + - checkout: self + displayName: "Checkout out Repo" - script: | - echo ${INC_BRANCH} - echo ${REPO} - docker build --build-arg PYTHON=${PYTHON} --build-arg REPO=${REPO} --build-arg SOURCE_BRANCH=${INC_BRANCH} -f $BUILD_SOURCESDIRECTORY/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - displayName: 'Build Image' + # for test + docker image rm ${IMAGE_NAME}:${IMAGE_TAG} + if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build develop docker image" - script: | - docker images | grep -i neural-compressor - displayName: 'Check docker Image' + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + env | sort + displayName: 'Clean docker' - script: | - docker run -tid --disable-content-trust --privileged --name="pr-test" --hostname="pr-test-container" ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/.azure-pipelines/scripts/ut/run_ux.sh - displayName: 'Run UT' \ No newline at end of file + docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} \ + bash -c "cd /neural-compressor/.azure-pipelines/scripts \ + && bash install_nc_full.sh \ + && bash ut/run_ux.sh" + displayName: 'Install Neural Compressor and run UT' \ No newline at end of file From da6045cb25094d3d5b51662509cfc2c091dd254a Mon Sep 17 00:00:00 2001 From: chensuyue Date: Wed, 10 Aug 2022 01:05:26 +0800 Subject: [PATCH 093/271] log dir path fix --- .azure-pipelines/scripts/ut/run_basic_adaptor.sh | 1 + .azure-pipelines/scripts/ut/run_basic_adaptor_tfnewapi.sh | 1 + .azure-pipelines/scripts/ut/run_basic_others.sh | 1 + .azure-pipelines/scripts/ut/run_ncoder.sh | 1 + .azure-pipelines/scripts/ut/run_ux.sh | 1 + 5 files changed, 5 insertions(+) diff --git a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh index f54f2df1117..334be82959e 100644 --- a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh +++ b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh @@ -16,6 +16,7 @@ cd /neural-compressor/test || exit 1 find ./adaptor -name "test*.py" | sed 's,\.\/,python ,g' | sed 's/$/ --verbose/' > run.sh LOG_DIR=/neural-compressor/log_dir +mkdir -p ${LOG_DIR} ut_log_name=${LOG_DIR}/ut_tf_${tensorflow_version}_pt_${pytorch_version}.log echo "cat run.sh..." diff --git a/.azure-pipelines/scripts/ut/run_basic_adaptor_tfnewapi.sh b/.azure-pipelines/scripts/ut/run_basic_adaptor_tfnewapi.sh index f0aa8e72ba5..50b11cdf351 100644 --- a/.azure-pipelines/scripts/ut/run_basic_adaptor_tfnewapi.sh +++ b/.azure-pipelines/scripts/ut/run_basic_adaptor_tfnewapi.sh @@ -13,6 +13,7 @@ cd /neural-compressor/test || exit 1 find ./tfnewapi -name "test*.py" | sed 's,\.\/,python ,g' | sed 's/$/ --verbose/' > run.sh LOG_DIR=/neural-compressor/log_dir +mkdir -p ${LOG_DIR} ut_log_name=${LOG_DIR}/ut_tf_newapi.log echo "cat run.sh..." diff --git a/.azure-pipelines/scripts/ut/run_basic_others.sh b/.azure-pipelines/scripts/ut/run_basic_others.sh index e0e98116548..5cd2e39d1e5 100644 --- a/.azure-pipelines/scripts/ut/run_basic_others.sh +++ b/.azure-pipelines/scripts/ut/run_basic_others.sh @@ -22,6 +22,7 @@ sed -i '/ ux\//d' run.sh sed -i '/ neural_coder\//d' run.sh LOG_DIR=/neural-compressor/log_dir +mkdir -p ${LOG_DIR} ut_log_name=${LOG_DIR}/ut_tf_${tensorflow_version}_pt_${pytorch_version}.log echo "cat run.sh..." diff --git a/.azure-pipelines/scripts/ut/run_ncoder.sh b/.azure-pipelines/scripts/ut/run_ncoder.sh index 2a4c662defc..aef05d13e3f 100644 --- a/.azure-pipelines/scripts/ut/run_ncoder.sh +++ b/.azure-pipelines/scripts/ut/run_ncoder.sh @@ -10,6 +10,7 @@ cd /neural-compressor/test || exit 1 find ./neural_coder -name "test*.py" | sed 's,\.\/,python ,g' | sed 's/$/ --verbose/' > run.sh LOG_DIR=/neural-compressor/log_dir +mkdir -p ${LOG_DIR} ut_log_name=${LOG_DIR}/ut_neural_coder.log echo "cat run.sh..." diff --git a/.azure-pipelines/scripts/ut/run_ux.sh b/.azure-pipelines/scripts/ut/run_ux.sh index 86d5a32e44a..ddfff991652 100644 --- a/.azure-pipelines/scripts/ut/run_ux.sh +++ b/.azure-pipelines/scripts/ut/run_ux.sh @@ -17,6 +17,7 @@ cd /neural-compressor/test || exit 1 find ./ux -name "test*.py" | sed 's,\.\/,python ,g' | sed 's/$/ --verbose/' > run.sh LOG_DIR=/neural-compressor/log_dir +mkdir -p ${LOG_DIR} ut_log_name=${LOG_DIR}/ut_tf_${tensorflow_version}_pt_${pytorch_version}.log echo "cat run.sh..." From 5bd9b4bc3abb33b6550e8ce990236a4492fb8fd2 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Wed, 10 Aug 2022 01:17:27 +0800 Subject: [PATCH 094/271] fix env setup --- .azure-pipelines/scripts/ut/env_setup.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/scripts/ut/env_setup.sh b/.azure-pipelines/scripts/ut/env_setup.sh index 9be21c9024b..736622e64dc 100644 --- a/.azure-pipelines/scripts/ut/env_setup.sh +++ b/.azure-pipelines/scripts/ut/env_setup.sh @@ -22,6 +22,7 @@ fi if [[ "${onnxruntime}" != "" ]]; then pip install onnxruntime==${onnxruntime_version} + pip install onnxruntime-extensions fi if [[ "${mxnet}" != "" ]]; then @@ -33,9 +34,9 @@ if [ -f "requirements.txt" ]; then sed -i '/^neural-compressor/d' requirements.txt sed -i '/^intel-tensorflow/d' requirements.txt sed -i '/find-links https:\/\/download.pytorch.org\/whl\/torch_stable.html/d' requirements.txt - sed -i '/^torch/d' requirements.txt + sed -i '/^torch/d;/^torchvision/d' requirements.txt sed -i '/^mxnet-mkl/d' requirements.txt - sed -i '/^onnx>=/d;/^onnx==/d;/^onnxruntime>=/d;/^onnxruntime==/d' requirements.txt + sed -i '/^onnx/d;/^onnxruntime/d;/^onnxruntime-extensions/d' requirements.txt n=0 until [ "$n" -ge 3 ] do From 8b29c38bbe0ba1d3fef695ec9dace13b25f0694f Mon Sep 17 00:00:00 2001 From: chensuyue Date: Wed, 10 Aug 2022 01:18:16 +0800 Subject: [PATCH 095/271] fix env setup --- .azure-pipelines/scripts/ut/env_setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/ut/env_setup.sh b/.azure-pipelines/scripts/ut/env_setup.sh index 736622e64dc..2bc4ea7667b 100644 --- a/.azure-pipelines/scripts/ut/env_setup.sh +++ b/.azure-pipelines/scripts/ut/env_setup.sh @@ -3,7 +3,7 @@ if [[ "${tensorflow_version}" == *"-official" ]]; then pip install tensorflow==${tensorflow_version%-official} elif [[ "${tensorflow_version}" == "spr-base" ]]; then - pip install /tf_dataset/tf_binary/tensorflow*.whl + pip install /tf_dataset/tf_binary/tensorflow*.whl || exit 1 elif [[ "${tensorflow_version}" != "" ]]; then pip install intel-tensorflow==${tensorflow_version} fi From 4fa530e07e34cc56f5604a96c0ff5bc5a85cf586 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Wed, 10 Aug 2022 01:28:42 +0800 Subject: [PATCH 096/271] fix bug --- .azure-pipelines/scripts/ut/env_setup.sh | 5 ++++- .azure-pipelines/ut-basic.yml | 2 -- .azure-pipelines/ut-ncoder.yml | 2 -- .azure-pipelines/ut-ux.yml | 2 -- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.azure-pipelines/scripts/ut/env_setup.sh b/.azure-pipelines/scripts/ut/env_setup.sh index 2bc4ea7667b..46ad39bceb9 100644 --- a/.azure-pipelines/scripts/ut/env_setup.sh +++ b/.azure-pipelines/scripts/ut/env_setup.sh @@ -3,7 +3,10 @@ if [[ "${tensorflow_version}" == *"-official" ]]; then pip install tensorflow==${tensorflow_version%-official} elif [[ "${tensorflow_version}" == "spr-base" ]]; then - pip install /tf_dataset/tf_binary/tensorflow*.whl || exit 1 + pip install /tf_dataset/tf_binary/tensorflow*.whl + if [[ $? -ne 0 ]]; then + exit 1 + fi elif [[ "${tensorflow_version}" != "" ]]; then pip install intel-tensorflow==${tensorflow_version} fi diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml index eaf21dd0676..fecf3fb59d2 100644 --- a/.azure-pipelines/ut-basic.yml +++ b/.azure-pipelines/ut-basic.yml @@ -32,8 +32,6 @@ stages: displayName: "Checkout out Repo" - script: | - # for test - docker image rm ${IMAGE_NAME}:${IMAGE_TAG} if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi diff --git a/.azure-pipelines/ut-ncoder.yml b/.azure-pipelines/ut-ncoder.yml index 8c3195d99d1..e05add9033e 100644 --- a/.azure-pipelines/ut-ncoder.yml +++ b/.azure-pipelines/ut-ncoder.yml @@ -29,8 +29,6 @@ stages: displayName: "Checkout out Repo" - script: | - # for test - docker image rm ${IMAGE_NAME}:${IMAGE_TAG} if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi diff --git a/.azure-pipelines/ut-ux.yml b/.azure-pipelines/ut-ux.yml index 93d3e86c3ad..8ebba029a72 100644 --- a/.azure-pipelines/ut-ux.yml +++ b/.azure-pipelines/ut-ux.yml @@ -29,8 +29,6 @@ stages: displayName: "Checkout out Repo" - script: | - # for test - docker image rm ${IMAGE_NAME}:${IMAGE_TAG} if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi From a96019e8037a757e05af9c8cffc0fcde12c61ce5 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Wed, 10 Aug 2022 01:37:59 +0800 Subject: [PATCH 097/271] test only, revert before merge --- neural_coder/__init__.py | 1 + neural_compressor/ux/__init__.py | 1 + 2 files changed, 2 insertions(+) diff --git a/neural_coder/__init__.py b/neural_coder/__init__.py index 46dd8eee68c..304699fab90 100644 --- a/neural_coder/__init__.py +++ b/neural_coder/__init__.py @@ -11,6 +11,7 @@ # 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. +# for test only from .interface import enable from .interface import bench diff --git a/neural_compressor/ux/__init__.py b/neural_compressor/ux/__init__.py index 4dad25e4928..faabe895b72 100644 --- a/neural_compressor/ux/__init__.py +++ b/neural_compressor/ux/__init__.py @@ -12,4 +12,5 @@ # 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. +# for test only """The app package contains all components required for UX server.""" From c05cb2e28cc65e076dbdbff97191c1c15b8e4e87 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Wed, 10 Aug 2022 01:41:35 +0800 Subject: [PATCH 098/271] bug fix --- .azure-pipelines/ut-ncoder.yml | 2 +- .azure-pipelines/ut-ux.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/ut-ncoder.yml b/.azure-pipelines/ut-ncoder.yml index e05add9033e..e2a60d39a76 100644 --- a/.azure-pipelines/ut-ncoder.yml +++ b/.azure-pipelines/ut-ncoder.yml @@ -4,7 +4,7 @@ pr: branches: include: - master - path: + paths: include: - neural_coder diff --git a/.azure-pipelines/ut-ux.yml b/.azure-pipelines/ut-ux.yml index 8ebba029a72..dd35dde3896 100644 --- a/.azure-pipelines/ut-ux.yml +++ b/.azure-pipelines/ut-ux.yml @@ -4,7 +4,7 @@ pr: branches: include: - master - path: + paths: include: - neural_compressor.ux From 3456241f38036a7f742e8ee82663cabbe069b411 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Wed, 10 Aug 2022 10:22:44 +0800 Subject: [PATCH 099/271] bug fix --- .azure-pipelines/scripts/ut/env_setup.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/scripts/ut/env_setup.sh b/.azure-pipelines/scripts/ut/env_setup.sh index 46ad39bceb9..45793ce7428 100644 --- a/.azure-pipelines/scripts/ut/env_setup.sh +++ b/.azure-pipelines/scripts/ut/env_setup.sh @@ -19,16 +19,16 @@ if [[ "${torchvision_version}" != "" ]]; then pip install torchvision==${torchvision_version} -f https://download.pytorch.org/whl/torch_stable.html fi -if [[ "${onnx}" != "" ]]; then +if [[ "${onnx_version}" != "" ]]; then pip install onnx==${onnx_version} fi -if [[ "${onnxruntime}" != "" ]]; then +if [[ "${onnxruntime_version}" != "" ]]; then pip install onnxruntime==${onnxruntime_version} pip install onnxruntime-extensions fi -if [[ "${mxnet}" != "" ]]; then +if [[ "${mxnet_version}" != "" ]]; then pip install mxnet==${mxnet_version} fi From c7dac3ada5d477a7256d1c9caf801b881377b6b7 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Wed, 10 Aug 2022 11:04:52 +0800 Subject: [PATCH 100/271] echo version --- .azure-pipelines/scripts/ut/env_setup.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.azure-pipelines/scripts/ut/env_setup.sh b/.azure-pipelines/scripts/ut/env_setup.sh index 45793ce7428..fa5057bafd4 100644 --- a/.azure-pipelines/scripts/ut/env_setup.sh +++ b/.azure-pipelines/scripts/ut/env_setup.sh @@ -1,4 +1,12 @@ #!/bin/bash +set -x + +echo $tensorflow_version +echo $pytorch_version +echo $torchvision_version +echo $onnx_version +echo $onnxruntime_version +echo $mxnet_version if [[ "${tensorflow_version}" == *"-official" ]]; then pip install tensorflow==${tensorflow_version%-official} @@ -32,6 +40,7 @@ if [[ "${mxnet_version}" != "" ]]; then pip install mxnet==${mxnet_version} fi + cd /neural-compressor/test if [ -f "requirements.txt" ]; then sed -i '/^neural-compressor/d' requirements.txt From 9bf5305473936e0ec230a38c93f4a7c2b9a47601 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Wed, 10 Aug 2022 11:21:20 +0800 Subject: [PATCH 101/271] update mxnet install --- .azure-pipelines/scripts/ut/env_setup.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/ut/env_setup.sh b/.azure-pipelines/scripts/ut/env_setup.sh index fa5057bafd4..af008a8bd01 100644 --- a/.azure-pipelines/scripts/ut/env_setup.sh +++ b/.azure-pipelines/scripts/ut/env_setup.sh @@ -36,7 +36,11 @@ if [[ "${onnxruntime_version}" != "" ]]; then pip install onnxruntime-extensions fi -if [[ "${mxnet_version}" != "" ]]; then +if [ "${mxnet_version}" == '1.6.0' ]; then + pip install mxnet-mkl==${mxnet_version} +elif [ "${mxnet_version}" == '1.7.0' ]; then + pip install mxnet==${mxnet_version}.post2 +elif [ "${mxnet_version}" != '' ]; then pip install mxnet==${mxnet_version} fi From 4772070da5ad348f8a42114a859987e61c68caf5 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 12:40:59 +0800 Subject: [PATCH 102/271] code-scan --- .azure-pipelines/code-scan.yml | 158 ++ .../scripts/codeScan/bandit/bandit.sh | 13 + .../scripts/codeScan/copyright/copy_right.sh | 33 + .../scripts/codeScan/pylint/pylint.sh | 29 + .../scripts/codeScan/pyspelling/lpot_dict.txt | 2202 +++++++++++++++++ .../scripts/codeScan/pyspelling/pyspelling.sh | 21 + .../codeScan/pyspelling/pyspelling_conf.yaml | 11 + 7 files changed, 2467 insertions(+) create mode 100644 .azure-pipelines/code-scan.yml create mode 100644 .azure-pipelines/scripts/codeScan/bandit/bandit.sh create mode 100644 .azure-pipelines/scripts/codeScan/copyright/copy_right.sh create mode 100644 .azure-pipelines/scripts/codeScan/pylint/pylint.sh create mode 100644 .azure-pipelines/scripts/codeScan/pyspelling/lpot_dict.txt create mode 100644 .azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh create mode 100644 .azure-pipelines/scripts/codeScan/pyspelling/pyspelling_conf.yaml diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml new file mode 100644 index 00000000000..93941820799 --- /dev/null +++ b/.azure-pipelines/code-scan.yml @@ -0,0 +1,158 @@ +trigger: + - code-scan + +pr: none + # - master + +pool: docker-agent + +variables: + IMAGE_NAME: 'code-scan' + IMAGE_TAG: '1.0' + VAL_PATH: .azure-pipelines/scripts/codeScan + target_path: "neural_compressor" + BUILD_DIRECTORY: $(Build.SourcesDirectory) + TARGET_BRANCH: $(System.PullRequest.TargetBranch) + +stages: + # - stage: bandit + # displayName: bandit code scan + # jobs: + # - job: Build + # displayName: Build + # steps: + # - script: | + # echo ${BUILD_SOURCESDIRECTORY} + # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # # sudo docker system prune || true + # # echo y | docker system prune + # displayName: 'Clean workspace' + + # - checkout: self + # displayName: "Checkout out Repo" + + # - script: | + # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + # fi + # docker images | grep -i ${IMAGE_NAME} + # if [[ $? -ne 0 ]]; then + # echo "NO Such Image ${IMAGE_NAME}" + # exit 1 + # fi + # displayName: "Build Devel Images" + + # - script: | + # docker stop $(docker ps -aq) + # docker rm -vf $(docker ps -aq) || true + # displayName: 'Clean Docker' + + # - script: | + # docker run --disable-content-trust --privileged --name="bandit" --hostname="bandit-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH) $(target_path)" + # displayName: 'bandit code scan' + + + - stage: pylint + displayName: pylint code scan + jobs: + - job: Build + displayName: Build + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # echo y | docker system prune + displayName: 'Clean workspace' + + - checkout: self + displayName: "Checkout out Repo" + + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: 'Clean Docker' + + - script: | + docker run --disable-content-trust --privileged --name="pylint" --hostname="pylint-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pylint/pylint.sh $(VAL_PATH) $(target_path)" + displayName: 'pylint code scan' + + - stage: pyspelling + displayName: pyspelling code scan + jobs: + - job: Build + displayName: Build + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # echo y | docker system prune + displayName: 'Clean workspace' + + - checkout: self + displayName: "Checkout out Repo" + + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: 'Clean Docker' + + - script: | + docker run --disable-content-trust --privileged --name="pyspelling" --hostname="pyspelling-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pyspelling/pyspelling.sh $(VAL_PATH) $(BUILD_DIRECTORY)" + displayName: 'pyspelling code scan' + + - stage: copyright + displayName: copyright code scan + jobs: + - job: Build + displayName: Build + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # echo y | docker system prune + displayName: 'Clean workspace' + + - checkout: self + displayName: "Checkout out Repo" + + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: 'Clean Docker' + + - script: | + docker run --disable-content-trust --privileged --name="copyright" --hostname="copyright-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" + displayName: 'copyright code scan' \ No newline at end of file diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh new file mode 100644 index 00000000000..88159ddb8c5 --- /dev/null +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -0,0 +1,13 @@ +# $1: $(VAL_PATH) +# $2: $(target_path) + +pip install bandit + + +python -m bandit -r -lll -iii $2 > /lpot-bandit.log + +exit_code=$? +if [ ${exit_code} -ne 0 ] ; then + echo "Bandit exited with non-zero exit code."; exit 1 +fi +exit 0 \ No newline at end of file diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh new file mode 100644 index 00000000000..ce54ab41c97 --- /dev/null +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -0,0 +1,33 @@ + # $1: $(target_path) + # $2: $(TARGET_BRANCH) - $(System.PullRequest.TargetBranch) + # $3: $(VAL_PATH) + + supported_extensions=(py, sh, yaml) + + set -xe + + git --no-pager diff --name-only $(git show-ref -s remotes/origin/$2) ./$1 > $3/copyright/diff.log + + files=$(cat $3/copyright/diff.log | awk '!a[$0]++') + + for file in ${files} + + do + if [[ "${supported_extensions[@]}" =~ "${file##*.}" ]]; then + echo "Checking license in 1 ${file}" + if [ $(grep -E -c "Copyright \\(c\\) ([0-9]{4})(-[0-9]{4})? Intel Corporation" ${file}) = 0 ]; then + echo ${file} >> $3/copyright/copyright_issue_summary.log + cat $3/copyright/copyright_issue_summary.log + fi + else + echo "Skipping ${file}" + fi + done + + + ls $3/copyright/copyright_issue_summary.log + exit_code=$? + if [ ${exit_code} -e 0 ] ; then + echo "------------------Check for wrong file list !!!!!!!!!!!!!!!!!!!!!!!"; exit 1 + fi + exit 0 \ No newline at end of file diff --git a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh new file mode 100644 index 00000000000..9b17f150f9e --- /dev/null +++ b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh @@ -0,0 +1,29 @@ +# $1: $(VAL_PATH) +# $2: $(target_path) + +pip install pylint==2.12.1 + +# echo "---------------------" +# pwd +# echo "---------------------" +# ls +# echo "---------------------" +# $1 +# echo "---------------------" +# cd $1 +# ls +# cd .azure-pipelines/scripts/codeScan/pylint +# ls +# echo "---------------------" + + + +python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto --ignored-modules=tensorflow,torch,torch.quantization,torch.tensor,torchvision,mxnet,onnx,onnxruntime ./$2 +# > /lpot-pylint.json +# python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto --ignored-modules=tensorflow,torch,torch.quantization,torch.tensor,torchvision,mxnet,onnx,onnxruntime ./$2 > $1/pylint/lpot-pylint.json + + exit_code=$? + if [ ${exit_code} -ne 0 ] ; then + echo "PyLint exited with non-zero exit code."; exit 1 + fi + exit 0 \ No newline at end of file diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/lpot_dict.txt b/.azure-pipelines/scripts/codeScan/pyspelling/lpot_dict.txt new file mode 100644 index 00000000000..25bf61a1cef --- /dev/null +++ b/.azure-pipelines/scripts/codeScan/pyspelling/lpot_dict.txt @@ -0,0 +1,2202 @@ +aa +aac +abc +Abc +AbcAdaptor +AbcTuneStrategy +abi +ABI +absl +abspath +abstractive +acc +Acc +accuracies +acdc +ACDC +Acknowledgement +activations +Adadelta +adam +AdamW +adaptor +Adaptor +AddEmbeddings +AddN +addr +ADDR +AddV +ade +ADE +adresses +AdvProp +ae +aea +af +AGS +ai +ailab +al +albert +alexnet +AlexNet +algo +algos +alibaba +Alibaba +AlignImageChannel +allenai +alloc +ALLREDUCE +alsologtostderr +Aman +amazonaws +amazonlinux +Amodei +AmpConf +AMX +analytics +Analytics +Anastasiia +AnchorGenerator +andravin +andreamad +anisotropic +anno +anton +ap +apache +api +APIs +APl +APm +approch +APs +arg +argmax +ArgMax +args +arxiv +arXiv +asd +astype +asym +async +atrous +att +AttentionReshape +attr +attredirects +AttributeProto +attrs +auc +aug +autgrad +autogenerate +autograd +AutoMixPrecision +autopep +Autoregressive +ava +AverageMeter +avgloss +AvgPool +avx +AVX +backend +backends +backticks +bart +barthez +bashrc +basicConfig +BasicTokenizer +batchgenerators +BatchMatMul +BatchMatMulV +batchnorm +BatchNorm +bayesian +BayesianOptimization +bazel +bbbb +bbox +bboxes +bccf +bce +bd +bdb +bdist +benchmarked +benchmarking +Benchmarking +Bengio +Benoît +berkeleyvision +bert +BERT's +BertAdam +BertConfig +BERTDataSet +BertForMaskedLM +BertForNextSentencePrediction +BertForPreTraining +BertForQuestionAnswering +BertForSequenceClassification +BertForTokenClassification +BertModel +berts +bertsquad +BertTokenizer +bfloat +BFP +BGR +Bianchi +BiasAdd +BibTeX +bicubic +bilibili +BiliBili +bilinear +BilinearImagenet +billsum +BiLSTM +binarize +binarized +BinaryAdd +biomedical +Biomedical +BLAS +blendcnn +BlendCnn +BlendCNN +bleu +BLEU +blocktime +blogpost +bn +bninception +BNInception +bobw +booktitle +bool +BoW +boxlist +BoxList +br +BrainTumour +BraTS +broadcasted +bs +bsnone +bugfix +buildin +builtin +Builtin +BV +bvlcalexnet +bzip +cadene +Cadene +caffe +Caffe +caffenet +Caffenet +cafferesnet +CaffeResnet +CaffeResNet +Caiming +calib +calibrationcsv +camembert +CamemBERT +canada +Carbonell +CascadeFullRes +cbica +cd +cdn +ce +cec +CenterCrop +centernet +centerNet +centos +CentOS +Centre +cern +CERN's +certfile +Cesa +cfa +cffi +cfg +CFLAGS +ChamNet +Chaumond +checkbox +checkboxes +Cheng +chmod +Cho's +chongruo +Chongruo +chris +Chuanqi +ci +cifar +CIFAR +circleci +Cistac +cityscapes +Cityscapes +cityscapesscripts +cityscapesScripts +cknowledge +ckpt +ckpts +ClassPredictionTower +clcarwin +Clergerie +cli +CLI +clipnorm +clm +CLM +cls +CLX +cly +cmake +CMake +CMAKE +CMakeLists +cmd +CMU +cn +cnn +cnt +CoCo +cocoapi +cocoApi +cocodataset +COCODataset +COCODemo +COCOEval +COCOmAP +COCOmAPv +COCONpy +cocoraw +COCORaw +COCORecord +codalab +codecogs +codenamed +CoLA +colorama +ColorJitter +colspan +compat +compilervars +concat +ConcatV +cond +conda +CONDA +condconv +CondConv +Condensenet +conf +config +Config +configs +CoNLL +Conneau +const +ConstantOfShape +ConstDataLoader +constexpr +contaning +conv +Conv +ConvBNReLU +ConvertingSSDMobilenetToONNX +convertion +ConvNets +convolutional +Convolutional +ConvPerStage +ConvReLU +copt +coreml +CoreML +cp +cpp +cpu +cpus +CPUs +CPX +cpython +creafz +creatis +creativecommons +criteo +Criteo +CriteoTerabyte +croping +CropResize +CropToBoundingBox +CrossEntropyLoss +crossvalidaton +crt +csv +ctrl +CTRLModel +CTRLTokenizer +ctuning +ctx +cuda +cudaPopCallConfiguration +cudatoolkit +CUDAToolKit +cudnn +CUHK +curr +Curran +custormer +cv +CvAClvFfyA +CXX +cxxopt +cypw +cython +da +dae +DagnyT +Dai +dailymail +Danqi +darknet +Darknet +datadir +datafile +dataloader +dataLoader +DataLoader +DataLoadermodule +dataloaders +DataParallel +datapoints +DataProcessor +dataset +Dataset +DatasetAnalyzer +datasets +datatype +datatypes +dathath +Dathathri +datset +dbmdz +DBMDZ +dbox +dbs +DCMAKE +dcn +ddp +DDP +DDR +de +deberta +DecodeImage +deepengine +deeplab +DeepLab +deeplabv +DeepLabV +DeepLearningExamples +Delangue +DENABLE +denseblock +denselayer +densenet +DenseNet +deps +DepthwiseConv +dequant +dequantize +DequantizeLinear +DequantStub +DeQuantStub +desc +dest +destructor +detections +detectron +Detectron +dev +devel +Devlin +devtool +DFabiansResUNet +DFS +DGAN +dialogpt +DialoGPT +dicts +dir +dirname +Discrim +distil +Distil +distilbert +DistilBert +DistilBERT +DistilBERT +DistilBertModel +DistilBertTokenizer +distilgpt +DistilGPT +distillated +Distillated +distillating +DistilmBERT +distilrobert +distilroberta +DistilRoBERTa +DistributedDataParallel +DistributedOptimizer +DistributedSampler +distro +dividiti +Djamé +DKFZ +dl +dlabel +dlboost +dlrm +DLRM's +dmlc +DMQA +dNative +dnf +dnn +dnnl +DNNL +Dockerfile +doclist +docstrings +doctrings +docutils +doteq +dowmsampling +downloader +downsampled +downsampling +doxygen +dpn +DPNs +dpr +DropOut +ds +dscore +dst +dtype +DualPathNet +dualpathnetworks +DualPathNetworks +DummyDataLoader +dunet +DUNet +Dupont +Durand +dvdt +dw +dynamiccaly +ead +EAQkaohzrJbd +earlystop +eb +ecotrust +edgetpu +EdgeTPU +edu +ee +eer +ef +efficientnet +efficientNet +EfficientNet +EfficientNets +eg +eightbit +einstein +el +elif +eltwise +emb +embeddings +embs +EMC +enablerepo +EncodeJped +enfr +eng +ensembling +ensp +entrypoint +enum +env +eq +erf +Erf +Éric +eriklindernoren +Errno +esri +et +eval +evaluator +evel +exemplarily +exising +existing +exmaple +expanduser +ExperimentPlanner +ExperimentPlanners +extractive +EzjbRL +fabian +FabiansUNet +facebook +FaceBook +facebookresearch +fairseq +fallbacks +fanout +faq +Farhadi +FashionMNIST +FasterRCNN +FastFormers +fastrcnn +fatihcakirs +favourably +fb +fbgemm +FBNet +fbnetc +fbresnet +FBResNet +fc +fcn +FCN +fd +FeatureExtractor +feedbacks +Feng +ffc +filename +filenames +FileNotFoundError +filepath +filesystem +finbert +finetune +Finetune +finetuned +finetuning +flac +FlatMapDataset +flaubert +flavour +flavours +Flavours +floatfunctional +FloatFunctional +FloatTensor +FLOPs +Florian +fmfn +fmt +fmtstr +fn +fname +fns +foregound +fp +FP +fpic +fPIC +fpn +FPN +FRN +FromConfig +frontend +fstack +ftfy +Fu +fullres +func +functionalities +functionet +functools +Funtowicz +fw +FWK +fx +GameAI +GANs +Garnett +gcc +gclient +gd +geffnet +gelu +Gelu +GeluOperator +GenEfficientNet +GenericPreprocessor +german +germeval +GermEval +gestaltit +getitem +getsize +GetStrides +GFLOPs +gh +gid +Gimpel +Girshick +github +GitHub +githubusercontent +gitmodules +GLIBCXX +GLOG +GLUE +gluebenchmark +gluepy +gluon +Gluon +gluoncv +GluonCV +gluonnlp +gn +GN +goldsborough +goog +google +googleapis +googleblog +googlenet +googlesource +Goyal +gpg +GPG +gpt +gpu +gpus +GPUs +graphdef +GraphDef +GraphModule +GraphProto +Grauman +grpc +gtFile +gtFine +Gui +Guillaume +Guoming +gz +gzY +Haibin +haibinlin +Haihao +hangzhang +hardcoding +HasAns +hawq +HAWQ +HdQ +heatmaps +Hein +helloworld +HelloWorld +henson +hiddenlayer +hippocampus +Hippocampus +HistogramObserver +hlu +horovod +Horovod +HOROVOD +horovodrun +hostfile +Hounsfield +howpublished +HqEgzS +href +html +http +https +Hu +hubert +huggingface +HuggingFace +HuggingFace's +HuggingFacesTS +hujie +hvd +HybirdBlock +HybridBlock +hyperparameter +hyperparameters +icc +ICCV +Icelake +icpc +icx +ide +idx +ie +IEEE +ILSVR +ilsvrc +ILSVRC +Ilya +im +imagecocodataset +ImageFolder +ImageList +imagenet +ImageNet +ImagenetRaw +ImageRecord +ImageRecordIter +imagesTr +imagesTs +img +imgrec +imgs +imgx +IML +impl +ImportError +IMS +inceptionresnetv +InceptionResNetV +inceptionv +InceptionV +incollection +IndexType +indexValue +indices +indico +inferencer +informations +infos +init +InnerProduct +innersource +inp +inplace +inproceedings +inputcsv +InputData +InputExample +InputFile +Inria +insa +instanceonly +instantiation +integerops +intel +intelai +IntelAI +interoperability +introudces +ints +inturn +InvertedResidual +io +ios +iOS +iou +IoU +ipc +ipex +IPEX +ipynb +ipython +ir +irv +ISA +Isensee +isinstance +issuecomment +IssueQuery +IssueQueryThreads +iter +IteratorGetNext +iters +Jäger +jemalloc +Jens +Jie +jim +Jingfei +Jiong +jit +jitter +Joshi +jpeg +JPEGImages +jpg +jpwarren +json +jsons +Julien +JunWang +jupyter +kaggle +kaggleAdDisplayChallenge +kaiming +KaimingHe +Karthik +kcho +keepbs +keepdim +keras +Keskar +keyfile +keypoint +Keypoint +kimiyoung +kitti +kmp +KMP +KnowledgeDistillationLoss +kriz +kwargs +Kyunghyun +LabelShift +labelsTr +Lample +Lan +lang +LanguageModeling +Lapata +Larochelle +LastLayerShape +latencies +LaTeX +Lavin +layernorm +LayerNorm +layoutlm +ld +len +LessEqual +lf +lfaidata +lfs +li +libdeep +libengine +libffi +libGL +libglib +libiomp +libmlperf +librispeech +LibriSpeech +librosa +libsndfile +libstdc +libz +licence +liKE +Limitting +lin +linkopt +linoxide +linux +linuxfoundation +ListDataset +LiTS +Liu +Liu's +llvmlite +lm +LMHeadModel +ln +loadgen +LoadGen +LOADGEN +LoadGen's +LoadgenAPI +LoadgenAPITestSettings +LoadgenVersion +LoadImage +LOC +localdisk +localhost +LOCderiv +LOCpart +logdir +logfile +login +logits +LOGLEVEL +LogSettings +logtostderr +longformer +lossy +Louf +LowPrecisionInferenceTool +lowproposals +lowres +Lp +lpot +LPOT +LPOT's +lr +lS +LSVRC +lt +LTS +lua +Luan +lutzroeder +lyon +Lysandre +lzma +macOS +MACOSX +MAdds +Madotto +MagnitudePrunePolicy +Maier +mainpage +Makefile +MakefileGnProj +MakeIterator +Mandar +Manmatha +manylinux +mAp +mAP +Mapillary +marianmt +MaskPostProcessor +maskrcnn +MaskRCNN +MaskRCNNFPNFeatureExtractor +maskrnn +massa +Massa +matcher +matmul +MatMul +MatMulWithBias +MatMulWithBiasAdd +MatMulWithBiasGelu +MatMulWithBiasTanh +matplotlib +matricses +maxdepth +maxindrange +maxk +MaxPool +maxSizeInComplete +mbart +mBERT +mcc +McCann +mcordts +md +MeanSquaredError +measurer +Medcial +medicaldecathlon +meetup +mem +membind +mems +messi +metabuild +metadata +metamind +MICCAI +microsoft +miguelgrinberg +Mingda +minibatch +minilm +minimalistic +minival +minloglevel +minmax +MinMaxObserver +mins +mIoU +mIOU +Mirella +misalignments +miscs +Mish +missmatches +MixedConv +mixnet +MixNet +mixup +mkdir +mkl +MKL +mlap +mlas +MLAS +mlcommons +mll +mlm +mlp +mlpc +mlperf +MLperf +MLPerf +mlt +mmdetection +mmlab +MMLAB +mnasnet +MNASNet +mnist +MNIST +mnli +MNLI +mobilebert +MobileBERT +mobilenet +MobileNet +mobilenetv +Mobilenetv +MobileNetv +MobileNetV +modalities +Modalities +modality +ModelConversion +modelfeatures +modelforward +modelinput +modellogits +modelmean +modelsize +modelstd +ModuleDict +ModuleNotFoundError +Molino +mpi +mrcnn +mrpc +MRPC +MSD +mse +MSE +msvc +mul +mult +multi +Multi +multiclass +multilabel +multinli +MultiNLI +multiscale +MULTISCALE +MultiStream +MultiStream's +MultiStreamFree +mutli +mv +mx +mxnet +MxNet +MXNet +MyDataset +Mykhailo +Myle +MyMetric +myModel +MYTASK +MYTASKNAME +Naman +namedtuple +nanohanno +Narasimhan +NAS +nasnet +NASNet +nasnetalarge +nasnetamobile +nb +nbest +nbsp +nc +NCCL +nchw +NCHW +nd +ndarray +NDArray +nderlu +nepoch +ner +NER +nervanasystems +nesterov +NetEase +netron +Netron +networkbuilders +NeurIPS +neval +NewMetric +newstest +nextplatform +ng +ngatang +NGPUS +ngram +NHWC +NIC +nifti +niftis +nii +Nijmegen +Nitish +nl +NLG +nli +nll +nlp +NLP +nlpyang +nltk +NLU +nm +nms +nn +nnodes +nnu +nnU +nnunet +nnUnet +nnUNet +nnUNetPlansv +nnUNetTrainer +nnUNetTrainers +nnUNetTrainerV +NNZ +noduplicates +NoisyStudent +Nonlinearity +NonNestedTuple +NoNormalization +NonZero +noobj +np +nproc +npy +npz +nq +nrix +ns +nsdf +nSsKchNAySU +nthreads +ntrain +num +numactl +numba +numCompleteThreads +numerics +numpy +numTest +numTraining +NVAITC +nvcc +nvidia +NVIDIA +NVIDIA's +nvme +Nx +nyu +ok +ol +Omer +OMP +onboarding +oneapi +oneAPI +onednn +oneDNN +onlinedocs +onnx +ONNX +ONNXQuantizer +onnxrt +ONNXRT +onnxruntime +OnnxRuntime +oob +OOM +OOQtYMH +openai +OpenAI +OpenAI's +OpenAIAdam +OpenAIGPTModel +OpenAIGPTTokenizer +opencv +OpenCV +openmp +openslr +opensource +openssl +openvino +OpenVINO +openvinotoolkit +OpenWebTextCorpus +OperatorConfig +OPs +opset +opsetid +optim +optimizations +Optimizations +optimizers +Optimizers +optypewise +opwise +OrderedDict +ORGderiv +ORGpart +os +osJJ +OTH +OTHderiv +OTHpart +Ott +oup +outdir +OutputData +outputfile +ov +overfeat +overfit +overfitted +PaddingSequence +PaddingSequence +pageId +palletsprojects +panoptic +Panoptic +paperswithcode +param +params +Parinov +ParseDecodeImagenet +ParseDecodeVoc +participations +Parzen +pastebin +patientIDs +pb +pbar +pdf +Peason +pegasus +pelee +peleenet +PeleeNet +Penghui +Pengxin +pepy +PerChannelMinMaxObserver +PERderiv +perf +perftests +PERpart +phrasebank +phy +physcpubind +PhYUmn +Piero +Pierric +PIL +pixAcc +Piyush +pjreddie +pkill +pkl +pky +plm +PLM +pls +pnasnet +PNASNet +png +POC +polynet +PolyNet +Pooler +pos +postprocesing +postprocess +postprocessed +postprocessing +PostProcessor +PostTransform +PowerTools +pplm +PPLM +PQ +pre +prebuild +prebuilt +Prec +precisions +pred +preds +preformance +Preload +preprint +preprocess +preprocessed +preprocesses +preprocessing +preprocessor +Preprocessor +PreprocessorFor +Preprocessors +prerelease +PreSumm +pretrain +pretrained +pretrainedmodels +pretraining +prev +prioritizies +probs +proc +productizing +profilings +ProgressBar +proto +Protobuf +protoc +protractortest +PRs +PrunePolicy +pth +ptq +PTQ +ptr +pudae +pw +PWC +pwd +PWD +px +py +pybind +pycocotools +pyguide +pylint +pymodule +PyObject +pypi +PyPI +PySUT +pytest +PythonAPI +PYTHONPATH +pytorch +PyTorch +pytorchic +PyTorchKnowledgeDistillationLoss +pyyaml +PyYAML +PZ +qat +QAT +qconfig +QConfig +QiaoranC +qint +qlinear +QLinear +qlinearops +QnA +qnli +QNLI +qps +QPS +qqp +QQP +qscheme +qsl +QSL +qtcreator +qtype +quant +quantile +quantizable +Quantizable +quantization +Quantization +quantize +quantized +QuantizedConv +QuantizedConvReLU +QuantizedInput +quantizer +quantizes +Quantizes +quantizing +QuantStub +QueryBackendCapability +QuerySampleComplete +QuerySampleLibrary +quickstart +Quickstart +QuickStart +Quoc +R'emi +Radboud +Radford +Radu +rAjHyXhTzz +rajpurkar +ramdisk +RandAug +RandAugment +randn +RandomCrop +RandomHorizontalFlip +RandomResizedCrop +RandomVerticalFlip +Rault +rc +rcnn +readme +README +ReadmeBuild +ReadmeFAQ +ReadmeHtmlDocs +ReadmeTests +readthedocs +realtime +Realtime +rebase +recommonmark +RecordingObserver +recordio +RecordIO +recurse +Redmon +ReduceMean +regex +RegNet +rehm +Rehm +reinstall +relase +relu +Relu +ReLU +repo +repo's +repo’s +repos +representating +requantize +resampled +resampling +rescale +Rescale +ResencUNet +resize +Resize +ResizeCropImagenet +resized +Resizes +ResizeWithRatio +resnest +ResNest +ResNeSt +resnet +Resnet +ResNet +resnetv +ResNetV +resnext +ResNext +ResNeXt +ressource +ressources +reStructuredText +ret +RetinaMask +retinanet +retinaNet +RetinaNet +reusability +Rewon +rf +rfcn +rgb +RGB +rmax +rmin +RMSE +rn +rng +RNN +rnnt +ro +roberta +RoBERTa +RobertaModel +RobertaTokenizer +ROC +RocStories +Romary +rosanneliu +rougeL +rougeLsum +rowanz +rowspan +RPN +RPNHead +RPNPostProcessor +Rsqrt +rst +rtd +RTX +runhooks +runtime +Runtime +RuntimeError +Rusia +rusiaaman +Ruslan +rw +rwightman +sacremoses +Sagot +Salakhutdinov +salesforce +Salesforce +Salimans +sanh +Sanh +sata +SavedModel +SavedModel +Scalable +scaler +scatterFillKernel +sched +scikit +scm +screenshots +ScriptModule +se +sed +Seddah +seg +segm +SegmentationMask +segmentations +seid +senet +SENet +sentencepiece +Sep +SEP +SeqDataCollator +serializable +ServerPool +sess +setuptools +sexualized +SGD +sgmoid +SHA +sharded +Sharma +Shen +Shirish +shouldn +showEvent +shufflenet +Shufflenet +ShuffleNet +shufflenetv +Shvets +sigmoid +signup +sigopt +Sigopt +SigOpt +SingleStream +skx +Skylake +skylion +SMBO +SMBOs +Smola +smoothes +sndfile +Socher +socio +SocketIO +softmax +somain +Soricut +sota +SOTA +sox +SoX +spacings +spacy +SpaCy +SparseCategoricalAccuracy +SparseCategoricalCrossentropy +sparsified +Spearman +spearmanr +specificities +splitted +spm +spnasnet +sqlalchemy +Sqrt +sqSiUy +Squad +SQuAD +SquadF +squadpy +SquadV +SquaredDifference +squeezebert +squeezenet +SqueezeNet +src +SrcTuple +sryqufw +ssd +SSDMobilenet +SSDSC +sshleifer +sst +stackoverflow +Standley +startswith +StartTest +stdout +stds +stefan +stemblock +stepsize +Stoyanov +str +strided +struct +sts +STS +stsb +styleguide +Suárez +subexpression +subfolder +subfolders +Subgraph +submodule +submodules +Submodules +subsample +subtoken +sudo +Sumanth +summarization +Summarization +SummaryWriter +superseeds +suported +sut +SUT +Sutskever +sv +svg +swagaf +sym +symlink +symlinked +symlinks +Symlinks +synset +sys +SystemUnderTest +tanh +TaskXX +TaskXXX +tb +TBD +tbe +tbody +td +techdecoded +tencent +tensor's +tensorboard +tensorBoard +TensorBoard +tensorcore +TensorDataset +tensorflow +TensorFlow +TensorflowQuery +tensorImageSize +TensorInfo +TensorProto +teraoperations +tesla +testability +TestSettings +tf +TF +TFBertForSequenceClassification +tflite +tfp +tfrecord +TFRecord +TFRecordDataset +tfrecords +TFRobertaModel +TFSlimNetsFactory +TFSlimNetsFactory's +tg +tgt +tgz +th +THCudaTensor +thead +thepath +thres +thrs +Tian +Tidx +timeline +timestamps +TinyBERT +tl +tlkh +tLoss +TLS +tmp +tmpfs +ToArray +ToBGR +toc +toctree +TODO +tokenization +tokenize +tokenized +tokenizer +Tokenizer +tokenizers +Tokenizers +tokenizing +tol +TOL +tolist +toml +ToNDArray +toolchains +ToPILImage +topk +TopK +topologies +ToRange +torchaudio +torchscript +TorchScript +torchtext +torchvision +TorchVision +toronto +totalizing +ToTensor +Toutanova +tp +tpe +TPE +tpu +TPU +tqdm +traceback +trainings +trainval +trainvaltest +transfo +TransformImage +TransfoXLModel +TransfoXLTokenizer +travis +trigram +tstandley +tsv +TuneStrategy +tunings +tuningusage +tuple +tuples +txt +TZ +uber +ubuntu +ubyte +UI +UID +uint +uk +un +uncomment +uncompress +unet +Unet +UNet +unidecode +uniq +unittest +unref +unsqueeze +unstack +upenn +uploader +upscaled +Upscaled +upstreamed +url +userspace +usp +usr +UTC +util +utils +ux +UX +valminusminival +valset +ValueError +Varshney +VCVTNE +VCVTNEPS +VDPBF +vec +Veronika +veronikayurchuk +versioned +Veselin +vgg +viewpage +Villemonte +ViT +voc +VOC +VOCdevkit +VOCmAP +VOCMApMetrics +VOCRecord +voxel +voxels +vram +VRAM +VTune +waleedka +Wallach +wangg +warmup +wav +wd +webcam +Webcam +webite +webpage +WebSockets +WebText +wedam +WeightSharedConvolutionalBoxPredictor +Wformat +wget +whitelist +whl +WideResNet +WideResNet +Wightman +wikipedia +wikitext +WikiText +WilsonCity +WIP +WLYDCRB +wmt +wnd +WnD +wnli +Wnxu +WordPiece +workdir +workflow +Workflow +workflows +workspace +wrt +wwm +www +xad +xception +Xception +xcode +xeon +Xeon +Xiang +Xiong +xl +XLA +xlm +XLMModel +XLMTokenizer +xlnet +XLNet +XLNetModel +XLNetTokenizer +XlUH +xml +xnli +XNLI +xsum +xV +xvf +xvzf +XXXX +xxy +xxz +xYNrZdEAnrHk +xywh +xyxy +xz +xzvf +yacs +yaml +yamls +Yi +Yiming +Yinhan +yizhu +yjxiong +YKd +Yoann +yolo +yolov +YOLOv +YOLOV +yosinski +Yosinski +YqgzY +Yuanjun +Yue +Yunpeng +Yurchuk +YY +zenodo +Zettlemoyer +zfnet +ZFNet +zh +zhang +Zhang +zhanghang +Zhenzhong +Zhi +Zhilin +Zhongyue +zhongyuezhang +Zhu +Zihang +zihangdai +znoexecstack +znow +Zptls +zrelro +zrl +zxvf +CustomObj +ModelSize +QDQ +QLinearOps +qdq +qdqops +CodeGenerator +GEMM +SparseLib +Xbyak +brgemm +cfgs +gtests +hpp +hypotype +kd +ker +kern +sparsednn +spmm +xxxx +GraphModules +wsl +descs +gtest +IOMP +MALLOC +PRETAINED +SPR +libjemalloc +preload +thp +GCP +gcp +gif +solutionslibrary +geomean +VNNI +Preloading +DUC +duc +leftImg +roc +sklearn +CLA +cla +whitehat +codeofconduct +CYP +SBSTD +xd +samsum +IntelCaffe +baremetal +HWs +IC +KH +NVidia +OC +bolded +sparsification +tensorrt +hardwares +BenchmarkConf +PruningConf +DistillationConf +grey +ModelZoo +mzbert +CaffeNet +FlauBERT +GoogleNet +SqueezeBERT +iz +lvwerra +mBart +oje +za +zk +QIntegerops +QLinearops +criterions +HuBERT +csarron +gpb +howey +huawei +noah +nreimers +pruneofa +textattack +scheduler's +BiDAF +bidaf +FERPlus +ferplus +MixedPrecision +DUnetCNN +calibrationset +ndhwc +ArcFace +arcface +arcfaceresnet +nfolds +RFB +WIDERFACE +shuoyang +ultraface +XKeyboard +lscpu +qpa +vnni +xcb +DevCloud +PyPi +aidevcloud +awk +clx +devcloud +lAtr +nda +ppn +qstat +qsub +qsvr +ruserok +scp +spr +stderr +uXXXXX +QuantConf +SuperBench +autocast +kai +mailto +superbench +yao +Lecun +NLPToolkit +Yan +exdb +lecun +publis +yann +abcadf +bcb +INTRA +WARMUPS +ende +intra +inteltensorflow \ No newline at end of file diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh new file mode 100644 index 00000000000..26535ae9d23 --- /dev/null +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh @@ -0,0 +1,21 @@ +# $1: $(VAL_PATH) +# $2: $(BUILD_DIRECTORY) - $(Build.SourcesDirectory) + +pip install pyspelling + +pip install aspell + +pip install aspell-en + +sed -i "s|\${VAL_REPO}|$1|g" $1/pyspelling/pyspelling_conf.yaml +sed -i "s|\${LPOT_REPO}|.|g" $1/pyspelling/pyspelling_conf.yaml +echo "Modified config:" +cat $1/pyspelling/pyspelling_conf.yaml +pyspelling -c $1/pyspelling/pyspelling_conf.yaml > $1/pyspelling/pyspelling_output.log +exit_code=$? +if [ ${exit_code} -ne 0 ] ; then + echo "Pyspelling exited with non-zero exit code."; exit 1 +fi +exit 0 + + diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling_conf.yaml b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling_conf.yaml new file mode 100644 index 00000000000..c407f846ea2 --- /dev/null +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling_conf.yaml @@ -0,0 +1,11 @@ +matrix: +- name: Markdown + hunspell: + d: en_US.ISO8859-15 + dictionary: + wordlists: + - ${VAL_REPO}/pyspelling/lpot_dict.txt + output: ${VAL_REPO}/pyspelling/lpot_dict.dic + sources: + - ${LPOT_REPO}/neural_coder/**/*.md + - ${LPOT_REPO}/neural_coder/*.md \ No newline at end of file From 0f1b9a9308e89711ed5cb84ce26ac6b40e05a99d Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 12:48:43 +0800 Subject: [PATCH 103/271] test --- .azure-pipelines/code-scan.yml | 68 ++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 93941820799..de151e86595 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -9,51 +9,53 @@ pool: docker-agent variables: IMAGE_NAME: 'code-scan' IMAGE_TAG: '1.0' - VAL_PATH: .azure-pipelines/scripts/codeScan + VAL_PATH: /.azure-pipelines/scripts/codeScan target_path: "neural_compressor" BUILD_DIRECTORY: $(Build.SourcesDirectory) TARGET_BRANCH: $(System.PullRequest.TargetBranch) stages: - # - stage: bandit - # displayName: bandit code scan - # jobs: - # - job: Build - # displayName: Build - # steps: - # - script: | - # echo ${BUILD_SOURCESDIRECTORY} - # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # # sudo docker system prune || true - # # echo y | docker system prune - # displayName: 'Clean workspace' + - stage: bandit + displayName: bandit code scan + dependsOn: [] + jobs: + - job: Build + displayName: Build + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # sudo docker system prune || true + # echo y | docker system prune + displayName: 'Clean workspace' - # - checkout: self - # displayName: "Checkout out Repo" + - checkout: self + displayName: "Checkout out Repo" - # - script: | - # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - # fi - # docker images | grep -i ${IMAGE_NAME} - # if [[ $? -ne 0 ]]; then - # echo "NO Such Image ${IMAGE_NAME}" - # exit 1 - # fi - # displayName: "Build Devel Images" + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" - # - script: | - # docker stop $(docker ps -aq) - # docker rm -vf $(docker ps -aq) || true - # displayName: 'Clean Docker' + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: 'Clean Docker' - # - script: | - # docker run --disable-content-trust --privileged --name="bandit" --hostname="bandit-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH) $(target_path)" - # displayName: 'bandit code scan' + - script: | + docker run --disable-content-trust --privileged --name="bandit" --hostname="bandit-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH) $(target_path)" + displayName: 'bandit code scan' - stage: pylint displayName: pylint code scan + dependsOn: [] jobs: - job: Build displayName: Build @@ -89,6 +91,7 @@ stages: - stage: pyspelling displayName: pyspelling code scan + dependsOn: [] jobs: - job: Build displayName: Build @@ -124,6 +127,7 @@ stages: - stage: copyright displayName: copyright code scan + dependsOn: [] jobs: - job: Build displayName: Build From 370e449c5c57c19273b1c341e9f03e6aef8b38cc Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 13:04:31 +0800 Subject: [PATCH 104/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index de151e86595..f8be5397687 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -127,7 +127,7 @@ stages: - stage: copyright displayName: copyright code scan - dependsOn: [] + dependsOn: [] jobs: - job: Build displayName: Build From db2c237e3437b8c472c42f92b72c5853891dea3a Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 13:06:56 +0800 Subject: [PATCH 105/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index f8be5397687..dc506458179 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -9,7 +9,7 @@ pool: docker-agent variables: IMAGE_NAME: 'code-scan' IMAGE_TAG: '1.0' - VAL_PATH: /.azure-pipelines/scripts/codeScan + VAL_PATH: /neural_compressor/.azure-pipelines/scripts/codeScan target_path: "neural_compressor" BUILD_DIRECTORY: $(Build.SourcesDirectory) TARGET_BRANCH: $(System.PullRequest.TargetBranch) From 3c008bc2559e08132a12e37f0e73e235a642d699 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 13:10:47 +0800 Subject: [PATCH 106/271] test --- .azure-pipelines/scripts/codeScan/copyright/copy_right.sh | 5 ++++- .azure-pipelines/scripts/codeScan/pylint/pylint.sh | 2 ++ .azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index ce54ab41c97..56aecc99d67 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -1,6 +1,9 @@ # $1: $(target_path) # $2: $(TARGET_BRANCH) - $(System.PullRequest.TargetBranch) - # $3: $(VAL_PATH) + # $3: $(VAL_PATH) + + pip install -r requirements.txt + supported_extensions=(py, sh, yaml) diff --git a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh index 9b17f150f9e..7c0c04a3d39 100644 --- a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh +++ b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh @@ -2,6 +2,8 @@ # $2: $(target_path) pip install pylint==2.12.1 +pip install -r requirements.txt + # echo "---------------------" # pwd diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh index 26535ae9d23..84f01e5bd1e 100644 --- a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh @@ -6,6 +6,8 @@ pip install pyspelling pip install aspell pip install aspell-en +pip install -r requirements.txt + sed -i "s|\${VAL_REPO}|$1|g" $1/pyspelling/pyspelling_conf.yaml sed -i "s|\${LPOT_REPO}|.|g" $1/pyspelling/pyspelling_conf.yaml From e19db8fabe3913d376711b07b192c9011bb2e48f Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 13:17:17 +0800 Subject: [PATCH 107/271] test --- .azure-pipelines/scripts/codeScan/copyright/copy_right.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index 56aecc99d67..25716d43416 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -9,7 +9,7 @@ set -xe - git --no-pager diff --name-only $(git show-ref -s remotes/origin/$2) ./$1 > $3/copyright/diff.log + git --no-pager diff --name-only $(git show-ref -s remotes/origin$2) ./$1 > $3/copyright/diff.log files=$(cat $3/copyright/diff.log | awk '!a[$0]++') From 322f84772925c27af30661a26253bdc4f5213176 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 13:22:07 +0800 Subject: [PATCH 108/271] test --- .../scripts/codeScan/copyright/copy_right.sh | 11 ++++++++++- .../scripts/codeScan/pylint/pylint.sh | 15 --------------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index 25716d43416..dcc571d1db4 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -9,7 +9,16 @@ set -xe - git --no-pager diff --name-only $(git show-ref -s remotes/origin$2) ./$1 > $3/copyright/diff.log + echo "------------------" + $1 + echo "------------------" + $2 + echo "------------------" + $3 + echo "------------------" + + git --no-pager diff --name-only $(git show-ref -s remotes/origin/master) ./$1 > $3/copyright/diff.log + # git --no-pager diff --name-only $(git show-ref -s remotes/origin$2) ./$1 > $3/copyright/diff.log files=$(cat $3/copyright/diff.log | awk '!a[$0]++') diff --git a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh index 7c0c04a3d39..e6cdeba1893 100644 --- a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh +++ b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh @@ -5,21 +5,6 @@ pip install pylint==2.12.1 pip install -r requirements.txt -# echo "---------------------" -# pwd -# echo "---------------------" -# ls -# echo "---------------------" -# $1 -# echo "---------------------" -# cd $1 -# ls -# cd .azure-pipelines/scripts/codeScan/pylint -# ls -# echo "---------------------" - - - python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto --ignored-modules=tensorflow,torch,torch.quantization,torch.tensor,torchvision,mxnet,onnx,onnxruntime ./$2 # > /lpot-pylint.json # python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto --ignored-modules=tensorflow,torch,torch.quantization,torch.tensor,torchvision,mxnet,onnx,onnxruntime ./$2 > $1/pylint/lpot-pylint.json From 9bfc38a97ba9b1183024999cf933f0430f5ba019 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 13:25:03 +0800 Subject: [PATCH 109/271] test --- .azure-pipelines/scripts/codeScan/copyright/copy_right.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index dcc571d1db4..d67cfe5490e 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -9,14 +9,6 @@ set -xe - echo "------------------" - $1 - echo "------------------" - $2 - echo "------------------" - $3 - echo "------------------" - git --no-pager diff --name-only $(git show-ref -s remotes/origin/master) ./$1 > $3/copyright/diff.log # git --no-pager diff --name-only $(git show-ref -s remotes/origin$2) ./$1 > $3/copyright/diff.log From 574c5aa2cfc204eed4b7130aaffb22e41e9c77e0 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 13:29:22 +0800 Subject: [PATCH 110/271] test --- .azure-pipelines/scripts/codeScan/copyright/copy_right.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index d67cfe5490e..6bc4872e264 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -9,7 +9,7 @@ set -xe - git --no-pager diff --name-only $(git show-ref -s remotes/origin/master) ./$1 > $3/copyright/diff.log + git --no-pager diff --name-only $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor > $3/copyright/diff.log # git --no-pager diff --name-only $(git show-ref -s remotes/origin$2) ./$1 > $3/copyright/diff.log files=$(cat $3/copyright/diff.log | awk '!a[$0]++') From 105427f891c11a362cc48ada7e9c79ed7fb833e8 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 13:32:27 +0800 Subject: [PATCH 111/271] test --- .azure-pipelines/scripts/codeScan/copyright/copy_right.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index 6bc4872e264..a97ce79d704 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -9,7 +9,7 @@ set -xe - git --no-pager diff --name-only $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor > $3/copyright/diff.log + git --no-pager diff --name-only $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor > /diff.log # git --no-pager diff --name-only $(git show-ref -s remotes/origin$2) ./$1 > $3/copyright/diff.log files=$(cat $3/copyright/diff.log | awk '!a[$0]++') From 56256ac074fff0fccfb87b01495e02878b2df53f Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 13:33:01 +0800 Subject: [PATCH 112/271] test --- .azure-pipelines/code-scan.yml | 188 ++++++++++++++++----------------- 1 file changed, 94 insertions(+), 94 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index dc506458179..0677999ea74 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -15,115 +15,115 @@ variables: TARGET_BRANCH: $(System.PullRequest.TargetBranch) stages: - - stage: bandit - displayName: bandit code scan - dependsOn: [] - jobs: - - job: Build - displayName: Build - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # sudo docker system prune || true - # echo y | docker system prune - displayName: 'Clean workspace' + # - stage: bandit + # displayName: bandit code scan + # dependsOn: [] + # jobs: + # - job: Build + # displayName: Build + # steps: + # - script: | + # echo ${BUILD_SOURCESDIRECTORY} + # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # # sudo docker system prune || true + # # echo y | docker system prune + # displayName: 'Clean workspace' - - checkout: self - displayName: "Checkout out Repo" + # - checkout: self + # displayName: "Checkout out Repo" - - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" + # - script: | + # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + # fi + # docker images | grep -i ${IMAGE_NAME} + # if [[ $? -ne 0 ]]; then + # echo "NO Such Image ${IMAGE_NAME}" + # exit 1 + # fi + # displayName: "Build Devel Images" - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: 'Clean Docker' + # - script: | + # docker stop $(docker ps -aq) + # docker rm -vf $(docker ps -aq) || true + # displayName: 'Clean Docker' - - script: | - docker run --disable-content-trust --privileged --name="bandit" --hostname="bandit-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH) $(target_path)" - displayName: 'bandit code scan' + # - script: | + # docker run --disable-content-trust --privileged --name="bandit" --hostname="bandit-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH) $(target_path)" + # displayName: 'bandit code scan' - - stage: pylint - displayName: pylint code scan - dependsOn: [] - jobs: - - job: Build - displayName: Build - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # echo y | docker system prune - displayName: 'Clean workspace' + # - stage: pylint + # displayName: pylint code scan + # dependsOn: [] + # jobs: + # - job: Build + # displayName: Build + # steps: + # - script: | + # echo ${BUILD_SOURCESDIRECTORY} + # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # # echo y | docker system prune + # displayName: 'Clean workspace' - - checkout: self - displayName: "Checkout out Repo" + # - checkout: self + # displayName: "Checkout out Repo" - - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" + # - script: | + # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + # fi + # docker images | grep -i ${IMAGE_NAME} + # if [[ $? -ne 0 ]]; then + # echo "NO Such Image ${IMAGE_NAME}" + # exit 1 + # fi + # displayName: "Build Devel Images" - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: 'Clean Docker' + # - script: | + # docker stop $(docker ps -aq) + # docker rm -vf $(docker ps -aq) || true + # displayName: 'Clean Docker' - - script: | - docker run --disable-content-trust --privileged --name="pylint" --hostname="pylint-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pylint/pylint.sh $(VAL_PATH) $(target_path)" - displayName: 'pylint code scan' + # - script: | + # docker run --disable-content-trust --privileged --name="pylint" --hostname="pylint-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pylint/pylint.sh $(VAL_PATH) $(target_path)" + # displayName: 'pylint code scan' - - stage: pyspelling - displayName: pyspelling code scan - dependsOn: [] - jobs: - - job: Build - displayName: Build - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # echo y | docker system prune - displayName: 'Clean workspace' + # - stage: pyspelling + # displayName: pyspelling code scan + # dependsOn: [] + # jobs: + # - job: Build + # displayName: Build + # steps: + # - script: | + # echo ${BUILD_SOURCESDIRECTORY} + # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # # echo y | docker system prune + # displayName: 'Clean workspace' - - checkout: self - displayName: "Checkout out Repo" + # - checkout: self + # displayName: "Checkout out Repo" - - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" + # - script: | + # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + # fi + # docker images | grep -i ${IMAGE_NAME} + # if [[ $? -ne 0 ]]; then + # echo "NO Such Image ${IMAGE_NAME}" + # exit 1 + # fi + # displayName: "Build Devel Images" - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: 'Clean Docker' + # - script: | + # docker stop $(docker ps -aq) + # docker rm -vf $(docker ps -aq) || true + # displayName: 'Clean Docker' - - script: | - docker run --disable-content-trust --privileged --name="pyspelling" --hostname="pyspelling-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pyspelling/pyspelling.sh $(VAL_PATH) $(BUILD_DIRECTORY)" - displayName: 'pyspelling code scan' + # - script: | + # docker run --disable-content-trust --privileged --name="pyspelling" --hostname="pyspelling-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pyspelling/pyspelling.sh $(VAL_PATH) $(BUILD_DIRECTORY)" + # displayName: 'pyspelling code scan' - stage: copyright displayName: copyright code scan From 60a5cfc0a62cac35b489df51e7d1883d5c5e49f4 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 13:35:56 +0800 Subject: [PATCH 113/271] test --- .../scripts/codeScan/copyright/copy_right.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index a97ce79d704..8b22408efc1 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -12,7 +12,8 @@ git --no-pager diff --name-only $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor > /diff.log # git --no-pager diff --name-only $(git show-ref -s remotes/origin$2) ./$1 > $3/copyright/diff.log - files=$(cat $3/copyright/diff.log | awk '!a[$0]++') + files=$(cat /diff.log | awk '!a[$0]++') + # files=$(cat $3/copyright/diff.log | awk '!a[$0]++') for file in ${files} @@ -20,8 +21,8 @@ if [[ "${supported_extensions[@]}" =~ "${file##*.}" ]]; then echo "Checking license in 1 ${file}" if [ $(grep -E -c "Copyright \\(c\\) ([0-9]{4})(-[0-9]{4})? Intel Corporation" ${file}) = 0 ]; then - echo ${file} >> $3/copyright/copyright_issue_summary.log - cat $3/copyright/copyright_issue_summary.log + echo ${file} >> /copyright_issue_summary.log + cat /copyright_issue_summary.log fi else echo "Skipping ${file}" @@ -29,7 +30,7 @@ done - ls $3/copyright/copyright_issue_summary.log + ls /copyright_issue_summary.log exit_code=$? if [ ${exit_code} -e 0 ] ; then echo "------------------Check for wrong file list !!!!!!!!!!!!!!!!!!!!!!!"; exit 1 From 173e8aa448fc65510e323f7862702538ac87e148 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 13:39:19 +0800 Subject: [PATCH 114/271] test --- .azure-pipelines/scripts/codeScan/copyright/copy_right.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index 8b22408efc1..bfb387c94e4 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -9,7 +9,7 @@ set -xe - git --no-pager diff --name-only $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor > /diff.log + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor > /diff.log # git --no-pager diff --name-only $(git show-ref -s remotes/origin$2) ./$1 > $3/copyright/diff.log files=$(cat /diff.log | awk '!a[$0]++') From b504de863c94925ed14ce75e148367c615def456 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 13:42:38 +0800 Subject: [PATCH 115/271] tst --- .azure-pipelines/scripts/codeScan/copyright/copy_right.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index bfb387c94e4..7c0ee7ec603 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -8,8 +8,8 @@ supported_extensions=(py, sh, yaml) set -xe - - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor > /diff.log + git show-ref -s remotes/origin$2 + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin$2) /neural_compressor/neural_compressor > /diff.log # git --no-pager diff --name-only $(git show-ref -s remotes/origin$2) ./$1 > $3/copyright/diff.log files=$(cat /diff.log | awk '!a[$0]++') From 40a375d7b2adcb4be677fdd1bfc99414371aed9f Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 13:44:21 +0800 Subject: [PATCH 116/271] test --- .azure-pipelines/scripts/codeScan/copyright/copy_right.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index 7c0ee7ec603..3f8a92e39e3 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -9,7 +9,8 @@ set -xe git show-ref -s remotes/origin$2 - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin$2) /neural_compressor/neural_compressor > /diff.log + git --no-pager diff --name-only $(git show-ref -s remotes/origin/master ./neural_coder/) > /diff.log + # git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin$2) /neural_compressor/neural_compressor > /diff.log # git --no-pager diff --name-only $(git show-ref -s remotes/origin$2) ./$1 > $3/copyright/diff.log files=$(cat /diff.log | awk '!a[$0]++') From 08b489761a2c11dbeded5e74eb41b531d94ab80b Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 13:50:12 +0800 Subject: [PATCH 117/271] test --- .azure-pipelines/scripts/codeScan/copyright/copy_right.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index 3f8a92e39e3..dcb2ffeb33f 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -8,9 +8,8 @@ supported_extensions=(py, sh, yaml) set -xe - git show-ref -s remotes/origin$2 - git --no-pager diff --name-only $(git show-ref -s remotes/origin/master ./neural_coder/) > /diff.log - # git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin$2) /neural_compressor/neural_compressor > /diff.log + git config --global --add safe.directory /neural_compressor + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin$2) /neural_compressor/neural_compressor > /diff.log # git --no-pager diff --name-only $(git show-ref -s remotes/origin$2) ./$1 > $3/copyright/diff.log files=$(cat /diff.log | awk '!a[$0]++') From 2389bb54413dbdf764a9bcf0cf74fb7b60dfbd84 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 13:53:35 +0800 Subject: [PATCH 118/271] test --- .azure-pipelines/scripts/codeScan/copyright/copy_right.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index dcb2ffeb33f..33355341b68 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -9,7 +9,7 @@ set -xe git config --global --add safe.directory /neural_compressor - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin$2) /neural_compressor/neural_compressor > /diff.log + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor > /diff.log # git --no-pager diff --name-only $(git show-ref -s remotes/origin$2) ./$1 > $3/copyright/diff.log files=$(cat /diff.log | awk '!a[$0]++') From 1a1533a3a7601902a79dff33dc7954920c87c01b Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 13:59:33 +0800 Subject: [PATCH 119/271] test --- .azure-pipelines/scripts/codeScan/copyright/copy_right.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index 33355341b68..0766fb5ef0c 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -9,7 +9,7 @@ set -xe git config --global --add safe.directory /neural_compressor - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor > /diff.log + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/pyspelling) /neural_compressor/neural_compressor > /diff.log # git --no-pager diff --name-only $(git show-ref -s remotes/origin$2) ./$1 > $3/copyright/diff.log files=$(cat /diff.log | awk '!a[$0]++') From 39dfeaae3b7b4977273b203a803746d5c5f862ac Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 14:01:47 +0800 Subject: [PATCH 120/271] test --- .azure-pipelines/scripts/codeScan/copyright/copy_right.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index 0766fb5ef0c..33355341b68 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -9,7 +9,7 @@ set -xe git config --global --add safe.directory /neural_compressor - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/pyspelling) /neural_compressor/neural_compressor > /diff.log + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor > /diff.log # git --no-pager diff --name-only $(git show-ref -s remotes/origin$2) ./$1 > $3/copyright/diff.log files=$(cat /diff.log | awk '!a[$0]++') From fc59acc1bacee042768e36e7d3695fbf51f0dc38 Mon Sep 17 00:00:00 2001 From: "Sun, Xuehao" Date: Wed, 10 Aug 2022 14:03:06 +0800 Subject: [PATCH 121/271] test --- .azure-pipelines/scripts/codeScan/copyright/copy_right.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index 33355341b68..7610df5a4c9 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -9,6 +9,8 @@ set -xe git config --global --add safe.directory /neural_compressor + git config --global user.email xuehao.sun@intel.com + git config --global user.password 271828Sxh! git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor > /diff.log # git --no-pager diff --name-only $(git show-ref -s remotes/origin$2) ./$1 > $3/copyright/diff.log From e35b1ec20dc4c67196debf92720c83a2688d17ce Mon Sep 17 00:00:00 2001 From: "Sun, Xuehao" Date: Wed, 10 Aug 2022 14:04:40 +0800 Subject: [PATCH 122/271] test --- .azure-pipelines/scripts/codeScan/copyright/copy_right.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index 7610df5a4c9..33355341b68 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -9,8 +9,6 @@ set -xe git config --global --add safe.directory /neural_compressor - git config --global user.email xuehao.sun@intel.com - git config --global user.password 271828Sxh! git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor > /diff.log # git --no-pager diff --name-only $(git show-ref -s remotes/origin$2) ./$1 > $3/copyright/diff.log From a963a27f4aedb680e36fc32404f1378068dfea6a Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 14:42:13 +0800 Subject: [PATCH 123/271] test --- .azure-pipelines/code-scan.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 0677999ea74..29d5c72b7d6 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -1,8 +1,11 @@ trigger: - code-scan -pr: none - # - master +pr: + - master + +# pr: none +# # - master pool: docker-agent From 438766efbf76e5f84d5adce24b9e494fb60a7112 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 15:01:51 +0800 Subject: [PATCH 124/271] test --- .azure-pipelines/code-scan.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 29d5c72b7d6..9c69695d505 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -161,5 +161,6 @@ stages: displayName: 'Clean Docker' - script: | - docker run --disable-content-trust --privileged --name="copyright" --hostname="copyright-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" + docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH) + # docker run --disable-content-trust --privileged --name="copyright" --hostname="copyright-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" displayName: 'copyright code scan' \ No newline at end of file From 201f47c168ad8d9b786f49937bf014a1414b6802 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 15:05:14 +0800 Subject: [PATCH 125/271] test --- .azure-pipelines/code-scan.yml | 206 +++++++++--------- .../scripts/codeScan/pylint/pylint.sh | 14 +- .../scripts/codeScan/pyspelling/pyspelling.sh | 2 - 3 files changed, 109 insertions(+), 113 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 9c69695d505..8ad6d6904a8 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -18,115 +18,115 @@ variables: TARGET_BRANCH: $(System.PullRequest.TargetBranch) stages: - # - stage: bandit - # displayName: bandit code scan - # dependsOn: [] - # jobs: - # - job: Build - # displayName: Build - # steps: - # - script: | - # echo ${BUILD_SOURCESDIRECTORY} - # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # # sudo docker system prune || true - # # echo y | docker system prune - # displayName: 'Clean workspace' + - stage: bandit + displayName: bandit code scan + dependsOn: [] + jobs: + - job: Build + displayName: Build + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # sudo docker system prune || true + # echo y | docker system prune + displayName: 'Clean workspace' - # - checkout: self - # displayName: "Checkout out Repo" + - checkout: self + displayName: "Checkout out Repo" - # - script: | - # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - # fi - # docker images | grep -i ${IMAGE_NAME} - # if [[ $? -ne 0 ]]; then - # echo "NO Such Image ${IMAGE_NAME}" - # exit 1 - # fi - # displayName: "Build Devel Images" - - # - script: | - # docker stop $(docker ps -aq) - # docker rm -vf $(docker ps -aq) || true - # displayName: 'Clean Docker' - - # - script: | - # docker run --disable-content-trust --privileged --name="bandit" --hostname="bandit-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH) $(target_path)" - # displayName: 'bandit code scan' - - - # - stage: pylint - # displayName: pylint code scan - # dependsOn: [] - # jobs: - # - job: Build - # displayName: Build - # steps: - # - script: | - # echo ${BUILD_SOURCESDIRECTORY} - # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # # echo y | docker system prune - # displayName: 'Clean workspace' + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: 'Clean Docker' + + - script: | + docker run --disable-content-trust --privileged --name="bandit" --hostname="bandit-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH) $(target_path)" + displayName: 'bandit code scan' + + + - stage: pylint + displayName: pylint code scan + dependsOn: [] + jobs: + - job: Build + displayName: Build + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # echo y | docker system prune + displayName: 'Clean workspace' - # - checkout: self - # displayName: "Checkout out Repo" + - checkout: self + displayName: "Checkout out Repo" - # - script: | - # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - # fi - # docker images | grep -i ${IMAGE_NAME} - # if [[ $? -ne 0 ]]; then - # echo "NO Such Image ${IMAGE_NAME}" - # exit 1 - # fi - # displayName: "Build Devel Images" - - # - script: | - # docker stop $(docker ps -aq) - # docker rm -vf $(docker ps -aq) || true - # displayName: 'Clean Docker' - - # - script: | - # docker run --disable-content-trust --privileged --name="pylint" --hostname="pylint-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pylint/pylint.sh $(VAL_PATH) $(target_path)" - # displayName: 'pylint code scan' - - # - stage: pyspelling - # displayName: pyspelling code scan - # dependsOn: [] - # jobs: - # - job: Build - # displayName: Build - # steps: - # - script: | - # echo ${BUILD_SOURCESDIRECTORY} - # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # # echo y | docker system prune - # displayName: 'Clean workspace' + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: 'Clean Docker' + + - script: | + docker run --disable-content-trust --privileged --name="pylint" --hostname="pylint-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pylint/pylint.sh $(VAL_PATH) $(target_path)" + displayName: 'pylint code scan' + + - stage: pyspelling + displayName: pyspelling code scan + dependsOn: [] + jobs: + - job: Build + displayName: Build + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # echo y | docker system prune + displayName: 'Clean workspace' - # - checkout: self - # displayName: "Checkout out Repo" + - checkout: self + displayName: "Checkout out Repo" - # - script: | - # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - # fi - # docker images | grep -i ${IMAGE_NAME} - # if [[ $? -ne 0 ]]; then - # echo "NO Such Image ${IMAGE_NAME}" - # exit 1 - # fi - # displayName: "Build Devel Images" - - # - script: | - # docker stop $(docker ps -aq) - # docker rm -vf $(docker ps -aq) || true - # displayName: 'Clean Docker' - - # - script: | - # docker run --disable-content-trust --privileged --name="pyspelling" --hostname="pyspelling-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pyspelling/pyspelling.sh $(VAL_PATH) $(BUILD_DIRECTORY)" - # displayName: 'pyspelling code scan' + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: 'Clean Docker' + + - script: | + docker run --disable-content-trust --privileged --name="pyspelling" --hostname="pyspelling-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pyspelling/pyspelling.sh $(VAL_PATH) $(BUILD_DIRECTORY)" + displayName: 'pyspelling code scan' - stage: copyright displayName: copyright code scan diff --git a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh index e6cdeba1893..1afd7f7e975 100644 --- a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh +++ b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh @@ -6,11 +6,9 @@ pip install -r requirements.txt python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto --ignored-modules=tensorflow,torch,torch.quantization,torch.tensor,torchvision,mxnet,onnx,onnxruntime ./$2 -# > /lpot-pylint.json -# python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto --ignored-modules=tensorflow,torch,torch.quantization,torch.tensor,torchvision,mxnet,onnx,onnxruntime ./$2 > $1/pylint/lpot-pylint.json - - exit_code=$? - if [ ${exit_code} -ne 0 ] ; then - echo "PyLint exited with non-zero exit code."; exit 1 - fi - exit 0 \ No newline at end of file + +exit_code=$? +if [ ${exit_code} -ne 0 ] ; then + echo "PyLint exited with non-zero exit code."; exit 1 +fi +exit 0 \ No newline at end of file diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh index 84f01e5bd1e..e4595a69e61 100644 --- a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh @@ -2,9 +2,7 @@ # $2: $(BUILD_DIRECTORY) - $(Build.SourcesDirectory) pip install pyspelling - pip install aspell - pip install aspell-en pip install -r requirements.txt From 757fe09933f21b2a3f0b3452540a85cf548c2743 Mon Sep 17 00:00:00 2001 From: WenjiaoYue <108783334+WenjiaoYue@users.noreply.github.com> Date: Wed, 10 Aug 2022 15:42:20 +0800 Subject: [PATCH 126/271] Update code-scan.yml for Azure Pipelines --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 8ad6d6904a8..9ca2b52121a 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -7,7 +7,7 @@ pr: # pr: none # # - master -pool: docker-agent +pool: suyue-test variables: IMAGE_NAME: 'code-scan' From 7cc923743ae54067c873722f96abe244ce74fc72 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 15:48:25 +0800 Subject: [PATCH 127/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 9ca2b52121a..3cc877f1b99 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -161,6 +161,6 @@ stages: displayName: 'Clean Docker' - script: | - docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH) + docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH) # docker run --disable-content-trust --privileged --name="copyright" --hostname="copyright-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" displayName: 'copyright code scan' \ No newline at end of file From 2e0719b26facbc175f44bc2793749f2ed5c68b0d Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 15:53:32 +0800 Subject: [PATCH 128/271] test --- .azure-pipelines/code-scan.yml | 68 +++++++++---------- .../scripts/codeScan/copyright/copy_right.sh | 2 - 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 3cc877f1b99..8698fdb49fc 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -128,39 +128,39 @@ stages: docker run --disable-content-trust --privileged --name="pyspelling" --hostname="pyspelling-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pyspelling/pyspelling.sh $(VAL_PATH) $(BUILD_DIRECTORY)" displayName: 'pyspelling code scan' - - stage: copyright - displayName: copyright code scan - dependsOn: [] - jobs: - - job: Build - displayName: Build - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # echo y | docker system prune - displayName: 'Clean workspace' + # - stage: copyright + # displayName: copyright code scan + # dependsOn: [] + # jobs: + # - job: Build + # displayName: Build + # steps: + # - script: | + # echo ${BUILD_SOURCESDIRECTORY} + # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # # echo y | docker system prune + # displayName: 'Clean workspace' - - checkout: self - displayName: "Checkout out Repo" + # - checkout: self + # displayName: "Checkout out Repo" - - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" - - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: 'Clean Docker' - - - script: | - docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH) - # docker run --disable-content-trust --privileged --name="copyright" --hostname="copyright-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" - displayName: 'copyright code scan' \ No newline at end of file + # - script: | + # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + # fi + # docker images | grep -i ${IMAGE_NAME} + # if [[ $? -ne 0 ]]; then + # echo "NO Such Image ${IMAGE_NAME}" + # exit 1 + # fi + # displayName: "Build Devel Images" + + # - script: | + # docker stop $(docker ps -aq) + # docker rm -vf $(docker ps -aq) || true + # displayName: 'Clean Docker' + + # - script: | + # docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH) + # # docker run --disable-content-trust --privileged --name="copyright" --hostname="copyright-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" + # displayName: 'copyright code scan' \ No newline at end of file diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index 33355341b68..41344beadb9 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -2,8 +2,6 @@ # $2: $(TARGET_BRANCH) - $(System.PullRequest.TargetBranch) # $3: $(VAL_PATH) - pip install -r requirements.txt - supported_extensions=(py, sh, yaml) From 25080a2259f233c7c3c9a1b6a80de68c743b5e0b Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 15:57:17 +0800 Subject: [PATCH 129/271] test --- .azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh index e4595a69e61..9017056fbea 100644 --- a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh @@ -2,8 +2,10 @@ # $2: $(BUILD_DIRECTORY) - $(Build.SourcesDirectory) pip install pyspelling + pip install aspell pip install aspell-en + pip install -r requirements.txt From a6433e972b0d925ba0a3470106c83f78722f31d9 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 16:02:50 +0800 Subject: [PATCH 130/271] test --- .azure-pipelines/code-scan.yml | 6 +++--- .azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 8698fdb49fc..d556dc1aea0 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -37,7 +37,7 @@ stages: - script: | if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} --no-cache . fi docker images | grep -i ${IMAGE_NAME} if [[ $? -ne 0 ]]; then @@ -74,7 +74,7 @@ stages: - script: | if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} --no-cache . fi docker images | grep -i ${IMAGE_NAME} if [[ $? -ne 0 ]]; then @@ -110,7 +110,7 @@ stages: - script: | if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} --no-cache . fi docker images | grep -i ${IMAGE_NAME} if [[ $? -ne 0 ]]; then diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh index 9017056fbea..e4595a69e61 100644 --- a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh @@ -2,10 +2,8 @@ # $2: $(BUILD_DIRECTORY) - $(Build.SourcesDirectory) pip install pyspelling - pip install aspell pip install aspell-en - pip install -r requirements.txt From 65d1234402ddb9b7cbd74d2bbc87d2815df781d6 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 16:03:46 +0800 Subject: [PATCH 131/271] test --- .azure-pipelines/code-scan.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index d556dc1aea0..45ccf92d206 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -36,7 +36,7 @@ stages: displayName: "Checkout out Repo" - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + if [[ $(docker images | grep -i ${IMAGE_NAME}) ]]; then docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} --no-cache . fi docker images | grep -i ${IMAGE_NAME} @@ -73,7 +73,7 @@ stages: displayName: "Checkout out Repo" - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + if [[ $(docker images | grep -i ${IMAGE_NAME}) ]]; then docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} --no-cache . fi docker images | grep -i ${IMAGE_NAME} @@ -109,7 +109,7 @@ stages: displayName: "Checkout out Repo" - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + if [[ $(docker images | grep -i ${IMAGE_NAME}) ]]; then docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} --no-cache . fi docker images | grep -i ${IMAGE_NAME} From 5cdcae6939628905791d2e1779987f49d77becd6 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 16:21:18 +0800 Subject: [PATCH 132/271] test --- .azure-pipelines/code-scan.yml | 14 +++++++------- .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 2 +- .azure-pipelines/scripts/codeScan/pylint/pylint.sh | 10 ++++++++++ .../scripts/codeScan/pyspelling/pyspelling.sh | 5 +++-- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 45ccf92d206..c468ba70693 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -36,8 +36,8 @@ stages: displayName: "Checkout out Repo" - script: | - if [[ $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} --no-cache . + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi docker images | grep -i ${IMAGE_NAME} if [[ $? -ne 0 ]]; then @@ -52,7 +52,7 @@ stages: displayName: 'Clean Docker' - script: | - docker run --disable-content-trust --privileged --name="bandit" --hostname="bandit-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH) $(target_path)" + docker run --disable-content-trust --privileged --name="bandit" --hostname="bandit-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" displayName: 'bandit code scan' @@ -73,8 +73,8 @@ stages: displayName: "Checkout out Repo" - script: | - if [[ $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} --no-cache . + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi docker images | grep -i ${IMAGE_NAME} if [[ $? -ne 0 ]]; then @@ -109,8 +109,8 @@ stages: displayName: "Checkout out Repo" - script: | - if [[ $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} --no-cache . + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi docker images | grep -i ${IMAGE_NAME} if [[ $? -ne 0 ]]; then diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index 88159ddb8c5..4c0b5f7fb45 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -4,7 +4,7 @@ pip install bandit -python -m bandit -r -lll -iii $2 > /lpot-bandit.log +python -m bandit -r -lll -iii $1 > $1/lpot-bandit.log exit_code=$? if [ ${exit_code} -ne 0 ] ; then diff --git a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh index 1afd7f7e975..5d1ae712d52 100644 --- a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh +++ b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh @@ -2,7 +2,17 @@ # $2: $(target_path) pip install pylint==2.12.1 +pip install google +pip install horovod +pip install ofa +pip install fvcore +pip install autograd +pip install pymoo +pip install tf_slim +pip install transformers pip install -r requirements.txt +pip install onnxruntime_extensions + python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto --ignored-modules=tensorflow,torch,torch.quantization,torch.tensor,torchvision,mxnet,onnx,onnxruntime ./$2 diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh index e4595a69e61..6df1d1a058c 100644 --- a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh @@ -2,10 +2,11 @@ # $2: $(BUILD_DIRECTORY) - $(Build.SourcesDirectory) pip install pyspelling -pip install aspell -pip install aspell-en pip install -r requirements.txt +apt-get install aspell +apt-get install aspell-en + sed -i "s|\${VAL_REPO}|$1|g" $1/pyspelling/pyspelling_conf.yaml sed -i "s|\${LPOT_REPO}|.|g" $1/pyspelling/pyspelling_conf.yaml From d1bafbcd7d63ae61c6a1e6c2fae8f9e7801459b0 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 16:23:35 +0800 Subject: [PATCH 133/271] test --- .azure-pipelines/code-scan.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index c468ba70693..b493494a0f8 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -36,7 +36,7 @@ stages: displayName: "Checkout out Repo" - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + if [[ $(docker images | grep -i ${IMAGE_NAME}) ]]; then docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi docker images | grep -i ${IMAGE_NAME} @@ -73,7 +73,7 @@ stages: displayName: "Checkout out Repo" - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + if [[ $(docker images | grep -i ${IMAGE_NAME}) ]]; then docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi docker images | grep -i ${IMAGE_NAME} @@ -109,7 +109,7 @@ stages: displayName: "Checkout out Repo" - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + if [[ $(docker images | grep -i ${IMAGE_NAME}) ]]; then docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi docker images | grep -i ${IMAGE_NAME} From 684c3b17365d02914428f4a2d179da5673308cce Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 16:28:21 +0800 Subject: [PATCH 134/271] test --- .azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh index 6df1d1a058c..9774c9ae6fa 100644 --- a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh @@ -4,8 +4,8 @@ pip install pyspelling pip install -r requirements.txt -apt-get install aspell -apt-get install aspell-en +apt-get install aspell -y +apt-get install aspell-en -y sed -i "s|\${VAL_REPO}|$1|g" $1/pyspelling/pyspelling_conf.yaml From 7ba41705794eb99756c18e16141e47748d53fecc Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 16:33:17 +0800 Subject: [PATCH 135/271] test --- .azure-pipelines/scripts/codeScan/pylint/pylint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh index 5d1ae712d52..d169be1b468 100644 --- a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh +++ b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh @@ -2,6 +2,7 @@ # $2: $(target_path) pip install pylint==2.12.1 +pip install flask==2.1.3 pip install google pip install horovod pip install ofa From 85750648bfc071185ba487bc53b46dc774badbcb Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 16:37:31 +0800 Subject: [PATCH 136/271] test --- .azure-pipelines/code-scan.yml | 68 +++++++++++++++++----------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index b493494a0f8..99f4523dc0d 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -128,39 +128,39 @@ stages: docker run --disable-content-trust --privileged --name="pyspelling" --hostname="pyspelling-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pyspelling/pyspelling.sh $(VAL_PATH) $(BUILD_DIRECTORY)" displayName: 'pyspelling code scan' - # - stage: copyright - # displayName: copyright code scan - # dependsOn: [] - # jobs: - # - job: Build - # displayName: Build - # steps: - # - script: | - # echo ${BUILD_SOURCESDIRECTORY} - # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # # echo y | docker system prune - # displayName: 'Clean workspace' + - stage: copyright + displayName: copyright code scan + dependsOn: [] + jobs: + - job: Build + displayName: Build + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # echo y | docker system prune + displayName: 'Clean workspace' - # - checkout: self - # displayName: "Checkout out Repo" + - checkout: self + displayName: "Checkout out Repo" - # - script: | - # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - # fi - # docker images | grep -i ${IMAGE_NAME} - # if [[ $? -ne 0 ]]; then - # echo "NO Such Image ${IMAGE_NAME}" - # exit 1 - # fi - # displayName: "Build Devel Images" - - # - script: | - # docker stop $(docker ps -aq) - # docker rm -vf $(docker ps -aq) || true - # displayName: 'Clean Docker' - - # - script: | - # docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH) - # # docker run --disable-content-trust --privileged --name="copyright" --hostname="copyright-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" - # displayName: 'copyright code scan' \ No newline at end of file + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: 'Clean Docker' + + - script: | + docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH) + # docker run --disable-content-trust --privileged --name="copyright" --hostname="copyright-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" + displayName: 'copyright code scan' \ No newline at end of file From 7f77735d5ec223d103062886618d668451a5dd94 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 16:49:27 +0800 Subject: [PATCH 137/271] test --- .azure-pipelines/code-scan.yml | 208 ++++++++++++++++----------------- 1 file changed, 104 insertions(+), 104 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 99f4523dc0d..097e061c105 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -18,115 +18,115 @@ variables: TARGET_BRANCH: $(System.PullRequest.TargetBranch) stages: - - stage: bandit - displayName: bandit code scan - dependsOn: [] - jobs: - - job: Build - displayName: Build - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # sudo docker system prune || true - # echo y | docker system prune - displayName: 'Clean workspace' + # - stage: bandit + # displayName: bandit code scan + # dependsOn: [] + # jobs: + # - job: Build + # displayName: Build + # steps: + # - script: | + # echo ${BUILD_SOURCESDIRECTORY} + # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # # sudo docker system prune || true + # # echo y | docker system prune + # displayName: 'Clean workspace' - - checkout: self - displayName: "Checkout out Repo" + # - checkout: self + # displayName: "Checkout out Repo" - - script: | - if [[ $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" - - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: 'Clean Docker' - - - script: | - docker run --disable-content-trust --privileged --name="bandit" --hostname="bandit-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" - displayName: 'bandit code scan' - - - - stage: pylint - displayName: pylint code scan - dependsOn: [] - jobs: - - job: Build - displayName: Build - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # echo y | docker system prune - displayName: 'Clean workspace' + # - script: | + # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + # fi + # docker images | grep -i ${IMAGE_NAME} + # if [[ $? -ne 0 ]]; then + # echo "NO Such Image ${IMAGE_NAME}" + # exit 1 + # fi + # displayName: "Build Devel Images" + + # - script: | + # docker stop $(docker ps -aq) + # docker rm -vf $(docker ps -aq) || true + # displayName: 'Clean Docker' + + # - script: | + # docker run --disable-content-trust --privileged --name="bandit" --hostname="bandit-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" + # displayName: 'bandit code scan' + + + # - stage: pylint + # displayName: pylint code scan + # dependsOn: [] + # jobs: + # - job: Build + # displayName: Build + # steps: + # - script: | + # echo ${BUILD_SOURCESDIRECTORY} + # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # # echo y | docker system prune + # displayName: 'Clean workspace' - - checkout: self - displayName: "Checkout out Repo" + # - checkout: self + # displayName: "Checkout out Repo" - - script: | - if [[ $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" - - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: 'Clean Docker' - - - script: | - docker run --disable-content-trust --privileged --name="pylint" --hostname="pylint-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pylint/pylint.sh $(VAL_PATH) $(target_path)" - displayName: 'pylint code scan' - - - stage: pyspelling - displayName: pyspelling code scan - dependsOn: [] - jobs: - - job: Build - displayName: Build - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # echo y | docker system prune - displayName: 'Clean workspace' + # - script: | + # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + # fi + # docker images | grep -i ${IMAGE_NAME} + # if [[ $? -ne 0 ]]; then + # echo "NO Such Image ${IMAGE_NAME}" + # exit 1 + # fi + # displayName: "Build Devel Images" + + # - script: | + # docker stop $(docker ps -aq) + # docker rm -vf $(docker ps -aq) || true + # displayName: 'Clean Docker' + + # - script: | + # docker run --disable-content-trust --privileged --name="pylint" --hostname="pylint-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pylint/pylint.sh $(VAL_PATH) $(target_path)" + # displayName: 'pylint code scan' + + # - stage: pyspelling + # displayName: pyspelling code scan + # dependsOn: [] + # jobs: + # - job: Build + # displayName: Build + # steps: + # - script: | + # echo ${BUILD_SOURCESDIRECTORY} + # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # # echo y | docker system prune + # displayName: 'Clean workspace' - - checkout: self - displayName: "Checkout out Repo" + # - checkout: self + # displayName: "Checkout out Repo" - - script: | - if [[ $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" - - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: 'Clean Docker' - - - script: | - docker run --disable-content-trust --privileged --name="pyspelling" --hostname="pyspelling-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pyspelling/pyspelling.sh $(VAL_PATH) $(BUILD_DIRECTORY)" - displayName: 'pyspelling code scan' + # - script: | + # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + # fi + # docker images | grep -i ${IMAGE_NAME} + # if [[ $? -ne 0 ]]; then + # echo "NO Such Image ${IMAGE_NAME}" + # exit 1 + # fi + # displayName: "Build Devel Images" + + # - script: | + # docker stop $(docker ps -aq) + # docker rm -vf $(docker ps -aq) || true + # displayName: 'Clean Docker' + + # - script: | + # docker run --disable-content-trust --privileged --name="pyspelling" --hostname="pyspelling-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pyspelling/pyspelling.sh $(VAL_PATH) $(BUILD_DIRECTORY)" + # displayName: 'pyspelling code scan' - stage: copyright displayName: copyright code scan @@ -161,6 +161,6 @@ stages: displayName: 'Clean Docker' - script: | - docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH) + docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" # docker run --disable-content-trust --privileged --name="copyright" --hostname="copyright-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" displayName: 'copyright code scan' \ No newline at end of file From 26f4574d85669842bea6dec3efbaa0c355efa9bd Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 16:51:04 +0800 Subject: [PATCH 138/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 097e061c105..bed546b41a1 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -161,6 +161,6 @@ stages: displayName: 'Clean Docker' - script: | - docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" + docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" # docker run --disable-content-trust --privileged --name="copyright" --hostname="copyright-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" displayName: 'copyright code scan' \ No newline at end of file From 225a7da3620c46aaecc50acf151405fe5d2b9d36 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 16:51:59 +0800 Subject: [PATCH 139/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index bed546b41a1..94134489961 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -161,6 +161,6 @@ stages: displayName: 'Clean Docker' - script: | - docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" + docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "pwd && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" # docker run --disable-content-trust --privileged --name="copyright" --hostname="copyright-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" displayName: 'copyright code scan' \ No newline at end of file From c9f2025fcb5c0633073cb976b12d7b064a9f4de4 Mon Sep 17 00:00:00 2001 From: "chen, suyue" Date: Wed, 10 Aug 2022 16:54:36 +0800 Subject: [PATCH 140/271] Suyue/ut update (#16) --- .azure-pipelines/scripts/install_nc.sh | 2 +- .azure-pipelines/scripts/install_nc_full.sh | 2 +- .azure-pipelines/ut-basic.yml | 2 +- .azure-pipelines/ut-ux.yml | 2 +- neural_coder/__init__.py | 1 - neural_compressor/ux/__init__.py | 2 +- neural_compressor/version.py | 1 - 7 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.azure-pipelines/scripts/install_nc.sh b/.azure-pipelines/scripts/install_nc.sh index 5b6fdc6460d..38fd439404b 100644 --- a/.azure-pipelines/scripts/install_nc.sh +++ b/.azure-pipelines/scripts/install_nc.sh @@ -3,5 +3,5 @@ cd /neural-compressor python -m pip install --no-cache-dir -r requirements.txt python setup.py sdist bdist_wheel -pip install dist/neural_compressor-*.whl +pip install dist/neural_compressor*.whl pip list \ No newline at end of file diff --git a/.azure-pipelines/scripts/install_nc_full.sh b/.azure-pipelines/scripts/install_nc_full.sh index b99d2ab305f..b3f59626dfd 100644 --- a/.azure-pipelines/scripts/install_nc_full.sh +++ b/.azure-pipelines/scripts/install_nc_full.sh @@ -3,5 +3,5 @@ cd /neural-compressor python -m pip install --no-cache-dir -r requirements.txt python setup.py --full sdist bdist_wheel -pip install dist/neural_compressor-*.whl +pip install dist/neural_compressor*.whl pip list \ No newline at end of file diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml index fecf3fb59d2..4e7ec62d2bc 100644 --- a/.azure-pipelines/ut-basic.yml +++ b/.azure-pipelines/ut-basic.yml @@ -8,7 +8,7 @@ pr: include: - neural_compressor exclude: - - neural_compressor.ux + - neural_compressor/ux pool: suyue-test diff --git a/.azure-pipelines/ut-ux.yml b/.azure-pipelines/ut-ux.yml index dd35dde3896..41922165d84 100644 --- a/.azure-pipelines/ut-ux.yml +++ b/.azure-pipelines/ut-ux.yml @@ -6,7 +6,7 @@ pr: - master paths: include: - - neural_compressor.ux + - neural_compressor/ux pool: suyue-test diff --git a/neural_coder/__init__.py b/neural_coder/__init__.py index 304699fab90..46dd8eee68c 100644 --- a/neural_coder/__init__.py +++ b/neural_coder/__init__.py @@ -11,7 +11,6 @@ # 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. -# for test only from .interface import enable from .interface import bench diff --git a/neural_compressor/ux/__init__.py b/neural_compressor/ux/__init__.py index faabe895b72..9100b4bb131 100644 --- a/neural_compressor/ux/__init__.py +++ b/neural_compressor/ux/__init__.py @@ -12,5 +12,5 @@ # 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. -# for test only + """The app package contains all components required for UX server.""" diff --git a/neural_compressor/version.py b/neural_compressor/version.py index d9478f11caa..aa09939a643 100644 --- a/neural_compressor/version.py +++ b/neural_compressor/version.py @@ -14,6 +14,5 @@ # 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. -# for test __version__ = "1.13" From ca415ed73fe7258ef748c22ff9601d43f8684b14 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 17:13:00 +0800 Subject: [PATCH 141/271] test --- .azure-pipelines/code-scan.yml | 116 ++++++++++++++++++--------------- 1 file changed, 62 insertions(+), 54 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 94134489961..5f6c703ab5f 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -12,14 +12,60 @@ pool: suyue-test variables: IMAGE_NAME: 'code-scan' IMAGE_TAG: '1.0' - VAL_PATH: /neural_compressor/.azure-pipelines/scripts/codeScan - target_path: "neural_compressor" + VAL_PATH: '/neural_compressor/.azure-pipelines/scripts/codeScan' + TARGET_PATH: '/neural_compressor' BUILD_DIRECTORY: $(Build.SourcesDirectory) TARGET_BRANCH: $(System.PullRequest.TargetBranch) + BANDIT_CONTAINER_NAME: 'bandit' stages: - # - stage: bandit - # displayName: bandit code scan + - stage: bandit + displayName: bandit code scan + dependsOn: [] + jobs: + - job: Build + displayName: Build + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # sudo docker system prune || true + # echo y | docker system prune + displayName: 'Clean workspace' + + - checkout: self + displayName: "Checkout out Repo" + + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: 'Clean Docker' + + - script: | + docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" + docker cp $(BANDIT_CONTAINER_NAME): $1/lpot-bandit.log $1/lpot-bandit.log + + - task: PublishPipelineArtifact@1 + inputs: + targetPath: $1/lpot-bandit.log + artifact: $(BANDIT_CONTAINER_NAME) + publishLocation: 'pipeline' + displayName: 'bandit code scan' + + + # - stage: pylint + # displayName: pylint code scan # dependsOn: [] # jobs: # - job: Build @@ -28,7 +74,6 @@ stages: # - script: | # echo ${BUILD_SOURCESDIRECTORY} # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # # sudo docker system prune || true # # echo y | docker system prune # displayName: 'Clean workspace' @@ -52,12 +97,11 @@ stages: # displayName: 'Clean Docker' # - script: | - # docker run --disable-content-trust --privileged --name="bandit" --hostname="bandit-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" - # displayName: 'bandit code scan' - + # docker run --disable-content-trust --privileged --name="pylint" --hostname="pylint-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pylint/pylint.sh $(VAL_PATH) $(target_path)" + # displayName: 'pylint code scan' - # - stage: pylint - # displayName: pylint code scan + # - stage: pyspelling + # displayName: pyspelling code scan # dependsOn: [] # jobs: # - job: Build @@ -89,11 +133,11 @@ stages: # displayName: 'Clean Docker' # - script: | - # docker run --disable-content-trust --privileged --name="pylint" --hostname="pylint-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pylint/pylint.sh $(VAL_PATH) $(target_path)" - # displayName: 'pylint code scan' - - # - stage: pyspelling - # displayName: pyspelling code scan + # docker run --disable-content-trust --privileged --name="pyspelling" --hostname="pyspelling-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pyspelling/pyspelling.sh $(VAL_PATH) $(BUILD_DIRECTORY)" + # displayName: 'pyspelling code scan' + + # - stage: copyright + # displayName: copyright code scan # dependsOn: [] # jobs: # - job: Build @@ -125,42 +169,6 @@ stages: # displayName: 'Clean Docker' # - script: | - # docker run --disable-content-trust --privileged --name="pyspelling" --hostname="pyspelling-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pyspelling/pyspelling.sh $(VAL_PATH) $(BUILD_DIRECTORY)" - # displayName: 'pyspelling code scan' - - - stage: copyright - displayName: copyright code scan - dependsOn: [] - jobs: - - job: Build - displayName: Build - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # echo y | docker system prune - displayName: 'Clean workspace' - - - checkout: self - displayName: "Checkout out Repo" - - - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" - - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: 'Clean Docker' - - - script: | - docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "pwd && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" - # docker run --disable-content-trust --privileged --name="copyright" --hostname="copyright-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" - displayName: 'copyright code scan' \ No newline at end of file + # docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "pwd && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" + # # docker run --disable-content-trust --privileged --name="copyright" --hostname="copyright-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" + # displayName: 'copyright code scan' \ No newline at end of file From c9e18ede5e519bf570fe02cb14ed23307137e239 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 17:13:15 +0800 Subject: [PATCH 142/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 5f6c703ab5f..226542718c0 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -54,7 +54,7 @@ stages: - script: | docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" - docker cp $(BANDIT_CONTAINER_NAME): $1/lpot-bandit.log $1/lpot-bandit.log + docker cp $(BANDIT_CONTAINER_NAME):$1/lpot-bandit.log $1/lpot-bandit.log - task: PublishPipelineArtifact@1 inputs: From 2f812bf0c81a11129f9ab510efd82578c544260d Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 17:17:32 +0800 Subject: [PATCH 143/271] test --- .azure-pipelines/code-scan.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 226542718c0..3ed1abbebab 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -53,8 +53,9 @@ stages: displayName: 'Clean Docker' - script: | - docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" - docker cp $(BANDIT_CONTAINER_NAME):$1/lpot-bandit.log $1/lpot-bandit.log + # docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" + docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" + docker cp "bandit":$1/lpot-bandit.log $1/lpot-bandit.log - task: PublishPipelineArtifact@1 inputs: From a5026896a50f05291cc9c730283922a8aed251d9 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 17:21:59 +0800 Subject: [PATCH 144/271] test --- .azure-pipelines/code-scan.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 3ed1abbebab..919840627d4 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -55,11 +55,11 @@ stages: - script: | # docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" - docker cp "bandit":$1/lpot-bandit.log $1/lpot-bandit.log + docker cp "bandit":$(VAL_PATH)/lpot-bandit.log $(VAL_PATH)/lpot-bandit.log - task: PublishPipelineArtifact@1 inputs: - targetPath: $1/lpot-bandit.log + targetPath: $(VAL_PATH)/lpot-bandit.log artifact: $(BANDIT_CONTAINER_NAME) publishLocation: 'pipeline' displayName: 'bandit code scan' From a55b04e4995a8b4d533a62631937fb21229e9257 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 17:24:20 +0800 Subject: [PATCH 145/271] test --- .azure-pipelines/code-scan.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 919840627d4..9ffd645502d 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -55,11 +55,11 @@ stages: - script: | # docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" - docker cp "bandit":$(VAL_PATH)/lpot-bandit.log $(VAL_PATH)/lpot-bandit.log + docker cp "bandit":$(VAL_PATH)/lpot-bandit.log /lpot-bandit.log - task: PublishPipelineArtifact@1 inputs: - targetPath: $(VAL_PATH)/lpot-bandit.log + targetPath: /lpot-bandit.log artifact: $(BANDIT_CONTAINER_NAME) publishLocation: 'pipeline' displayName: 'bandit code scan' From 9eecf6f5d8b84b2324ed9184126ed69322607f17 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 17:25:40 +0800 Subject: [PATCH 146/271] test --- .azure-pipelines/code-scan.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 9ffd645502d..bbcc110174d 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -55,11 +55,11 @@ stages: - script: | # docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" - docker cp "bandit":$(VAL_PATH)/lpot-bandit.log /lpot-bandit.log + docker cp "bandit":$(VAL_PATH)/lpot-bandit.log /neural_compressor/lpot-bandit.log - task: PublishPipelineArtifact@1 inputs: - targetPath: /lpot-bandit.log + targetPath: /neural_compressor/lpot-bandit.log artifact: $(BANDIT_CONTAINER_NAME) publishLocation: 'pipeline' displayName: 'bandit code scan' From 114b5ccb46023f99b82160d72d6cb2bc16026ce6 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Wed, 10 Aug 2022 17:27:20 +0800 Subject: [PATCH 147/271] test --- .azure-pipelines/code-scan.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index bbcc110174d..b4d2dd0deda 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -55,6 +55,7 @@ stages: - script: | # docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" + pwd docker cp "bandit":$(VAL_PATH)/lpot-bandit.log /neural_compressor/lpot-bandit.log - task: PublishPipelineArtifact@1 From a76aaf195071a50c777e924f74a74bcc08398a3d Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 09:39:05 +0800 Subject: [PATCH 148/271] test --- .azure-pipelines/code-scan.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index b4d2dd0deda..335f12dfc96 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -17,6 +17,7 @@ variables: BUILD_DIRECTORY: $(Build.SourcesDirectory) TARGET_BRANCH: $(System.PullRequest.TargetBranch) BANDIT_CONTAINER_NAME: 'bandit' + CURRENT_PATH: $(pwd) stages: - stage: bandit @@ -56,11 +57,11 @@ stages: # docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" pwd - docker cp "bandit":$(VAL_PATH)/lpot-bandit.log /neural_compressor/lpot-bandit.log + docker cp "bandit":$(VAL_PATH)/lpot-bandit.log $(CURRENT_PATH)/$(VAL_PATH)/bandit/lpot-bandit.log - task: PublishPipelineArtifact@1 inputs: - targetPath: /neural_compressor/lpot-bandit.log + targetPath: $(CURRENT_PATH)/$(VAL_PATH)/bandit/lpot-bandit.log artifact: $(BANDIT_CONTAINER_NAME) publishLocation: 'pipeline' displayName: 'bandit code scan' From 7fa4d1784ed143625d083a31ea80603ead163920 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 09:41:27 +0800 Subject: [PATCH 149/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 335f12dfc96..e8e3706a004 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -7,7 +7,7 @@ pr: # pr: none # # - master -pool: suyue-test +pool: docker-agent variables: IMAGE_NAME: 'code-scan' From b5d73fa6d9dbd0c86a9045ba622f4d230891f86c Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 11:05:00 +0800 Subject: [PATCH 150/271] test --- .azure-pipelines/code-scan.yml | 127 ++++++++---------- .../scripts/codeScan/bandit/bandit.sh | 5 +- 2 files changed, 59 insertions(+), 73 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index e8e3706a004..352e279b3af 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -1,71 +1,60 @@ -trigger: +trigger: - code-scan - -pr: - - master - -# pr: none -# # - master - +pr: none pool: docker-agent variables: - IMAGE_NAME: 'code-scan' - IMAGE_TAG: '1.0' - VAL_PATH: '/neural_compressor/.azure-pipelines/scripts/codeScan' - TARGET_PATH: '/neural_compressor' - BUILD_DIRECTORY: $(Build.SourcesDirectory) + IMAGE_NAME: "code-scan" + IMAGE_TAG: "1.0" + CODE_SCAN_PATH: "/neural_compressor/.azure-pipelines/scripts/codeScan" + CODE_SCAN_LOG_PATH: "/neural_compressor/.azure-pipelines/scripts/codeScan/scanLog" + TARGET_PATH: "/neural_compressor" TARGET_BRANCH: $(System.PullRequest.TargetBranch) - BANDIT_CONTAINER_NAME: 'bandit' - CURRENT_PATH: $(pwd) + BANDIT_CONTAINER_NAME: "bandit" + CURRENT_PATH: $(Build.SourcesDirectory) stages: - - stage: bandit - displayName: bandit code scan + - stage: BanditCodeScan + displayName: Bandit Code Scan dependsOn: [] jobs: - - job: Build - displayName: Build - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # sudo docker system prune || true - # echo y | docker system prune - displayName: 'Clean workspace' - - - checkout: self - displayName: "Checkout out Repo" - - - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" - - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: 'Clean Docker' - - - script: | - # docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" - docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(VAL_PATH)/bandit/bandit.sh $(VAL_PATH)" - pwd - docker cp "bandit":$(VAL_PATH)/lpot-bandit.log $(CURRENT_PATH)/$(VAL_PATH)/bandit/lpot-bandit.log - - - task: PublishPipelineArtifact@1 - inputs: - targetPath: $(CURRENT_PATH)/$(VAL_PATH)/bandit/lpot-bandit.log - artifact: $(BANDIT_CONTAINER_NAME) - publishLocation: 'pipeline' - displayName: 'bandit code scan' - + - job: Bandit + displayName: Bandit + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + echo y | docker system prune + displayName: "Clean workspace" + - checkout: self + displayName: "Checkout out Repo" + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: "Clean Docker" + + - task: Bash@3 + inputs: + targetType: "inline" + script: | + docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(CODE_SCAN_PATH)/bandit/bandit.sh --$(TARGET_PATH)" + docker cp 'bandit':/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + + - task: PublishPipelineArtifact@1 + inputs: + targetPath: (CURRENT_PATH)/$(CODE_SCAN_LOG_PATH) + artifact: $(BANDIT_CONTAINER_NAME) + publishLocation: "pipeline" # - stage: pylint # displayName: pylint code scan @@ -79,10 +68,10 @@ stages: # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true # # echo y | docker system prune # displayName: 'Clean workspace' - + # - checkout: self # displayName: "Checkout out Repo" - + # - script: | # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . @@ -115,10 +104,10 @@ stages: # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true # # echo y | docker system prune # displayName: 'Clean workspace' - + # - checkout: self # displayName: "Checkout out Repo" - + # - script: | # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . @@ -136,9 +125,9 @@ stages: # displayName: 'Clean Docker' # - script: | - # docker run --disable-content-trust --privileged --name="pyspelling" --hostname="pyspelling-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pyspelling/pyspelling.sh $(VAL_PATH) $(BUILD_DIRECTORY)" + # docker run --disable-content-trust --privileged --name="pyspelling" --hostname="pyspelling-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pyspelling/pyspelling.sh $(VAL_PATH) $(CURRENT_PATH)" # displayName: 'pyspelling code scan' - + # - stage: copyright # displayName: copyright code scan # dependsOn: [] @@ -151,10 +140,10 @@ stages: # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true # # echo y | docker system prune # displayName: 'Clean workspace' - + # - checkout: self # displayName: "Checkout out Repo" - + # - script: | # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . @@ -172,6 +161,6 @@ stages: # displayName: 'Clean Docker' # - script: | - # docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "pwd && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" + # docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "pwd && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" # # docker run --disable-content-trust --privileged --name="copyright" --hostname="copyright-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" - # displayName: 'copyright code scan' \ No newline at end of file + # displayName: 'copyright code scan' diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index 4c0b5f7fb45..c23898d7f5b 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -1,10 +1,7 @@ -# $1: $(VAL_PATH) -# $2: $(target_path) - pip install bandit -python -m bandit -r -lll -iii $1 > $1/lpot-bandit.log +python -m bandit -r -lll -iii $(TARGET_PATH) > /lpot-bandit.log exit_code=$? if [ ${exit_code} -ne 0 ] ; then From c699b44b97b8e8a693a958e306761db9e7b72f1b Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 11:07:49 +0800 Subject: [PATCH 151/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 352e279b3af..5ce7e6ba719 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -1,7 +1,7 @@ trigger: - code-scan pr: none -pool: docker-agent +pool: suyue-test variables: IMAGE_NAME: "code-scan" From 490fa177168f4ee2b81ba0aa2891384ae5420f8e Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 11:11:32 +0800 Subject: [PATCH 152/271] test --- .azure-pipelines/code-scan.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 5ce7e6ba719..c448066abfb 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -29,8 +29,8 @@ stages: - checkout: self displayName: "Checkout out Repo" - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + if [[ $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} --no-cache. fi docker images | grep -i ${IMAGE_NAME} if [[ $? -ne 0 ]]; then From 4fa133a33e9ed99ebf700d2f2e35029ed7c824ae Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 11:21:12 +0800 Subject: [PATCH 153/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index c448066abfb..240491a1728 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -47,7 +47,7 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(CODE_SCAN_PATH)/bandit/bandit.sh --$(TARGET_PATH)" + docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(CODE_SCAN_PATH)/bandit/bandit.sh --TARGET_PATH" docker cp 'bandit':/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - task: PublishPipelineArtifact@1 From 170023b2cc70e3e88e80febd7c564e9a617d4c40 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 11:23:01 +0800 Subject: [PATCH 154/271] test --- .azure-pipelines/code-scan.yml | 2 +- .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 240491a1728..8f83dbe116b 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -47,7 +47,7 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(CODE_SCAN_PATH)/bandit/bandit.sh --TARGET_PATH" + docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(CODE_SCAN_PATH)/bandit/bandit.sh $(TARGET_PATH)" docker cp 'bandit':/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - task: PublishPipelineArtifact@1 diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index c23898d7f5b..d751da88e61 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -1,7 +1,8 @@ pip install bandit -python -m bandit -r -lll -iii $(TARGET_PATH) > /lpot-bandit.log +python -m bandit -r -lll -iii $1 > /lpot-bandit.log +# python -m bandit -r -lll -iii $(TARGET_PATH) > /lpot-bandit.log exit_code=$? if [ ${exit_code} -ne 0 ] ; then From 103416229f812012f9b10c6f2efb71cd34ddb93e Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 11:35:20 +0800 Subject: [PATCH 155/271] test --- .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index d751da88e61..17e80b78430 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -1,7 +1,7 @@ pip install bandit -python -m bandit -r -lll -iii $1 > /lpot-bandit.log +python -m bandit -r -lll -iii > /lpot-bandit.log # python -m bandit -r -lll -iii $(TARGET_PATH) > /lpot-bandit.log exit_code=$? From c54720548ec1244e5c3e715f449dee568a3915a1 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 11:40:47 +0800 Subject: [PATCH 156/271] test --- .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index 17e80b78430..96237e1fd0c 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -1,7 +1,12 @@ pip install bandit +echo "-------------------" +pwd +echo "-------------------" +ls +echo "-------------------" -python -m bandit -r -lll -iii > /lpot-bandit.log +python -m bandit -r -lll -iii /neural_compressor > /lpot-bandit.log # python -m bandit -r -lll -iii $(TARGET_PATH) > /lpot-bandit.log exit_code=$? From 5e8475f185bf50aeb67cf73bb6f347ead1fa010a Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 11:44:14 +0800 Subject: [PATCH 157/271] test --- .azure-pipelines/code-scan.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 8f83dbe116b..935007c01c3 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -47,6 +47,15 @@ stages: inputs: targetType: "inline" script: | + echo "--------------------" + $(CURRENT_PATH) + cd $(CURRENT_PATH) + ls + echo "--------------------" + $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH) + cd $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH) + ls + echo "--------------------" docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(CODE_SCAN_PATH)/bandit/bandit.sh $(TARGET_PATH)" docker cp 'bandit':/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log From 931565424c2362bf87e89dcfa4042e0548af6455 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 12:53:13 +0800 Subject: [PATCH 158/271] test --- .azure-pipelines/code-scan.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 935007c01c3..b121baf1bf0 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -6,8 +6,8 @@ pool: suyue-test variables: IMAGE_NAME: "code-scan" IMAGE_TAG: "1.0" - CODE_SCAN_PATH: "/neural_compressor/.azure-pipelines/scripts/codeScan" - CODE_SCAN_LOG_PATH: "/neural_compressor/.azure-pipelines/scripts/codeScan/scanLog" + CODE_SCAN_PATH: "neural_compressor/.azure-pipelines/scripts/codeScan" + CODE_SCAN_LOG_PATH: "neural_compressor/.azure-pipelines/scripts/codeScan/scanLog" TARGET_PATH: "/neural_compressor" TARGET_BRANCH: $(System.PullRequest.TargetBranch) BANDIT_CONTAINER_NAME: "bandit" @@ -29,8 +29,8 @@ stages: - checkout: self displayName: "Checkout out Repo" - script: | - if [[ $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} --no-cache. + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi docker images | grep -i ${IMAGE_NAME} if [[ $? -ne 0 ]]; then @@ -49,14 +49,18 @@ stages: script: | echo "--------------------" $(CURRENT_PATH) + echo "---------1-----------" cd $(CURRENT_PATH) + echo "---------2-----------" ls echo "--------------------" $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH) + echo "---------1-----------" cd $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH) + echo "---------2-----------" ls echo "--------------------" - docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(CODE_SCAN_PATH)/bandit/bandit.sh $(TARGET_PATH)" + docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash /$(CODE_SCAN_PATH)/bandit/bandit.sh $(TARGET_PATH)" docker cp 'bandit':/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - task: PublishPipelineArtifact@1 From e1667329795cdd0637dc53d88527b07a0643f93f Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 12:56:07 +0800 Subject: [PATCH 159/271] test --- .azure-pipelines/code-scan.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index b121baf1bf0..3b5132633df 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -29,8 +29,8 @@ stages: - checkout: self displayName: "Checkout out Repo" - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + if [[ $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} --no-cache. fi docker images | grep -i ${IMAGE_NAME} if [[ $? -ne 0 ]]; then From 55d7b9ebf1258440480d34df73fc3201ef44b0f8 Mon Sep 17 00:00:00 2001 From: WenjiaoYue <108783334+WenjiaoYue@users.noreply.github.com> Date: Thu, 11 Aug 2022 12:58:43 +0800 Subject: [PATCH 160/271] Update code-scan.yml for Azure Pipelines --- .azure-pipelines/code-scan.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 3b5132633df..eaa55afc8a1 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -61,11 +61,11 @@ stages: ls echo "--------------------" docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash /$(CODE_SCAN_PATH)/bandit/bandit.sh $(TARGET_PATH)" - docker cp 'bandit':/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + docker cp 'bandit':/lpot-bandit.log $(CURRENT_PATH)/lpot-bandit.log - task: PublishPipelineArtifact@1 inputs: - targetPath: (CURRENT_PATH)/$(CODE_SCAN_LOG_PATH) + targetPath: (CURRENT_PATH) artifact: $(BANDIT_CONTAINER_NAME) publishLocation: "pipeline" From 6d6ae6d814778ef165078432a157b8cd5d937f6d Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 13:11:49 +0800 Subject: [PATCH 161/271] test --- .azure-pipelines/code-scan.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 3b5132633df..ab0235a74d4 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -54,9 +54,9 @@ stages: echo "---------2-----------" ls echo "--------------------" - $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH) + $(CURRENT_PATH)/$(CODE_SCAN_PATH) echo "---------1-----------" - cd $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH) + cd $(CURRENT_PATH)/$(CODE_SCAN_PATH) echo "---------2-----------" ls echo "--------------------" From 80fa329565e5d3bc4e585d2c9c873b86a75b5904 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 13:15:23 +0800 Subject: [PATCH 162/271] test --- .azure-pipelines/code-scan.yml | 2 +- .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index a492dae283c..a6257987335 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -65,7 +65,7 @@ stages: - task: PublishPipelineArtifact@1 inputs: - targetPath: (CURRENT_PATH) + targetPath: $(CURRENT_PATH) artifact: $(BANDIT_CONTAINER_NAME) publishLocation: "pipeline" diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index 96237e1fd0c..6c5facb4a1b 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -1,11 +1,5 @@ pip install bandit -echo "-------------------" -pwd -echo "-------------------" -ls -echo "-------------------" - python -m bandit -r -lll -iii /neural_compressor > /lpot-bandit.log # python -m bandit -r -lll -iii $(TARGET_PATH) > /lpot-bandit.log From 007bf7379315f4a96537b923790b770aa7e3364b Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 13:20:16 +0800 Subject: [PATCH 163/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index a6257987335..d856fbdb756 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -65,7 +65,7 @@ stages: - task: PublishPipelineArtifact@1 inputs: - targetPath: $(CURRENT_PATH) + targetPath: $(CURRENT_PATH)/.azure-pipelines/scripts/codeScan artifact: $(BANDIT_CONTAINER_NAME) publishLocation: "pipeline" From c5372167bb959b48fd38af7325b641ca293c4908 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 13:25:09 +0800 Subject: [PATCH 164/271] test --- .azure-pipelines/code-scan.yml | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index d856fbdb756..dc35c88dba9 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -30,7 +30,7 @@ stages: displayName: "Checkout out Repo" - script: | if [[ $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} --no-cache. + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} --no-cache . fi docker images | grep -i ${IMAGE_NAME} if [[ $? -ne 0 ]]; then @@ -47,25 +47,12 @@ stages: inputs: targetType: "inline" script: | - echo "--------------------" - $(CURRENT_PATH) - echo "---------1-----------" - cd $(CURRENT_PATH) - echo "---------2-----------" - ls - echo "--------------------" - $(CURRENT_PATH)/$(CODE_SCAN_PATH) - echo "---------1-----------" - cd $(CURRENT_PATH)/$(CODE_SCAN_PATH) - echo "---------2-----------" - ls - echo "--------------------" docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash /$(CODE_SCAN_PATH)/bandit/bandit.sh $(TARGET_PATH)" docker cp 'bandit':/lpot-bandit.log $(CURRENT_PATH)/lpot-bandit.log - task: PublishPipelineArtifact@1 inputs: - targetPath: $(CURRENT_PATH)/.azure-pipelines/scripts/codeScan + targetPath: artifact: $(BANDIT_CONTAINER_NAME) publishLocation: "pipeline" From 177004bbe3f45fd9e5731d2b89c4b261b7d7d0e4 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 13:38:54 +0800 Subject: [PATCH 165/271] test --- .azure-pipelines/code-scan.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index dc35c88dba9..200c6eb7031 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -47,12 +47,12 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash /$(CODE_SCAN_PATH)/bandit/bandit.sh $(TARGET_PATH)" + docker run --rm --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash /$(CODE_SCAN_PATH)/bandit/bandit.sh $(TARGET_PATH)" docker cp 'bandit':/lpot-bandit.log $(CURRENT_PATH)/lpot-bandit.log - task: PublishPipelineArtifact@1 inputs: - targetPath: + targetPath: $(CURRENT_PATH) artifact: $(BANDIT_CONTAINER_NAME) publishLocation: "pipeline" From b879d4c07db9d295ed685919b19206b6e765a983 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 13:54:37 +0800 Subject: [PATCH 166/271] test --- .azure-pipelines/code-scan.yml | 8 ++++---- .azure-pipelines/scripts/codeScan/scanLog/lpot-bandit.log | 1 + .gitignore | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 .azure-pipelines/scripts/codeScan/scanLog/lpot-bandit.log diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 200c6eb7031..0d66b4a8d58 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -30,7 +30,7 @@ stages: displayName: "Checkout out Repo" - script: | if [[ $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} --no-cache . + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi docker images | grep -i ${IMAGE_NAME} if [[ $? -ne 0 ]]; then @@ -47,12 +47,12 @@ stages: inputs: targetType: "inline" script: | - docker run --rm --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash /$(CODE_SCAN_PATH)/bandit/bandit.sh $(TARGET_PATH)" - docker cp 'bandit':/lpot-bandit.log $(CURRENT_PATH)/lpot-bandit.log + docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash /$(CODE_SCAN_PATH)/bandit/bandit.sh $(TARGET_PATH)" + docker cp 'bandit':/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - task: PublishPipelineArtifact@1 inputs: - targetPath: $(CURRENT_PATH) + targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log artifact: $(BANDIT_CONTAINER_NAME) publishLocation: "pipeline" diff --git a/.azure-pipelines/scripts/codeScan/scanLog/lpot-bandit.log b/.azure-pipelines/scripts/codeScan/scanLog/lpot-bandit.log new file mode 100644 index 00000000000..9d07aa0df55 --- /dev/null +++ b/.azure-pipelines/scripts/codeScan/scanLog/lpot-bandit.log @@ -0,0 +1 @@ +111 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6f4be8433c0..b222b2390cc 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ *.csv *.pb *.ckpt -*.log *.swp *.onnx *.so From d56cda01bc4cc0a0c66132c407e08a397692c0f9 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 14:00:29 +0800 Subject: [PATCH 167/271] test --- .azure-pipelines/code-scan.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 0d66b4a8d58..74d25843851 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -47,6 +47,15 @@ stages: inputs: targetType: "inline" script: | + echo "------------------------" + cd $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH) + ls -a + echo "------------------------" + cd $(CURRENT_PATH)/.azure-pipelines/scripts/codeScan + ls -a + echo "------------------------" + + docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash /$(CODE_SCAN_PATH)/bandit/bandit.sh $(TARGET_PATH)" docker cp 'bandit':/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log From a073dfa9aaab1fcb6d943b801aa4d8dc585b5b88 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 14:06:55 +0800 Subject: [PATCH 168/271] test --- .azure-pipelines/code-scan.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 74d25843851..dcdfa290139 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -47,13 +47,13 @@ stages: inputs: targetType: "inline" script: | - echo "------------------------" - cd $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH) - ls -a echo "------------------------" cd $(CURRENT_PATH)/.azure-pipelines/scripts/codeScan ls -a echo "------------------------" +- cd $(CURRENT_PATH)/.azure-pipelines/scripts/codeScan/scanLog + ls -a + echo "------------------------" docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash /$(CODE_SCAN_PATH)/bandit/bandit.sh $(TARGET_PATH)" From fa138a31a90d10299bb8b89903c5ef5abd39f03a Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 14:14:16 +0800 Subject: [PATCH 169/271] test --- .azure-pipelines/code-scan.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index dcdfa290139..7b4d3c76212 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -6,8 +6,8 @@ pool: suyue-test variables: IMAGE_NAME: "code-scan" IMAGE_TAG: "1.0" - CODE_SCAN_PATH: "neural_compressor/.azure-pipelines/scripts/codeScan" - CODE_SCAN_LOG_PATH: "neural_compressor/.azure-pipelines/scripts/codeScan/scanLog" + CODE_SCAN_PATH: ".azure-pipelines/scripts/codeScan" + CODE_SCAN_LOG_PATH: ".azure-pipelines/scripts/codeScan/scanLog" TARGET_PATH: "/neural_compressor" TARGET_BRANCH: $(System.PullRequest.TargetBranch) BANDIT_CONTAINER_NAME: "bandit" @@ -47,15 +47,6 @@ stages: inputs: targetType: "inline" script: | - echo "------------------------" - cd $(CURRENT_PATH)/.azure-pipelines/scripts/codeScan - ls -a - echo "------------------------" -- cd $(CURRENT_PATH)/.azure-pipelines/scripts/codeScan/scanLog - ls -a - echo "------------------------" - - docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash /$(CODE_SCAN_PATH)/bandit/bandit.sh $(TARGET_PATH)" docker cp 'bandit':/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log From 116423f9dbfdf4494edcfdac6c7fff0222dfc2d2 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 14:17:26 +0800 Subject: [PATCH 170/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 7b4d3c76212..422a6e179d1 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -47,7 +47,7 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash /$(CODE_SCAN_PATH)/bandit/bandit.sh $(TARGET_PATH)" + docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/bandit/bandit.sh $(TARGET_PATH)" docker cp 'bandit':/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - task: PublishPipelineArtifact@1 From fe1af55a1a356962dd2f8b5b69623cc3465ff63b Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 14:18:44 +0800 Subject: [PATCH 171/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 422a6e179d1..8cb5943b191 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -29,7 +29,7 @@ stages: - checkout: self displayName: "Checkout out Repo" - script: | - if [[ $(docker images | grep -i ${IMAGE_NAME}) ]]; then + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi docker images | grep -i ${IMAGE_NAME} From 0ee8c644c7acb3137e771e8860d3733460f2ccc8 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 14:25:53 +0800 Subject: [PATCH 172/271] test --- .azure-pipelines/code-scan.yml | 8 ++++---- .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 8cb5943b191..1366b2c8ece 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -7,7 +7,7 @@ variables: IMAGE_NAME: "code-scan" IMAGE_TAG: "1.0" CODE_SCAN_PATH: ".azure-pipelines/scripts/codeScan" - CODE_SCAN_LOG_PATH: ".azure-pipelines/scripts/codeScan/scanLog" + CODE_SCAN_LOG_PATH: "scanLog" TARGET_PATH: "/neural_compressor" TARGET_BRANCH: $(System.PullRequest.TargetBranch) BANDIT_CONTAINER_NAME: "bandit" @@ -47,12 +47,12 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/bandit/bandit.sh $(TARGET_PATH)" - docker cp 'bandit':/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh --TARGET_PATH $(TARGET_PATH)" + docker cp 'bandit':/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - task: PublishPipelineArtifact@1 inputs: - targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log artifact: $(BANDIT_CONTAINER_NAME) publishLocation: "pipeline" diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index 6c5facb4a1b..c343b9f10a3 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -1,7 +1,6 @@ pip install bandit -python -m bandit -r -lll -iii /neural_compressor > /lpot-bandit.log -# python -m bandit -r -lll -iii $(TARGET_PATH) > /lpot-bandit.log +python -m bandit -r -lll -iii ${TARGET_PATH} > /lpot-bandit.log exit_code=$? if [ ${exit_code} -ne 0 ] ; then From 17465d259b026d19c1ceee1a2e2409b21614d809 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 14:37:44 +0800 Subject: [PATCH 173/271] test --- .azure-pipelines/code-scan.yml | 83 +++++++++++-------- .../scripts/codeScan/pylint/pylint.sh | 2 +- 2 files changed, 50 insertions(+), 35 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 1366b2c8ece..1dd0946e316 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -9,8 +9,12 @@ variables: CODE_SCAN_PATH: ".azure-pipelines/scripts/codeScan" CODE_SCAN_LOG_PATH: "scanLog" TARGET_PATH: "/neural_compressor" - TARGET_BRANCH: $(System.PullRequest.TargetBranch) BANDIT_CONTAINER_NAME: "bandit" + PYLINT_CONTAINER_NAME: "pylint" + PYSPELLING_CONTAINER_NAME: "pyspelling" + COPYRIGHT_CONTAINER_NAME: "copyright" + + TARGET_BRANCH: $(System.PullRequest.TargetBranch) CURRENT_PATH: $(Build.SourcesDirectory) stages: @@ -47,8 +51,8 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh --TARGET_PATH $(TARGET_PATH)" - docker cp 'bandit':/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh --TARGET_PATH $(TARGET_PATH)" + docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - task: PublishPipelineArtifact@1 inputs: @@ -56,41 +60,52 @@ stages: artifact: $(BANDIT_CONTAINER_NAME) publishLocation: "pipeline" - # - stage: pylint - # displayName: pylint code scan - # dependsOn: [] - # jobs: - # - job: Build - # displayName: Build - # steps: - # - script: | - # echo ${BUILD_SOURCESDIRECTORY} - # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # # echo y | docker system prune - # displayName: 'Clean workspace' + - stage: PylintCodeScan + displayName: Pylint Code Scan + dependsOn: [] + jobs: + - job: Pylint + displayName: Pylint + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + echo y | docker system prune + displayName: "Clean workspace" + - checkout: self + displayName: "Checkout out Repo" + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: "Clean Docker" - # - checkout: self - # displayName: "Checkout out Repo" + - task: Bash@3 + inputs: + targetType: "inline" + script: | + docker run --disable-content-trust --privileged --name=$(PYLINT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYLINT_CONTAINER_NAME)/pylint.sh --TARGET_PATH $(TARGET_PATH)" + docker cp $(PYLINT_CONTAINER_NAME):/lpot-pylint.json $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json - # - script: | - # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - # fi - # docker images | grep -i ${IMAGE_NAME} - # if [[ $? -ne 0 ]]; then - # echo "NO Such Image ${IMAGE_NAME}" - # exit 1 - # fi - # displayName: "Build Devel Images" + - task: PublishPipelineArtifact@1 + inputs: + targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json + artifact: $(PYLINT_CONTAINER_NAME) + publishLocation: "pipeline" + - # - script: | - # docker stop $(docker ps -aq) - # docker rm -vf $(docker ps -aq) || true - # displayName: 'Clean Docker' - # - script: | - # docker run --disable-content-trust --privileged --name="pylint" --hostname="pylint-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pylint/pylint.sh $(VAL_PATH) $(target_path)" - # displayName: 'pylint code scan' + - script: | + displayName: 'pylint code scan' # - stage: pyspelling # displayName: pyspelling code scan diff --git a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh index d169be1b468..cc0830f8872 100644 --- a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh +++ b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh @@ -16,7 +16,7 @@ pip install onnxruntime_extensions -python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto --ignored-modules=tensorflow,torch,torch.quantization,torch.tensor,torchvision,mxnet,onnx,onnxruntime ./$2 +python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto --ignored-modules=tensorflow,torch,torch.quantization,torch.tensor,torchvision,mxnet,onnx,onnxruntime ${TARGET_PATH} > /lpot-pylint.json exit_code=$? if [ ${exit_code} -ne 0 ] ; then From 356ce8019b6868f1dc385a1743c8e8bdfd417e14 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 14:38:44 +0800 Subject: [PATCH 174/271] test --- .azure-pipelines/code-scan.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 1dd0946e316..f0c224d485f 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -101,11 +101,6 @@ stages: targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json artifact: $(PYLINT_CONTAINER_NAME) publishLocation: "pipeline" - - - - - script: | - displayName: 'pylint code scan' # - stage: pyspelling # displayName: pyspelling code scan From 355203958dbf8395248f9cc4e0d8ea9cb1e1ab7c Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 14:54:39 +0800 Subject: [PATCH 175/271] test --- .azure-pipelines/code-scan.yml | 42 +++++++++++++++++++ .../scripts/codeScan/pyspelling/pyspelling.sh | 11 ++--- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index f0c224d485f..3ab56ffe336 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -102,6 +102,48 @@ stages: artifact: $(PYLINT_CONTAINER_NAME) publishLocation: "pipeline" + - stage: PyspellingCodeScan + displayName: Pyspelling Code Scan + dependsOn: [] + jobs: + - job: Pyspelling + displayName: Pyspelling + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + echo y | docker system prune + displayName: "Clean workspace" + - checkout: self + displayName: "Checkout out Repo" + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: "Clean Docker" + + - task: Bash@3 + inputs: + targetType: "inline" + script: | + docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/pyspelling.sh --TARGET_PATH $(TARGET_PATH)/$(CODE_SCAN_PATH) --PYSPELLING_CONTAINER_NAME $(PYSPELLING_CONTAINER_NAME)" + docker cp $(PYSPELLING_CONTAINER_NAME):/lpot_pyspelling.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log + + - task: PublishPipelineArtifact@1 + inputs: + targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log + artifact: $(PYSPELLING_CONTAINER_NAME) + publishLocation: "pipeline" + # - stage: pyspelling # displayName: pyspelling code scan # dependsOn: [] diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh index 9774c9ae6fa..b6ab4a50b68 100644 --- a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh @@ -1,6 +1,3 @@ -# $1: $(VAL_PATH) -# $2: $(BUILD_DIRECTORY) - $(Build.SourcesDirectory) - pip install pyspelling pip install -r requirements.txt @@ -8,11 +5,11 @@ apt-get install aspell -y apt-get install aspell-en -y -sed -i "s|\${VAL_REPO}|$1|g" $1/pyspelling/pyspelling_conf.yaml -sed -i "s|\${LPOT_REPO}|.|g" $1/pyspelling/pyspelling_conf.yaml +sed -i "s|\${VAL_REPO}|${TARGET_PATH}|g" ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}/pyspelling_conf.yaml +sed -i "s|\${LPOT_REPO}|.|g" ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}/pyspelling_conf.yaml echo "Modified config:" -cat $1/pyspelling/pyspelling_conf.yaml -pyspelling -c $1/pyspelling/pyspelling_conf.yaml > $1/pyspelling/pyspelling_output.log +cat ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}/pyspelling_conf.yaml +pyspelling -c ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}/pyspelling_conf.yaml > /lpot_pyspelling.log exit_code=$? if [ ${exit_code} -ne 0 ] ; then echo "Pyspelling exited with non-zero exit code."; exit 1 From 3ee9be71975e979dfc669cd29d17f32c007bd446 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 15:01:45 +0800 Subject: [PATCH 176/271] test --- .azure-pipelines/code-scan.yml | 206 ++++++++---------- .../scripts/codeScan/pyspelling/pyspelling.sh | 8 +- 2 files changed, 90 insertions(+), 124 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 3ab56ffe336..a4c3640ec9d 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -6,9 +6,11 @@ pool: suyue-test variables: IMAGE_NAME: "code-scan" IMAGE_TAG: "1.0" + + TARGET_PATH: "/neural_compressor" CODE_SCAN_PATH: ".azure-pipelines/scripts/codeScan" CODE_SCAN_LOG_PATH: "scanLog" - TARGET_PATH: "/neural_compressor" + BANDIT_CONTAINER_NAME: "bandit" PYLINT_CONTAINER_NAME: "pylint" PYSPELLING_CONTAINER_NAME: "pyspelling" @@ -18,89 +20,89 @@ variables: CURRENT_PATH: $(Build.SourcesDirectory) stages: - - stage: BanditCodeScan - displayName: Bandit Code Scan - dependsOn: [] - jobs: - - job: Bandit - displayName: Bandit - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - echo y | docker system prune - displayName: "Clean workspace" - - checkout: self - displayName: "Checkout out Repo" - - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: "Clean Docker" - - - task: Bash@3 - inputs: - targetType: "inline" - script: | - docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh --TARGET_PATH $(TARGET_PATH)" - docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - - - task: PublishPipelineArtifact@1 - inputs: - targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - artifact: $(BANDIT_CONTAINER_NAME) - publishLocation: "pipeline" - - - stage: PylintCodeScan - displayName: Pylint Code Scan - dependsOn: [] - jobs: - - job: Pylint - displayName: Pylint - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - echo y | docker system prune - displayName: "Clean workspace" - - checkout: self - displayName: "Checkout out Repo" - - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: "Clean Docker" - - - task: Bash@3 - inputs: - targetType: "inline" - script: | - docker run --disable-content-trust --privileged --name=$(PYLINT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYLINT_CONTAINER_NAME)/pylint.sh --TARGET_PATH $(TARGET_PATH)" - docker cp $(PYLINT_CONTAINER_NAME):/lpot-pylint.json $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json - - - task: PublishPipelineArtifact@1 - inputs: - targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json - artifact: $(PYLINT_CONTAINER_NAME) - publishLocation: "pipeline" + # - stage: BanditCodeScan + # displayName: Bandit Code Scan + # dependsOn: [] + # jobs: + # - job: Bandit + # displayName: Bandit + # steps: + # - script: | + # echo ${BUILD_SOURCESDIRECTORY} + # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # echo y | docker system prune + # displayName: "Clean workspace" + # - checkout: self + # displayName: "Checkout out Repo" + # - script: | + # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + # fi + # docker images | grep -i ${IMAGE_NAME} + # if [[ $? -ne 0 ]]; then + # echo "NO Such Image ${IMAGE_NAME}" + # exit 1 + # fi + # displayName: "Build Devel Images" + # - script: | + # docker stop $(docker ps -aq) + # docker rm -vf $(docker ps -aq) || true + # displayName: "Clean Docker" + + # - task: Bash@3 + # inputs: + # targetType: "inline" + # script: | + # docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh --TARGET_PATH $(TARGET_PATH)" + # docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + + # - task: PublishPipelineArtifact@1 + # inputs: + # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + # artifact: $(BANDIT_CONTAINER_NAME) + # publishLocation: "pipeline" + + # - stage: PylintCodeScan + # displayName: Pylint Code Scan + # dependsOn: [] + # jobs: + # - job: Pylint + # displayName: Pylint + # steps: + # - script: | + # echo ${BUILD_SOURCESDIRECTORY} + # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # echo y | docker system prune + # displayName: "Clean workspace" + # - checkout: self + # displayName: "Checkout out Repo" + # - script: | + # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + # fi + # docker images | grep -i ${IMAGE_NAME} + # if [[ $? -ne 0 ]]; then + # echo "NO Such Image ${IMAGE_NAME}" + # exit 1 + # fi + # displayName: "Build Devel Images" + # - script: | + # docker stop $(docker ps -aq) + # docker rm -vf $(docker ps -aq) || true + # displayName: "Clean Docker" + + # - task: Bash@3 + # inputs: + # targetType: "inline" + # script: | + # docker run --disable-content-trust --privileged --name=$(PYLINT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYLINT_CONTAINER_NAME)/pylint.sh --TARGET_PATH $(TARGET_PATH)" + # docker cp $(PYLINT_CONTAINER_NAME):/lpot-pylint.json $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json + + # - task: PublishPipelineArtifact@1 + # inputs: + # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json + # artifact: $(PYLINT_CONTAINER_NAME) + # publishLocation: "pipeline" - stage: PyspellingCodeScan displayName: Pyspelling Code Scan @@ -144,42 +146,6 @@ stages: artifact: $(PYSPELLING_CONTAINER_NAME) publishLocation: "pipeline" - # - stage: pyspelling - # displayName: pyspelling code scan - # dependsOn: [] - # jobs: - # - job: Build - # displayName: Build - # steps: - # - script: | - # echo ${BUILD_SOURCESDIRECTORY} - # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # # echo y | docker system prune - # displayName: 'Clean workspace' - - # - checkout: self - # displayName: "Checkout out Repo" - - # - script: | - # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - # fi - # docker images | grep -i ${IMAGE_NAME} - # if [[ $? -ne 0 ]]; then - # echo "NO Such Image ${IMAGE_NAME}" - # exit 1 - # fi - # displayName: "Build Devel Images" - - # - script: | - # docker stop $(docker ps -aq) - # docker rm -vf $(docker ps -aq) || true - # displayName: 'Clean Docker' - - # - script: | - # docker run --disable-content-trust --privileged --name="pyspelling" --hostname="pyspelling-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash -x -c "cd /neural_compressor && bash $(VAL_PATH)/pyspelling/pyspelling.sh $(VAL_PATH) $(CURRENT_PATH)" - # displayName: 'pyspelling code scan' - # - stage: copyright # displayName: copyright code scan # dependsOn: [] diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh index b6ab4a50b68..dba4a5c8bca 100644 --- a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh @@ -5,11 +5,11 @@ apt-get install aspell -y apt-get install aspell-en -y -sed -i "s|\${VAL_REPO}|${TARGET_PATH}|g" ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}/pyspelling_conf.yaml -sed -i "s|\${LPOT_REPO}|.|g" ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}/pyspelling_conf.yaml +sed -i "s|\${VAL_REPO}|${TARGET_PATH}|g" ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}pyspelling_conf.yaml +sed -i "s|\${LPOT_REPO}|.|g" ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}pyspelling_conf.yaml echo "Modified config:" -cat ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}/pyspelling_conf.yaml -pyspelling -c ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}/pyspelling_conf.yaml > /lpot_pyspelling.log +cat ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}pyspelling_conf.yaml +pyspelling -c ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}pyspelling_conf.yaml > /lpot_pyspelling.log exit_code=$? if [ ${exit_code} -ne 0 ] ; then echo "Pyspelling exited with non-zero exit code."; exit 1 From 335331d25f6a76f87393c09beae5318da95b7d2e Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 15:06:01 +0800 Subject: [PATCH 177/271] test --- .azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh index dba4a5c8bca..5e9078c84ef 100644 --- a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh @@ -4,6 +4,13 @@ pip install -r requirements.txt apt-get install aspell -y apt-get install aspell-en -y +echo "---------------------" +${TARGET_PATH} +echo "---------------------" +${PYSPELLING_CONTAINER_NAME} +echo "---------------------" +cd ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME} +echo "---------------------------------------" sed -i "s|\${VAL_REPO}|${TARGET_PATH}|g" ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}pyspelling_conf.yaml sed -i "s|\${LPOT_REPO}|.|g" ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}pyspelling_conf.yaml From ad0fa292ddb6f52f8ab9c378a84f1f5e1dee4565 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 15:17:07 +0800 Subject: [PATCH 178/271] test --- .azure-pipelines/code-scan.yml | 2 +- .../scripts/codeScan/pyspelling/pyspelling.sh | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index a4c3640ec9d..1e5c48fc455 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -137,7 +137,7 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/pyspelling.sh --TARGET_PATH $(TARGET_PATH)/$(CODE_SCAN_PATH) --PYSPELLING_CONTAINER_NAME $(PYSPELLING_CONTAINER_NAME)" + docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/pyspelling.sh --PYSPELLING_CONTAINER_NAME $(PYSPELLING_CONTAINER_NAME)" docker cp $(PYSPELLING_CONTAINER_NAME):/lpot_pyspelling.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log - task: PublishPipelineArtifact@1 diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh index 5e9078c84ef..347f79e116a 100644 --- a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh @@ -12,11 +12,11 @@ echo "---------------------" cd ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME} echo "---------------------------------------" -sed -i "s|\${VAL_REPO}|${TARGET_PATH}|g" ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}pyspelling_conf.yaml -sed -i "s|\${LPOT_REPO}|.|g" ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}pyspelling_conf.yaml +sed -i "s|\${VAL_REPO}|${TARGET_PATH}|g" ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}/pyspelling_conf.yaml +sed -i "s|\${LPOT_REPO}|.|g" ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}/pyspelling_conf.yaml echo "Modified config:" -cat ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}pyspelling_conf.yaml -pyspelling -c ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}pyspelling_conf.yaml > /lpot_pyspelling.log +cat ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}/pyspelling_conf.yaml +pyspelling -c ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}/pyspelling_conf.yaml > /lpot_pyspelling.log exit_code=$? if [ ${exit_code} -ne 0 ] ; then echo "Pyspelling exited with non-zero exit code."; exit 1 From a6231d5406a67eabf561e7098429ee25bbdb0684 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 15:17:23 +0800 Subject: [PATCH 179/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 1e5c48fc455..19d1b9f9c46 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -137,7 +137,7 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/pyspelling.sh --PYSPELLING_CONTAINER_NAME $(PYSPELLING_CONTAINER_NAME)" + docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/pyspelling.sh --PYSPELLING_CONTAINER_NAME $(PYSPELLING_CONTAINER_NAME) --TARGET_PATH $(TARGET_PATH)/$(CODE_SCAN_PATH)" docker cp $(PYSPELLING_CONTAINER_NAME):/lpot_pyspelling.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log - task: PublishPipelineArtifact@1 From 0bce4fa6f99aa46ca8bde6482e18fc5f5822e7d7 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 15:19:31 +0800 Subject: [PATCH 180/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 19d1b9f9c46..1e5c48fc455 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -137,7 +137,7 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/pyspelling.sh --PYSPELLING_CONTAINER_NAME $(PYSPELLING_CONTAINER_NAME) --TARGET_PATH $(TARGET_PATH)/$(CODE_SCAN_PATH)" + docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/pyspelling.sh --PYSPELLING_CONTAINER_NAME $(PYSPELLING_CONTAINER_NAME)" docker cp $(PYSPELLING_CONTAINER_NAME):/lpot_pyspelling.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log - task: PublishPipelineArtifact@1 From c94b138ee96318a386589a180adc82fa700e040a Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 15:38:11 +0800 Subject: [PATCH 181/271] test --- .azure-pipelines/code-scan.yml | 118 +++++++++--------- .../scripts/codeScan/bandit/bandit.sh | 4 + 2 files changed, 63 insertions(+), 59 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 1e5c48fc455..12d208fb805 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -20,12 +20,54 @@ variables: CURRENT_PATH: $(Build.SourcesDirectory) stages: - # - stage: BanditCodeScan - # displayName: Bandit Code Scan + - stage: BanditCodeScan + displayName: Bandit Code Scan + dependsOn: [] + jobs: + - job: Bandit + displayName: Bandit + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + echo y | docker system prune + displayName: "Clean workspace" + - checkout: self + displayName: "Checkout out Repo" + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: "Clean Docker" + + - task: Bash@3 + inputs: + targetType: "inline" + script: | + docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh --TARGET_PATH $(TARGET_PATH)" + docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + + - task: PublishPipelineArtifact@1 + inputs: + targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + artifact: $(BANDIT_CONTAINER_NAME) + publishLocation: "pipeline" + + # - stage: PylintCodeScan + # displayName: Pylint Code Scan # dependsOn: [] # jobs: - # - job: Bandit - # displayName: Bandit + # - job: Pylint + # displayName: Pylint # steps: # - script: | # echo ${BUILD_SOURCESDIRECTORY} @@ -53,21 +95,21 @@ stages: # inputs: # targetType: "inline" # script: | - # docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh --TARGET_PATH $(TARGET_PATH)" - # docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + # docker run --disable-content-trust --privileged --name=$(PYLINT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYLINT_CONTAINER_NAME)/pylint.sh --TARGET_PATH $(TARGET_PATH)" + # docker cp $(PYLINT_CONTAINER_NAME):/lpot-pylint.json $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json # - task: PublishPipelineArtifact@1 # inputs: - # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - # artifact: $(BANDIT_CONTAINER_NAME) + # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json + # artifact: $(PYLINT_CONTAINER_NAME) # publishLocation: "pipeline" - # - stage: PylintCodeScan - # displayName: Pylint Code Scan + # - stage: PyspellingCodeScan + # displayName: Pyspelling Code Scan # dependsOn: [] # jobs: - # - job: Pylint - # displayName: Pylint + # - job: Pyspelling + # displayName: Pyspelling # steps: # - script: | # echo ${BUILD_SOURCESDIRECTORY} @@ -95,56 +137,14 @@ stages: # inputs: # targetType: "inline" # script: | - # docker run --disable-content-trust --privileged --name=$(PYLINT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYLINT_CONTAINER_NAME)/pylint.sh --TARGET_PATH $(TARGET_PATH)" - # docker cp $(PYLINT_CONTAINER_NAME):/lpot-pylint.json $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json + # docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/pyspelling.sh --PYSPELLING_CONTAINER_NAME $(PYSPELLING_CONTAINER_NAME)" + # docker cp $(PYSPELLING_CONTAINER_NAME):/lpot_pyspelling.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log # - task: PublishPipelineArtifact@1 # inputs: - # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json - # artifact: $(PYLINT_CONTAINER_NAME) - # publishLocation: "pipeline" - - - stage: PyspellingCodeScan - displayName: Pyspelling Code Scan - dependsOn: [] - jobs: - - job: Pyspelling - displayName: Pyspelling - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - echo y | docker system prune - displayName: "Clean workspace" - - checkout: self - displayName: "Checkout out Repo" - - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: "Clean Docker" - - - task: Bash@3 - inputs: - targetType: "inline" - script: | - docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/pyspelling.sh --PYSPELLING_CONTAINER_NAME $(PYSPELLING_CONTAINER_NAME)" - docker cp $(PYSPELLING_CONTAINER_NAME):/lpot_pyspelling.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log - - - task: PublishPipelineArtifact@1 - inputs: - targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log - artifact: $(PYSPELLING_CONTAINER_NAME) - publishLocation: "pipeline" + # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log + # artifact: $(PYSPELLING_CONTAINER_NAME) + # publishLocation: "pipeline" # - stage: copyright # displayName: copyright code scan diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index c343b9f10a3..31f07c7e164 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -1,5 +1,9 @@ pip install bandit +echo "--------------------" +${TARGET_PATH} +echo "--------------------" + python -m bandit -r -lll -iii ${TARGET_PATH} > /lpot-bandit.log exit_code=$? From 0bbb2cc8bb7ab94e153debef8a621b11bed4704f Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 15:48:15 +0800 Subject: [PATCH 182/271] test --- .azure-pipelines/code-scan.yml | 2 +- .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 12d208fb805..7ffa22e7d5a 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -53,7 +53,7 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh --TARGET_PATH $(TARGET_PATH)" + docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh $(TARGET_PATH)" docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - task: PublishPipelineArtifact@1 diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index 31f07c7e164..f29b5eaebb5 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -1,10 +1,10 @@ pip install bandit echo "--------------------" -${TARGET_PATH} +$1 echo "--------------------" -python -m bandit -r -lll -iii ${TARGET_PATH} > /lpot-bandit.log +python -m bandit -r -lll -iii $1 > /lpot-bandit.log exit_code=$? if [ ${exit_code} -ne 0 ] ; then From 999cfb44c13ab2535d0d5bf54a5c574a92269aa5 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 15:52:39 +0800 Subject: [PATCH 183/271] test --- .azure-pipelines/code-scan.yml | 2 +- .../scripts/codeScan/pylint/pylint.sh | 2 +- .../scripts/codeScan/pyspelling/pyspelling.sh | 16 +++++++--------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 7ffa22e7d5a..9cdd0be979d 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -95,7 +95,7 @@ stages: # inputs: # targetType: "inline" # script: | - # docker run --disable-content-trust --privileged --name=$(PYLINT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYLINT_CONTAINER_NAME)/pylint.sh --TARGET_PATH $(TARGET_PATH)" + # docker run --disable-content-trust --privileged --name=$(PYLINT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYLINT_CONTAINER_NAME)/pylint.sh $(TARGET_PATH)" # docker cp $(PYLINT_CONTAINER_NAME):/lpot-pylint.json $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json # - task: PublishPipelineArtifact@1 diff --git a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh index cc0830f8872..0b015ccb71e 100644 --- a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh +++ b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh @@ -16,7 +16,7 @@ pip install onnxruntime_extensions -python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto --ignored-modules=tensorflow,torch,torch.quantization,torch.tensor,torchvision,mxnet,onnx,onnxruntime ${TARGET_PATH} > /lpot-pylint.json +python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto --ignored-modules=tensorflow,torch,torch.quantization,torch.tensor,torchvision,mxnet,onnx,onnxruntime $1 > /lpot-pylint.json exit_code=$? if [ ${exit_code} -ne 0 ] ; then diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh index 347f79e116a..33176c21424 100644 --- a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh @@ -5,18 +5,16 @@ apt-get install aspell -y apt-get install aspell-en -y echo "---------------------" -${TARGET_PATH} +$1 echo "---------------------" -${PYSPELLING_CONTAINER_NAME} -echo "---------------------" -cd ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME} -echo "---------------------------------------" +$2 + -sed -i "s|\${VAL_REPO}|${TARGET_PATH}|g" ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}/pyspelling_conf.yaml -sed -i "s|\${LPOT_REPO}|.|g" ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}/pyspelling_conf.yaml +sed -i "s|\${VAL_REPO}|$1|g" $1/$2/pyspelling_conf.yaml +sed -i "s|\${LPOT_REPO}|.|g" $1/$2/pyspelling_conf.yaml echo "Modified config:" -cat ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}/pyspelling_conf.yaml -pyspelling -c ${TARGET_PATH}/${PYSPELLING_CONTAINER_NAME}/pyspelling_conf.yaml > /lpot_pyspelling.log +cat $1/$2/pyspelling_conf.yaml +pyspelling -c $1/$2/pyspelling_conf.yaml > /lpot_pyspelling.log exit_code=$? if [ ${exit_code} -ne 0 ] ; then echo "Pyspelling exited with non-zero exit code."; exit 1 From 03a6a7ae1b1c0e4bafc2a2966e3a8d84879f977e Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 15:52:54 +0800 Subject: [PATCH 184/271] test --- .azure-pipelines/code-scan.yml | 166 ++++++++++++++++----------------- 1 file changed, 83 insertions(+), 83 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 9cdd0be979d..d0a0393b0ec 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -62,89 +62,89 @@ stages: artifact: $(BANDIT_CONTAINER_NAME) publishLocation: "pipeline" - # - stage: PylintCodeScan - # displayName: Pylint Code Scan - # dependsOn: [] - # jobs: - # - job: Pylint - # displayName: Pylint - # steps: - # - script: | - # echo ${BUILD_SOURCESDIRECTORY} - # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # echo y | docker system prune - # displayName: "Clean workspace" - # - checkout: self - # displayName: "Checkout out Repo" - # - script: | - # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - # fi - # docker images | grep -i ${IMAGE_NAME} - # if [[ $? -ne 0 ]]; then - # echo "NO Such Image ${IMAGE_NAME}" - # exit 1 - # fi - # displayName: "Build Devel Images" - # - script: | - # docker stop $(docker ps -aq) - # docker rm -vf $(docker ps -aq) || true - # displayName: "Clean Docker" - - # - task: Bash@3 - # inputs: - # targetType: "inline" - # script: | - # docker run --disable-content-trust --privileged --name=$(PYLINT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYLINT_CONTAINER_NAME)/pylint.sh $(TARGET_PATH)" - # docker cp $(PYLINT_CONTAINER_NAME):/lpot-pylint.json $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json - - # - task: PublishPipelineArtifact@1 - # inputs: - # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json - # artifact: $(PYLINT_CONTAINER_NAME) - # publishLocation: "pipeline" - - # - stage: PyspellingCodeScan - # displayName: Pyspelling Code Scan - # dependsOn: [] - # jobs: - # - job: Pyspelling - # displayName: Pyspelling - # steps: - # - script: | - # echo ${BUILD_SOURCESDIRECTORY} - # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # echo y | docker system prune - # displayName: "Clean workspace" - # - checkout: self - # displayName: "Checkout out Repo" - # - script: | - # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - # fi - # docker images | grep -i ${IMAGE_NAME} - # if [[ $? -ne 0 ]]; then - # echo "NO Such Image ${IMAGE_NAME}" - # exit 1 - # fi - # displayName: "Build Devel Images" - # - script: | - # docker stop $(docker ps -aq) - # docker rm -vf $(docker ps -aq) || true - # displayName: "Clean Docker" - - # - task: Bash@3 - # inputs: - # targetType: "inline" - # script: | - # docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/pyspelling.sh --PYSPELLING_CONTAINER_NAME $(PYSPELLING_CONTAINER_NAME)" - # docker cp $(PYSPELLING_CONTAINER_NAME):/lpot_pyspelling.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log - - # - task: PublishPipelineArtifact@1 - # inputs: - # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log - # artifact: $(PYSPELLING_CONTAINER_NAME) - # publishLocation: "pipeline" + - stage: PylintCodeScan + displayName: Pylint Code Scan + dependsOn: [] + jobs: + - job: Pylint + displayName: Pylint + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + echo y | docker system prune + displayName: "Clean workspace" + - checkout: self + displayName: "Checkout out Repo" + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: "Clean Docker" + + - task: Bash@3 + inputs: + targetType: "inline" + script: | + docker run --disable-content-trust --privileged --name=$(PYLINT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYLINT_CONTAINER_NAME)/pylint.sh $(TARGET_PATH)" + docker cp $(PYLINT_CONTAINER_NAME):/lpot-pylint.json $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json + + - task: PublishPipelineArtifact@1 + inputs: + targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json + artifact: $(PYLINT_CONTAINER_NAME) + publishLocation: "pipeline" + + - stage: PyspellingCodeScan + displayName: Pyspelling Code Scan + dependsOn: [] + jobs: + - job: Pyspelling + displayName: Pyspelling + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + echo y | docker system prune + displayName: "Clean workspace" + - checkout: self + displayName: "Checkout out Repo" + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: "Clean Docker" + + - task: Bash@3 + inputs: + targetType: "inline" + script: | + docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/pyspelling.sh $(CURRENT_PATH)/$(CODE_SCAN_PATH) $(PYSPELLING_CONTAINER_NAME)" + docker cp $(PYSPELLING_CONTAINER_NAME):/lpot_pyspelling.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log + + - task: PublishPipelineArtifact@1 + inputs: + targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log + artifact: $(PYSPELLING_CONTAINER_NAME) + publishLocation: "pipeline" # - stage: copyright # displayName: copyright code scan From 9e1f33c8b1b1de7df408a832e217f6b1ca4d5d58 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 16:00:29 +0800 Subject: [PATCH 185/271] test --- .azure-pipelines/code-scan.yml | 2 +- .../scripts/codeScan/pyspelling/pyspelling.sh | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index d0a0393b0ec..8ab5c071756 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -137,7 +137,7 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/pyspelling.sh $(CURRENT_PATH)/$(CODE_SCAN_PATH) $(PYSPELLING_CONTAINER_NAME)" + docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/pyspelling.sh $(TARGET_PATH)" docker cp $(PYSPELLING_CONTAINER_NAME):/lpot_pyspelling.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log - task: PublishPipelineArtifact@1 diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh index 33176c21424..5c17766a911 100644 --- a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh @@ -4,17 +4,13 @@ pip install -r requirements.txt apt-get install aspell -y apt-get install aspell-en -y -echo "---------------------" -$1 -echo "---------------------" -$2 -sed -i "s|\${VAL_REPO}|$1|g" $1/$2/pyspelling_conf.yaml -sed -i "s|\${LPOT_REPO}|.|g" $1/$2/pyspelling_conf.yaml +sed -i "s|\${VAL_REPO}|$1|g" $1/pyspelling_conf.yaml +sed -i "s|\${LPOT_REPO}|.|g" $1/pyspelling_conf.yaml echo "Modified config:" -cat $1/$2/pyspelling_conf.yaml -pyspelling -c $1/$2/pyspelling_conf.yaml > /lpot_pyspelling.log +cat $1/pyspelling_conf.yaml +pyspelling -c $1/pyspelling_conf.yaml > /lpot_pyspelling.log exit_code=$? if [ ${exit_code} -ne 0 ] ; then echo "Pyspelling exited with non-zero exit code."; exit 1 From b92845a826ce5e6098c6f5495ae3ee41976b550c Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 16:04:33 +0800 Subject: [PATCH 186/271] test --- .azure-pipelines/scripts/codeScan/pylint/pylint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh index 0b015ccb71e..a6ff9db0999 100644 --- a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh +++ b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh @@ -16,7 +16,7 @@ pip install onnxruntime_extensions -python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto --ignored-modules=tensorflow,torch,torch.quantization,torch.tensor,torchvision,mxnet,onnx,onnxruntime $1 > /lpot-pylint.json +python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto --ignored-modules=tensorflow,torch,torch.quantization,torch.tensor,torchvision,mxnet,onnx,onnxruntime $1/$1 > /lpot-pylint.json exit_code=$? if [ ${exit_code} -ne 0 ] ; then From 42dc109d02cebdcc4d255bae40162a695c52913c Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 16:07:24 +0800 Subject: [PATCH 187/271] test --- .../scripts/codeScan/pyspelling/pyspelling.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh index 5c17766a911..9fb260d83bc 100644 --- a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh @@ -6,11 +6,11 @@ apt-get install aspell-en -y -sed -i "s|\${VAL_REPO}|$1|g" $1/pyspelling_conf.yaml -sed -i "s|\${LPOT_REPO}|.|g" $1/pyspelling_conf.yaml +sed -i "s|\${VAL_REPO}|$1|g" $1/.azure-pipelines/scripts/codeScan/pyspelling_conf.yaml +sed -i "s|\${LPOT_REPO}|.|g" $1/.azure-pipelines/scripts/codeScan/pyspelling_conf.yaml echo "Modified config:" -cat $1/pyspelling_conf.yaml -pyspelling -c $1/pyspelling_conf.yaml > /lpot_pyspelling.log +cat $1/.azure-pipelines/scripts/codeScan/pyspelling_conf.yaml +pyspelling -c $1/.azure-pipelines/scripts/codeScan/pyspelling_conf.yaml > /lpot_pyspelling.log exit_code=$? if [ ${exit_code} -ne 0 ] ; then echo "Pyspelling exited with non-zero exit code."; exit 1 From ad64b2bce1af2adec0cdeb66e31855fd13e16e50 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 16:10:52 +0800 Subject: [PATCH 188/271] test --- .../scripts/codeScan/pyspelling/pyspelling.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh index 9fb260d83bc..f03e726c73c 100644 --- a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh @@ -6,11 +6,11 @@ apt-get install aspell-en -y -sed -i "s|\${VAL_REPO}|$1|g" $1/.azure-pipelines/scripts/codeScan/pyspelling_conf.yaml -sed -i "s|\${LPOT_REPO}|.|g" $1/.azure-pipelines/scripts/codeScan/pyspelling_conf.yaml +sed -i "s|\${VAL_REPO}|$1|g" /neural_compressor/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling_conf.yaml +sed -i "s|\${LPOT_REPO}|.|g" /neural_compressor/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling_conf.yaml echo "Modified config:" -cat $1/.azure-pipelines/scripts/codeScan/pyspelling_conf.yaml -pyspelling -c $1/.azure-pipelines/scripts/codeScan/pyspelling_conf.yaml > /lpot_pyspelling.log +cat /neural_compressor/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling_conf.yaml +pyspelling -c /neural_compressor/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling_conf.yaml > /lpot_pyspelling.log exit_code=$? if [ ${exit_code} -ne 0 ] ; then echo "Pyspelling exited with non-zero exit code."; exit 1 From b609ee9b233642a0bf400f4e72e35b87226f9e1e Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 16:17:31 +0800 Subject: [PATCH 189/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 8ab5c071756..9db945627e1 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -137,7 +137,7 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/pyspelling.sh $(TARGET_PATH)" + docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/pyspelling.sh $(TARGET_PATH)/$(CODE_SCAN_PATH)" docker cp $(PYSPELLING_CONTAINER_NAME):/lpot_pyspelling.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log - task: PublishPipelineArtifact@1 From 7c61991e6e5136b0b7b902b68d5fea89720d492f Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 16:21:29 +0800 Subject: [PATCH 190/271] test --- .azure-pipelines/code-scan.yml | 77 ++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 36 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 9db945627e1..ae77eb8a2f2 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -146,39 +146,44 @@ stages: artifact: $(PYSPELLING_CONTAINER_NAME) publishLocation: "pipeline" - # - stage: copyright - # displayName: copyright code scan - # dependsOn: [] - # jobs: - # - job: Build - # displayName: Build - # steps: - # - script: | - # echo ${BUILD_SOURCESDIRECTORY} - # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # # echo y | docker system prune - # displayName: 'Clean workspace' - - # - checkout: self - # displayName: "Checkout out Repo" - - # - script: | - # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - # fi - # docker images | grep -i ${IMAGE_NAME} - # if [[ $? -ne 0 ]]; then - # echo "NO Such Image ${IMAGE_NAME}" - # exit 1 - # fi - # displayName: "Build Devel Images" - - # - script: | - # docker stop $(docker ps -aq) - # docker rm -vf $(docker ps -aq) || true - # displayName: 'Clean Docker' - - # - script: | - # docker run --env PYTHONPATH="/neural-compressor" ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "pwd && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" - # # docker run --disable-content-trust --privileged --name="copyright" --hostname="copyright-host" -v ${BUILD_SOURCESDIRECTORY}:/neural_compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd /neural_compressor && bash $(VAL_PATH)/copyright/copy_right.sh $(target_path) $(TARGET_BRANCH) $(VAL_PATH)" - # displayName: 'copyright code scan' + - stage: CopyRight + displayName: CopyRight Code Scan + dependsOn: [] + jobs: + - job: CopyRight + displayName: CopyRight + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + echo y | docker system prune + displayName: "Clean workspace" + - checkout: self + displayName: "Checkout out Repo" + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: "Clean Docker" + + - task: Bash@3 + inputs: + targetType: "inline" + script: | + docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/copy_right.sh" + docker cp $(COPYRIGHT_CONTAINER_NAME):/copyright_issue_summary.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log + + - task: PublishPipelineArtifact@1 + inputs: + targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log + artifact: $(PYSPELLING_CONTAINER_NAME) + publishLocation: "pipeline" \ No newline at end of file From ffab2980e91d1678a9c0082880197b3024451e61 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 16:24:19 +0800 Subject: [PATCH 191/271] test --- .azure-pipelines/code-scan.yml | 250 +++++++++--------- .../scripts/codeScan/copyright/copy_right.sh | 1 - 2 files changed, 125 insertions(+), 126 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index ae77eb8a2f2..2d0b6f02d28 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -20,131 +20,131 @@ variables: CURRENT_PATH: $(Build.SourcesDirectory) stages: - - stage: BanditCodeScan - displayName: Bandit Code Scan - dependsOn: [] - jobs: - - job: Bandit - displayName: Bandit - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - echo y | docker system prune - displayName: "Clean workspace" - - checkout: self - displayName: "Checkout out Repo" - - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: "Clean Docker" - - - task: Bash@3 - inputs: - targetType: "inline" - script: | - docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh $(TARGET_PATH)" - docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - - - task: PublishPipelineArtifact@1 - inputs: - targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - artifact: $(BANDIT_CONTAINER_NAME) - publishLocation: "pipeline" - - - stage: PylintCodeScan - displayName: Pylint Code Scan - dependsOn: [] - jobs: - - job: Pylint - displayName: Pylint - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - echo y | docker system prune - displayName: "Clean workspace" - - checkout: self - displayName: "Checkout out Repo" - - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: "Clean Docker" - - - task: Bash@3 - inputs: - targetType: "inline" - script: | - docker run --disable-content-trust --privileged --name=$(PYLINT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYLINT_CONTAINER_NAME)/pylint.sh $(TARGET_PATH)" - docker cp $(PYLINT_CONTAINER_NAME):/lpot-pylint.json $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json - - - task: PublishPipelineArtifact@1 - inputs: - targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json - artifact: $(PYLINT_CONTAINER_NAME) - publishLocation: "pipeline" - - - stage: PyspellingCodeScan - displayName: Pyspelling Code Scan - dependsOn: [] - jobs: - - job: Pyspelling - displayName: Pyspelling - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - echo y | docker system prune - displayName: "Clean workspace" - - checkout: self - displayName: "Checkout out Repo" - - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: "Clean Docker" - - - task: Bash@3 - inputs: - targetType: "inline" - script: | - docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/pyspelling.sh $(TARGET_PATH)/$(CODE_SCAN_PATH)" - docker cp $(PYSPELLING_CONTAINER_NAME):/lpot_pyspelling.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log - - - task: PublishPipelineArtifact@1 - inputs: - targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log - artifact: $(PYSPELLING_CONTAINER_NAME) - publishLocation: "pipeline" + # - stage: BanditCodeScan + # displayName: Bandit Code Scan + # dependsOn: [] + # jobs: + # - job: Bandit + # displayName: Bandit + # steps: + # - script: | + # echo ${BUILD_SOURCESDIRECTORY} + # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # echo y | docker system prune + # displayName: "Clean workspace" + # - checkout: self + # displayName: "Checkout out Repo" + # - script: | + # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + # fi + # docker images | grep -i ${IMAGE_NAME} + # if [[ $? -ne 0 ]]; then + # echo "NO Such Image ${IMAGE_NAME}" + # exit 1 + # fi + # displayName: "Build Devel Images" + # - script: | + # docker stop $(docker ps -aq) + # docker rm -vf $(docker ps -aq) || true + # displayName: "Clean Docker" + + # - task: Bash@3 + # inputs: + # targetType: "inline" + # script: | + # docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh $(TARGET_PATH)" + # docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + + # - task: PublishPipelineArtifact@1 + # inputs: + # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + # artifact: $(BANDIT_CONTAINER_NAME) + # publishLocation: "pipeline" + + # - stage: PylintCodeScan + # displayName: Pylint Code Scan + # dependsOn: [] + # jobs: + # - job: Pylint + # displayName: Pylint + # steps: + # - script: | + # echo ${BUILD_SOURCESDIRECTORY} + # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # echo y | docker system prune + # displayName: "Clean workspace" + # - checkout: self + # displayName: "Checkout out Repo" + # - script: | + # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + # fi + # docker images | grep -i ${IMAGE_NAME} + # if [[ $? -ne 0 ]]; then + # echo "NO Such Image ${IMAGE_NAME}" + # exit 1 + # fi + # displayName: "Build Devel Images" + # - script: | + # docker stop $(docker ps -aq) + # docker rm -vf $(docker ps -aq) || true + # displayName: "Clean Docker" + + # - task: Bash@3 + # inputs: + # targetType: "inline" + # script: | + # docker run --disable-content-trust --privileged --name=$(PYLINT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYLINT_CONTAINER_NAME)/pylint.sh $(TARGET_PATH)" + # docker cp $(PYLINT_CONTAINER_NAME):/lpot-pylint.json $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json + + # - task: PublishPipelineArtifact@1 + # inputs: + # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json + # artifact: $(PYLINT_CONTAINER_NAME) + # publishLocation: "pipeline" + + # - stage: PyspellingCodeScan + # displayName: Pyspelling Code Scan + # dependsOn: [] + # jobs: + # - job: Pyspelling + # displayName: Pyspelling + # steps: + # - script: | + # echo ${BUILD_SOURCESDIRECTORY} + # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # echo y | docker system prune + # displayName: "Clean workspace" + # - checkout: self + # displayName: "Checkout out Repo" + # - script: | + # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + # fi + # docker images | grep -i ${IMAGE_NAME} + # if [[ $? -ne 0 ]]; then + # echo "NO Such Image ${IMAGE_NAME}" + # exit 1 + # fi + # displayName: "Build Devel Images" + # - script: | + # docker stop $(docker ps -aq) + # docker rm -vf $(docker ps -aq) || true + # displayName: "Clean Docker" + + # - task: Bash@3 + # inputs: + # targetType: "inline" + # script: | + # docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/pyspelling.sh $(TARGET_PATH)/$(CODE_SCAN_PATH)" + # docker cp $(PYSPELLING_CONTAINER_NAME):/lpot_pyspelling.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log + + # - task: PublishPipelineArtifact@1 + # inputs: + # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log + # artifact: $(PYSPELLING_CONTAINER_NAME) + # publishLocation: "pipeline" - stage: CopyRight displayName: CopyRight Code Scan diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index 41344beadb9..bbfbec73987 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -1,7 +1,6 @@ # $1: $(target_path) # $2: $(TARGET_BRANCH) - $(System.PullRequest.TargetBranch) # $3: $(VAL_PATH) - supported_extensions=(py, sh, yaml) From 4b78d1be056243b19ad96001dd73abbf0c35be50 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 16:25:19 +0800 Subject: [PATCH 192/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 2d0b6f02d28..0607e3dd2c4 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -179,7 +179,7 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/copy_right.sh" + docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh" docker cp $(COPYRIGHT_CONTAINER_NAME):/copyright_issue_summary.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log - task: PublishPipelineArtifact@1 From 79a116e7fe5a276c02cab9c0bf7bc7bd308cd15a Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 16:27:09 +0800 Subject: [PATCH 193/271] test --- .azure-pipelines/code-scan.yml | 2 +- .azure-pipelines/scripts/codeScan/copyright/copy_right.sh | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 0607e3dd2c4..951f8a87265 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -179,7 +179,7 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh" + docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh $(System.PullRequest.TargetBranch)" docker cp $(COPYRIGHT_CONTAINER_NAME):/copyright_issue_summary.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log - task: PublishPipelineArtifact@1 diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index bbfbec73987..183a11b9eb8 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -3,6 +3,10 @@ # $3: $(VAL_PATH) supported_extensions=(py, sh, yaml) + + echo "-----------------------" + $1 + echo "-----------------------" set -xe git config --global --add safe.directory /neural_compressor From 590caa4204f700dff2117b3eb455c4437856c85e Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 16:29:15 +0800 Subject: [PATCH 194/271] test --- .azure-pipelines/code-scan.yml | 2 +- .azure-pipelines/scripts/codeScan/copyright/copy_right.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 951f8a87265..bb8d4c64a2f 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -179,7 +179,7 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh $(System.PullRequest.TargetBranch)" + docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh $(TARGET_BRANCH)" docker cp $(COPYRIGHT_CONTAINER_NAME):/copyright_issue_summary.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log - task: PublishPipelineArtifact@1 diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index 183a11b9eb8..ed69d5e0b21 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -5,7 +5,7 @@ supported_extensions=(py, sh, yaml) echo "-----------------------" - $1 + echo $1 echo "-----------------------" set -xe From 412a86ffd86bd6440d4fdf5510734e4c667d24fe Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 16:44:41 +0800 Subject: [PATCH 195/271] test --- .azure-pipelines/code-scan.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index bb8d4c64a2f..fda2991cfb9 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -179,7 +179,8 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh $(TARGET_BRANCH)" + $(TARGET_BRANCH) + docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh " docker cp $(COPYRIGHT_CONTAINER_NAME):/copyright_issue_summary.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log - task: PublishPipelineArtifact@1 From 9a176fe391033eeb5ac9d19ee5a49a3903d2ec78 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 16:57:47 +0800 Subject: [PATCH 196/271] test --- .azure-pipelines/code-scan.yml | 59 ++++++++++--------- .../scripts/codeScan/copyright/copy_right.sh | 4 -- 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index fda2991cfb9..b3731919cd0 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -1,6 +1,7 @@ trigger: - code-scan -pr: none +pr: + - master pool: suyue-test variables: @@ -20,34 +21,34 @@ variables: CURRENT_PATH: $(Build.SourcesDirectory) stages: - # - stage: BanditCodeScan - # displayName: Bandit Code Scan - # dependsOn: [] - # jobs: - # - job: Bandit - # displayName: Bandit - # steps: - # - script: | - # echo ${BUILD_SOURCESDIRECTORY} - # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # echo y | docker system prune - # displayName: "Clean workspace" - # - checkout: self - # displayName: "Checkout out Repo" - # - script: | - # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - # fi - # docker images | grep -i ${IMAGE_NAME} - # if [[ $? -ne 0 ]]; then - # echo "NO Such Image ${IMAGE_NAME}" - # exit 1 - # fi - # displayName: "Build Devel Images" - # - script: | - # docker stop $(docker ps -aq) - # docker rm -vf $(docker ps -aq) || true - # displayName: "Clean Docker" + - stage: BanditCodeScan + displayName: Bandit Code Scan + dependsOn: [] + jobs: + - job: Bandit + displayName: Bandit + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + echo y | docker system prune + displayName: "Clean workspace" + - checkout: self + displayName: "Checkout out Repo" + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: "Clean Docker" # - task: Bash@3 # inputs: diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index ed69d5e0b21..bbfbec73987 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -3,10 +3,6 @@ # $3: $(VAL_PATH) supported_extensions=(py, sh, yaml) - - echo "-----------------------" - echo $1 - echo "-----------------------" set -xe git config --global --add safe.directory /neural_compressor From 7bf4c3669ca2bf54e2a9f1276ce2f960aa35ed4d Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 16:59:29 +0800 Subject: [PATCH 197/271] test --- .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index f29b5eaebb5..aeb6c20857b 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -4,7 +4,7 @@ echo "--------------------" $1 echo "--------------------" -python -m bandit -r -lll -iii $1 > /lpot-bandit.log +python -m bandit -r -lll -iii $1/neural_compressor > /lpot-bandit.log exit_code=$? if [ ${exit_code} -ne 0 ] ; then From 718df039b7c228fc17f7f629fbae89ad6d61edce Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 17:06:25 +0800 Subject: [PATCH 198/271] test --- .azure-pipelines/code-scan.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index b3731919cd0..02e2d1f84eb 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -50,18 +50,18 @@ stages: docker rm -vf $(docker ps -aq) || true displayName: "Clean Docker" - # - task: Bash@3 - # inputs: - # targetType: "inline" - # script: | - # docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh $(TARGET_PATH)" - # docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + - task: Bash@3 + inputs: + targetType: "inline" + script: | + docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh $(TARGET_PATH)" + docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - # - task: PublishPipelineArtifact@1 - # inputs: - # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - # artifact: $(BANDIT_CONTAINER_NAME) - # publishLocation: "pipeline" + - task: PublishPipelineArtifact@1 + inputs: + targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + artifact: $(BANDIT_CONTAINER_NAME) + publishLocation: "pipeline" # - stage: PylintCodeScan # displayName: Pylint Code Scan From 5145e8eaa52eff4ed54a92e38025e6b9ad96d09c Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 17:12:17 +0800 Subject: [PATCH 199/271] test --- .azure-pipelines/code-scan.yml | 80 +++++++++++++++++----------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 02e2d1f84eb..6ee87afc7eb 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -21,47 +21,47 @@ variables: CURRENT_PATH: $(Build.SourcesDirectory) stages: - - stage: BanditCodeScan - displayName: Bandit Code Scan - dependsOn: [] - jobs: - - job: Bandit - displayName: Bandit - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - echo y | docker system prune - displayName: "Clean workspace" - - checkout: self - displayName: "Checkout out Repo" - - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: "Clean Docker" + # - stage: BanditCodeScan + # displayName: Bandit Code Scan + # dependsOn: [] + # jobs: + # - job: Bandit + # displayName: Bandit + # steps: + # - script: | + # echo ${BUILD_SOURCESDIRECTORY} + # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # echo y | docker system prune + # displayName: "Clean workspace" + # - checkout: self + # displayName: "Checkout out Repo" + # - script: | + # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + # fi + # docker images | grep -i ${IMAGE_NAME} + # if [[ $? -ne 0 ]]; then + # echo "NO Such Image ${IMAGE_NAME}" + # exit 1 + # fi + # displayName: "Build Devel Images" + # - script: | + # docker stop $(docker ps -aq) + # docker rm -vf $(docker ps -aq) || true + # displayName: "Clean Docker" - - task: Bash@3 - inputs: - targetType: "inline" - script: | - docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh $(TARGET_PATH)" - docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + # - task: Bash@3 + # inputs: + # targetType: "inline" + # script: | + # docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh $(TARGET_PATH)" + # docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - - task: PublishPipelineArtifact@1 - inputs: - targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - artifact: $(BANDIT_CONTAINER_NAME) - publishLocation: "pipeline" + # - task: PublishPipelineArtifact@1 + # inputs: + # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + # artifact: $(BANDIT_CONTAINER_NAME) + # publishLocation: "pipeline" # - stage: PylintCodeScan # displayName: Pylint Code Scan @@ -180,7 +180,7 @@ stages: inputs: targetType: "inline" script: | - $(TARGET_BRANCH) + echo $(TARGET_BRANCH) docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh " docker cp $(COPYRIGHT_CONTAINER_NAME):/copyright_issue_summary.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log From b17c512ee406075e49f93a9cd1993f159562f200 Mon Sep 17 00:00:00 2001 From: WenjiaoYue <108783334+WenjiaoYue@users.noreply.github.com> Date: Thu, 11 Aug 2022 17:16:18 +0800 Subject: [PATCH 200/271] Update code-scan.yml for Azure Pipelines --- .azure-pipelines/code-scan.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 6ee87afc7eb..b59788086cc 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -181,6 +181,8 @@ stages: targetType: "inline" script: | echo $(TARGET_BRANCH) + echo $(System.PullRequest.TargetBranch) + echo ${SYSTEM_PULLREQUEST_TARGETBRANCH} docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh " docker cp $(COPYRIGHT_CONTAINER_NAME):/copyright_issue_summary.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log From d3eda070767fef9abd90f64a74a49a177b57a7ac Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 17:18:49 +0800 Subject: [PATCH 201/271] test --- .azure-pipelines/code-scan.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index b59788086cc..ab20d7c600a 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -180,9 +180,9 @@ stages: inputs: targetType: "inline" script: | - echo $(TARGET_BRANCH) - echo $(System.PullRequest.TargetBranch) - echo ${SYSTEM_PULLREQUEST_TARGETBRANCH} + echo "$(TARGET_BRANCH)"" + echo "$(System.PullRequest.TargetBranch)"" + echo "${SYSTEM_PULLREQUEST_TARGETBRANCH}" docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh " docker cp $(COPYRIGHT_CONTAINER_NAME):/copyright_issue_summary.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log From 65d121dae0ed108ffcf6de99be23155b91bfcbe5 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 17:19:02 +0800 Subject: [PATCH 202/271] test --- .azure-pipelines/code-scan.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index ab20d7c600a..c84f277c848 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -180,8 +180,8 @@ stages: inputs: targetType: "inline" script: | - echo "$(TARGET_BRANCH)"" - echo "$(System.PullRequest.TargetBranch)"" + echo "$(TARGET_BRANCH)" + echo "$(System.PullRequest.TargetBranch)" echo "${SYSTEM_PULLREQUEST_TARGETBRANCH}" docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh " docker cp $(COPYRIGHT_CONTAINER_NAME):/copyright_issue_summary.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log From e0a5a8b9adac1909257f8357560fa2680f661749 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 17:21:25 +0800 Subject: [PATCH 203/271] test --- .azure-pipelines/code-scan.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index c84f277c848..69f796fa4b7 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -151,6 +151,12 @@ stages: displayName: CopyRight Code Scan dependsOn: [] jobs: + - job: pr + steps: + - script: | + echo "$(TARGET_BRANCH)" + echo "$(System.PullRequest.TargetBranch)" + echo "${SYSTEM_PULLREQUEST_TARGETBRANCH}" - job: CopyRight displayName: CopyRight steps: @@ -180,9 +186,6 @@ stages: inputs: targetType: "inline" script: | - echo "$(TARGET_BRANCH)" - echo "$(System.PullRequest.TargetBranch)" - echo "${SYSTEM_PULLREQUEST_TARGETBRANCH}" docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh " docker cp $(COPYRIGHT_CONTAINER_NAME):/copyright_issue_summary.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log From f0791bedc9d0ba4f7db03926b94716b56692d9e8 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 17:27:19 +0800 Subject: [PATCH 204/271] test --- .azure-pipelines/code-scan.yml | 9 +++------ .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 69f796fa4b7..c84f277c848 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -151,12 +151,6 @@ stages: displayName: CopyRight Code Scan dependsOn: [] jobs: - - job: pr - steps: - - script: | - echo "$(TARGET_BRANCH)" - echo "$(System.PullRequest.TargetBranch)" - echo "${SYSTEM_PULLREQUEST_TARGETBRANCH}" - job: CopyRight displayName: CopyRight steps: @@ -186,6 +180,9 @@ stages: inputs: targetType: "inline" script: | + echo "$(TARGET_BRANCH)" + echo "$(System.PullRequest.TargetBranch)" + echo "${SYSTEM_PULLREQUEST_TARGETBRANCH}" docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh " docker cp $(COPYRIGHT_CONTAINER_NAME):/copyright_issue_summary.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index aeb6c20857b..78f9ec1ce01 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -4,7 +4,7 @@ echo "--------------------" $1 echo "--------------------" -python -m bandit -r -lll -iii $1/neural_compressor > /lpot-bandit.log +python -m bandit -r -lll -iii $1/neural_compressor #> /lpot-bandit.log exit_code=$? if [ ${exit_code} -ne 0 ] ; then From 39d864baf40f05fd26d3fccfcc6858cb4e8d872b Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 17:29:22 +0800 Subject: [PATCH 205/271] test --- .azure-pipelines/code-scan.yml | 78 +++++++++++++++++----------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index c84f277c848..a0dcbaad1d8 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -21,47 +21,47 @@ variables: CURRENT_PATH: $(Build.SourcesDirectory) stages: - # - stage: BanditCodeScan - # displayName: Bandit Code Scan - # dependsOn: [] - # jobs: - # - job: Bandit - # displayName: Bandit - # steps: - # - script: | - # echo ${BUILD_SOURCESDIRECTORY} - # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # echo y | docker system prune - # displayName: "Clean workspace" - # - checkout: self - # displayName: "Checkout out Repo" - # - script: | - # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - # fi - # docker images | grep -i ${IMAGE_NAME} - # if [[ $? -ne 0 ]]; then - # echo "NO Such Image ${IMAGE_NAME}" - # exit 1 - # fi - # displayName: "Build Devel Images" - # - script: | - # docker stop $(docker ps -aq) - # docker rm -vf $(docker ps -aq) || true - # displayName: "Clean Docker" + - stage: BanditCodeScan + displayName: Bandit Code Scan + dependsOn: [] + jobs: + - job: Bandit + displayName: Bandit + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + echo y | docker system prune + displayName: "Clean workspace" + - checkout: self + displayName: "Checkout out Repo" + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: "Clean Docker" - # - task: Bash@3 - # inputs: - # targetType: "inline" - # script: | - # docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh $(TARGET_PATH)" - # docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + - task: Bash@3 + inputs: + targetType: "inline" + script: | + docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh $(TARGET_PATH)" + docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - # - task: PublishPipelineArtifact@1 - # inputs: - # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - # artifact: $(BANDIT_CONTAINER_NAME) - # publishLocation: "pipeline" + - task: PublishPipelineArtifact@1 + inputs: + targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + artifact: $(BANDIT_CONTAINER_NAME) + publishLocation: "pipeline" # - stage: PylintCodeScan # displayName: Pylint Code Scan From 25d90a6065efd3b028fc2f764cc7c46ebfd05e31 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 17:41:35 +0800 Subject: [PATCH 206/271] test --- .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index 78f9ec1ce01..12d5614ff68 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -4,10 +4,11 @@ echo "--------------------" $1 echo "--------------------" -python -m bandit -r -lll -iii $1/neural_compressor #> /lpot-bandit.log +python -m bandit -r -lll -iii $1/neural_compressor > /lpot-bandit.log + exit_code=$? -if [ ${exit_code} -ne 0 ] ; then +if [ ${exit_code} -e 0 ] ; then echo "Bandit exited with non-zero exit code."; exit 1 fi exit 0 \ No newline at end of file From a4702924fbe327bc4f258f3221628a46b7542f05 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 17:44:32 +0800 Subject: [PATCH 207/271] test --- .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index 12d5614ff68..b67fa590565 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -6,9 +6,9 @@ echo "--------------------" python -m bandit -r -lll -iii $1/neural_compressor > /lpot-bandit.log - +exit 1 exit_code=$? -if [ ${exit_code} -e 0 ] ; then +if [ ${exit_code} -ne 0 ] ; then echo "Bandit exited with non-zero exit code."; exit 1 fi exit 0 \ No newline at end of file From 7043b982b12af04f2ff8b0c106319d996f136f5c Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 18:51:14 +0800 Subject: [PATCH 208/271] test --- .azure-pipelines/code-scan.yml | 10 +++++++--- .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 4 ---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index a0dcbaad1d8..27d8c363ff1 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -63,6 +63,7 @@ stages: artifact: $(BANDIT_CONTAINER_NAME) publishLocation: "pipeline" + # - stage: PylintCodeScan # displayName: Pylint Code Scan # dependsOn: [] @@ -180,9 +181,12 @@ stages: inputs: targetType: "inline" script: | - echo "$(TARGET_BRANCH)" - echo "$(System.PullRequest.TargetBranch)" - echo "${SYSTEM_PULLREQUEST_TARGETBRANCH}" + echo ${BUILD_SOURCESDIRECTORY} + echo $(Build.SourcesDirectory) + echo $(CURRENT_PATH) + echo $(TARGET_BRANCH) + echo $(System.PullRequest.TargetBranch) + echo ${SYSTEM_PULLREQUEST_TARGETBRANCH} docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh " docker cp $(COPYRIGHT_CONTAINER_NAME):/copyright_issue_summary.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index b67fa590565..a3788248cf2 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -1,12 +1,8 @@ pip install bandit -echo "--------------------" -$1 -echo "--------------------" python -m bandit -r -lll -iii $1/neural_compressor > /lpot-bandit.log -exit 1 exit_code=$? if [ ${exit_code} -ne 0 ] ; then echo "Bandit exited with non-zero exit code."; exit 1 From e886f5a3c2d18e38aeb0804c2e2741e318998b68 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 20:34:26 +0800 Subject: [PATCH 209/271] test --- .azure-pipelines/code-scan.yml | 101 ++++++++++++++++++--------------- 1 file changed, 55 insertions(+), 46 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 27d8c363ff1..8c11ca6fa7d 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -21,49 +21,49 @@ variables: CURRENT_PATH: $(Build.SourcesDirectory) stages: - - stage: BanditCodeScan - displayName: Bandit Code Scan - dependsOn: [] - jobs: - - job: Bandit - displayName: Bandit - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - echo y | docker system prune - displayName: "Clean workspace" - - checkout: self - displayName: "Checkout out Repo" - - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: "Clean Docker" - - - task: Bash@3 - inputs: - targetType: "inline" - script: | - docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh $(TARGET_PATH)" - docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + # - stage: BanditCodeScan + # displayName: Bandit Code Scan + # dependsOn: [] + # jobs: + # - job: Bandit + # displayName: Bandit + # steps: + # - script: | + # echo ${BUILD_SOURCESDIRECTORY} + # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # echo y | docker system prune + # displayName: "Clean workspace" + # - checkout: self + # displayName: "Checkout out Repo" + # - script: | + # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + # fi + # docker images | grep -i ${IMAGE_NAME} + # if [[ $? -ne 0 ]]; then + # echo "NO Such Image ${IMAGE_NAME}" + # exit 1 + # fi + # displayName: "Build Devel Images" + # - script: | + # docker stop $(docker ps -aq) + # docker rm -vf $(docker ps -aq) || true + # displayName: "Clean Docker" - - task: PublishPipelineArtifact@1 - inputs: - targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - artifact: $(BANDIT_CONTAINER_NAME) - publishLocation: "pipeline" + # - task: Bash@3 + # inputs: + # targetType: "inline" + # script: | + # docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh $(TARGET_PATH)" + # docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + # - task: PublishPipelineArtifact@1 + # inputs: + # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + # artifact: $(BANDIT_CONTAINER_NAME) + # publishLocation: "pipeline" + # - stage: PylintCodeScan # displayName: Pylint Code Scan # dependsOn: [] @@ -156,6 +156,9 @@ stages: displayName: CopyRight steps: - script: | + echo "--------Clean workspace-----------" + git show-ref -s remotes/origin/master + echo "-------------------------" echo ${BUILD_SOURCESDIRECTORY} sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true echo y | docker system prune @@ -163,6 +166,10 @@ stages: - checkout: self displayName: "Checkout out Repo" - script: | + echo "--------After Checkout-----------" + git show-ref -s remotes/origin/master + echo "-------------------------" + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi @@ -173,6 +180,10 @@ stages: fi displayName: "Build Devel Images" - script: | + echo "--------After Build-----------" + git show-ref -s remotes/origin/master + echo "-------------------------" + docker stop $(docker ps -aq) docker rm -vf $(docker ps -aq) || true displayName: "Clean Docker" @@ -181,12 +192,10 @@ stages: inputs: targetType: "inline" script: | - echo ${BUILD_SOURCESDIRECTORY} - echo $(Build.SourcesDirectory) - echo $(CURRENT_PATH) - echo $(TARGET_BRANCH) - echo $(System.PullRequest.TargetBranch) - echo ${SYSTEM_PULLREQUEST_TARGETBRANCH} + echo "$(TARGET_BRANCH)" + echo "$(System.PullRequest.TargetBranch)" + echo "${SYSTEM_PULLREQUEST_TARGETBRANCH}" + docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh " docker cp $(COPYRIGHT_CONTAINER_NAME):/copyright_issue_summary.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log From d880175e71378d324f1d039251497fedb49739b2 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 21:07:18 +0800 Subject: [PATCH 210/271] test --- .azure-pipelines/code-scan.yml | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 8c11ca6fa7d..b4ff462eba6 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -156,9 +156,7 @@ stages: displayName: CopyRight steps: - script: | - echo "--------Clean workspace-----------" - git show-ref -s remotes/origin/master - echo "-------------------------" + echo ${BUILD_SOURCESDIRECTORY} sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true echo y | docker system prune @@ -166,10 +164,6 @@ stages: - checkout: self displayName: "Checkout out Repo" - script: | - echo "--------After Checkout-----------" - git show-ref -s remotes/origin/master - echo "-------------------------" - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi @@ -180,10 +174,6 @@ stages: fi displayName: "Build Devel Images" - script: | - echo "--------After Build-----------" - git show-ref -s remotes/origin/master - echo "-------------------------" - docker stop $(docker ps -aq) docker rm -vf $(docker ps -aq) || true displayName: "Clean Docker" @@ -192,13 +182,17 @@ stages: inputs: targetType: "inline" script: | - echo "$(TARGET_BRANCH)" - echo "$(System.PullRequest.TargetBranch)" - echo "${SYSTEM_PULLREQUEST_TARGETBRANCH}" + echo "--------BEFORE docker Run-----------" + git show-ref -s remotes/origin/master + echo "-------------------------" docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh " docker cp $(COPYRIGHT_CONTAINER_NAME):/copyright_issue_summary.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log + echo "--------after docker Run-----------" + git show-ref -s remotes/origin/master + echo "-------------------------" + - task: PublishPipelineArtifact@1 inputs: targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log From a8a1e6b283db6eec96882da3135ca7866a647a03 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 21:09:01 +0800 Subject: [PATCH 211/271] test --- .azure-pipelines/code-scan.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index b4ff462eba6..f2d6e80d43a 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -186,6 +186,9 @@ stages: git show-ref -s remotes/origin/master echo "-------------------------" + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor + echo "-------------------------" + docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh " docker cp $(COPYRIGHT_CONTAINER_NAME):/copyright_issue_summary.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log From 7e68f214d19bc795b3503e6c5ab7ed040a23cab3 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 21:26:46 +0800 Subject: [PATCH 212/271] test --- .azure-pipelines/code-scan.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index f2d6e80d43a..050a4d84e8f 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -185,8 +185,13 @@ stages: echo "--------BEFORE docker Run-----------" git show-ref -s remotes/origin/master echo "-------------------------" + + pwd git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor + + echo "----------------------------" + $(System.PullRequest.TargetBranch) echo "-------------------------" docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh " From 634aaa8ee8556f06e4328b335fb6b099fcf82be9 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 21:30:02 +0800 Subject: [PATCH 213/271] test --- .azure-pipelines/code-scan.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 050a4d84e8f..f218b53430b 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -184,15 +184,13 @@ stages: script: | echo "--------BEFORE docker Run-----------" git show-ref -s remotes/origin/master - echo "-------------------------" - - pwd + echo "-----------11--------------" git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor - echo "----------------------------" + echo "-----------1-----------------" $(System.PullRequest.TargetBranch) - echo "-------------------------" + echo "-----------1--------------" docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh " docker cp $(COPYRIGHT_CONTAINER_NAME):/copyright_issue_summary.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log From 048bd7f9ad6c1c712934e6ecb82bba0e1aee7c44 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 21:34:08 +0800 Subject: [PATCH 214/271] test --- .azure-pipelines/code-scan.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index f218b53430b..49f4dd84ac7 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -156,7 +156,9 @@ stages: displayName: CopyRight steps: - script: | - + echo "--------Clean workspace-----------" + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor + echo "-----------1-----------------" echo ${BUILD_SOURCESDIRECTORY} sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true echo y | docker system prune @@ -164,6 +166,9 @@ stages: - checkout: self displayName: "Checkout out Repo" - script: | + echo "--------Build Devel Images-----------" + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor + echo "-----------1-----------------" if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi @@ -174,6 +179,9 @@ stages: fi displayName: "Build Devel Images" - script: | + echo "--------Clean Docker-----------" + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor + echo "-----------1-----------------" docker stop $(docker ps -aq) docker rm -vf $(docker ps -aq) || true displayName: "Clean Docker" @@ -183,11 +191,7 @@ stages: targetType: "inline" script: | echo "--------BEFORE docker Run-----------" - git show-ref -s remotes/origin/master - echo "-----------11--------------" - - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor - + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor echo "-----------1-----------------" $(System.PullRequest.TargetBranch) echo "-----------1--------------" From b79757834bfb161f661ca4ce628d50525f4ffec7 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 21:41:34 +0800 Subject: [PATCH 215/271] test --- .azure-pipelines/code-scan.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 49f4dd84ac7..f908f7845f1 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -155,8 +155,9 @@ stages: - job: CopyRight displayName: CopyRight steps: - - script: | + - script: | echo "--------Clean workspace-----------" + git show-ref -s remotes/origin/master git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor echo "-----------1-----------------" echo ${BUILD_SOURCESDIRECTORY} From 16077c335e5ec2de320274738a7a884fb6115468 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 21:44:26 +0800 Subject: [PATCH 216/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index f908f7845f1..6cd1e7b34bf 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -158,7 +158,7 @@ stages: - script: | echo "--------Clean workspace-----------" git show-ref -s remotes/origin/master - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) ./neural_compressor echo "-----------1-----------------" echo ${BUILD_SOURCESDIRECTORY} sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true From 7013b49b61e1430221758cee4a3c6759d60e6bbb Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 21:55:59 +0800 Subject: [PATCH 217/271] test --- .azure-pipelines/code-scan.yml | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 6cd1e7b34bf..1a5ab1fb661 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -156,10 +156,6 @@ stages: displayName: CopyRight steps: - script: | - echo "--------Clean workspace-----------" - git show-ref -s remotes/origin/master - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) ./neural_compressor - echo "-----------1-----------------" echo ${BUILD_SOURCESDIRECTORY} sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true echo y | docker system prune @@ -167,9 +163,6 @@ stages: - checkout: self displayName: "Checkout out Repo" - script: | - echo "--------Build Devel Images-----------" - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor - echo "-----------1-----------------" if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . fi @@ -180,9 +173,6 @@ stages: fi displayName: "Build Devel Images" - script: | - echo "--------Clean Docker-----------" - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor - echo "-----------1-----------------" docker stop $(docker ps -aq) docker rm -vf $(docker ps -aq) || true displayName: "Clean Docker" @@ -192,18 +182,14 @@ stages: targetType: "inline" script: | echo "--------BEFORE docker Run-----------" + git show-ref -s remotes/origin/master git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor - echo "-----------1-----------------" + echo "-----------pr-----------------" $(System.PullRequest.TargetBranch) - echo "-----------1--------------" + echo "-----------pr--------------" docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh " docker cp $(COPYRIGHT_CONTAINER_NAME):/copyright_issue_summary.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log - - echo "--------after docker Run-----------" - git show-ref -s remotes/origin/master - echo "-------------------------" - - task: PublishPipelineArtifact@1 inputs: targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log From a00566f059fa1e948ffa4f27f026b9f48f0a39b0 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 22:00:39 +0800 Subject: [PATCH 218/271] test --- .azure-pipelines/code-scan.yml | 2 +- .../scripts/codeScan/copyright/copy_right.sh | 52 +++++++++---------- 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 1a5ab1fb661..f0396af360f 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -183,7 +183,7 @@ stages: script: | echo "--------BEFORE docker Run-----------" git show-ref -s remotes/origin/master - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) ./neural_compressor echo "-----------pr-----------------" $(System.PullRequest.TargetBranch) echo "-----------pr--------------" diff --git a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh index bbfbec73987..6187b3ebeb0 100644 --- a/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh +++ b/.azure-pipelines/scripts/codeScan/copyright/copy_right.sh @@ -1,35 +1,31 @@ - # $1: $(target_path) - # $2: $(TARGET_BRANCH) - $(System.PullRequest.TargetBranch) - # $3: $(VAL_PATH) - supported_extensions=(py, sh, yaml) - - set -xe - git config --global --add safe.directory /neural_compressor - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor > /diff.log - # git --no-pager diff --name-only $(git show-ref -s remotes/origin$2) ./$1 > $3/copyright/diff.log +supported_extensions=(py, sh, yaml) + +set -xe +git config --global --add safe.directory /neural_compressor +git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /neural_compressor/neural_compressor > /diff.log +# git --no-pager diff --name-only $(git show-ref -s remotes/origin$2) ./$1 > $3/copyright/diff.log - files=$(cat /diff.log | awk '!a[$0]++') - # files=$(cat $3/copyright/diff.log | awk '!a[$0]++') +files=$(cat /diff.log | awk '!a[$0]++') - for file in ${files} +for file in ${files} - do - if [[ "${supported_extensions[@]}" =~ "${file##*.}" ]]; then - echo "Checking license in 1 ${file}" - if [ $(grep -E -c "Copyright \\(c\\) ([0-9]{4})(-[0-9]{4})? Intel Corporation" ${file}) = 0 ]; then - echo ${file} >> /copyright_issue_summary.log - cat /copyright_issue_summary.log - fi - else - echo "Skipping ${file}" +do + if [[ "${supported_extensions[@]}" =~ "${file##*.}" ]]; then + echo "Checking license in 1 ${file}" + if [ $(grep -E -c "Copyright \\(c\\) ([0-9]{4})(-[0-9]{4})? Intel Corporation" ${file}) = 0 ]; then + echo ${file} >> /copyright_issue_summary.log + cat /copyright_issue_summary.log fi - done + else + echo "Skipping ${file}" + fi +done - ls /copyright_issue_summary.log - exit_code=$? - if [ ${exit_code} -e 0 ] ; then - echo "------------------Check for wrong file list !!!!!!!!!!!!!!!!!!!!!!!"; exit 1 - fi - exit 0 \ No newline at end of file +ls /copyright_issue_summary.log +exit_code=$? +if [ ${exit_code} -e 0 ] ; then + echo "------------------Check for wrong file list !!!!!!!!!!!!!!!!!!!!!!!"; exit 1 +fi +exit 0 \ No newline at end of file From e3fbdcd7205f29d5fc9f687a44227b268e770964 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 22:03:22 +0800 Subject: [PATCH 219/271] test --- .azure-pipelines/code-scan.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index f0396af360f..7f0b2065278 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -183,7 +183,8 @@ stages: script: | echo "--------BEFORE docker Run-----------" git show-ref -s remotes/origin/master - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) ./neural_compressor + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /$(CURRENT_PATH)/neural_compressor + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /$(CURRENT_PATH)/neural_compressor/neural_compressor echo "-----------pr-----------------" $(System.PullRequest.TargetBranch) echo "-----------pr--------------" From cca691edf5558e2f9293c16a8d33e13f4b1efc73 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 22:05:11 +0800 Subject: [PATCH 220/271] test --- .azure-pipelines/code-scan.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 7f0b2065278..73c3bc550cf 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -183,8 +183,11 @@ stages: script: | echo "--------BEFORE docker Run-----------" git show-ref -s remotes/origin/master - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /$(CURRENT_PATH)/neural_compressor - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) /$(CURRENT_PATH)/neural_compressor/neural_compressor + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) $(CURRENT_PATH)/neural_compressor + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) $(CURRENT_PATH)/neural_compressor/neural_compressor + echo "--------neural_compressor Path-----------" + cd $(CURRENT_PATH)/neural_compressor + ls echo "-----------pr-----------------" $(System.PullRequest.TargetBranch) echo "-----------pr--------------" From 1449e9bb8828dd6920ae0e044b668095e421f9dd Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 22:08:34 +0800 Subject: [PATCH 221/271] test --- .azure-pipelines/code-scan.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 73c3bc550cf..d73d1bdb86c 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -186,6 +186,7 @@ stages: git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) $(CURRENT_PATH)/neural_compressor git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) $(CURRENT_PATH)/neural_compressor/neural_compressor echo "--------neural_compressor Path-----------" + echo $(CURRENT_PATH) cd $(CURRENT_PATH)/neural_compressor ls echo "-----------pr-----------------" From 0f84a6677c534d24865599190c1d3fc04123b9a7 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Thu, 11 Aug 2022 22:14:44 +0800 Subject: [PATCH 222/271] test --- .azure-pipelines/code-scan.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index d73d1bdb86c..10fe47d4639 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -184,7 +184,6 @@ stages: echo "--------BEFORE docker Run-----------" git show-ref -s remotes/origin/master git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) $(CURRENT_PATH)/neural_compressor - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) $(CURRENT_PATH)/neural_compressor/neural_compressor echo "--------neural_compressor Path-----------" echo $(CURRENT_PATH) cd $(CURRENT_PATH)/neural_compressor From 25dfade2f602fc2734fb9bc94c205e521789d065 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Thu, 11 Aug 2022 22:44:29 +0800 Subject: [PATCH 223/271] for test --- .azure-pipelines/code-scan.yml | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 10fe47d4639..33e3d4212c4 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -1,5 +1,4 @@ -trigger: - - code-scan +trigger: none pr: - master pool: suyue-test @@ -155,35 +154,14 @@ stages: - job: CopyRight displayName: CopyRight steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - echo y | docker system prune - displayName: "Clean workspace" - - checkout: self - displayName: "Checkout out Repo" - - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: "Clean Docker" - + - - task: Bash@3 inputs: targetType: "inline" script: | echo "--------BEFORE docker Run-----------" git show-ref -s remotes/origin/master - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) $(CURRENT_PATH)/neural_compressor + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) $CURRENT_PATH/neural_compressor echo "--------neural_compressor Path-----------" echo $(CURRENT_PATH) cd $(CURRENT_PATH)/neural_compressor From 6cef4bca0897f17d63b3a9783eb008169dade723 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Thu, 11 Aug 2022 22:48:01 +0800 Subject: [PATCH 224/271] fix --- .azure-pipelines/code-scan.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 33e3d4212c4..de29eb91783 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -154,7 +154,6 @@ stages: - job: CopyRight displayName: CopyRight steps: - - - task: Bash@3 inputs: targetType: "inline" From ecc62a5dee5c1f1af60ce92f7abcff1b38d19916 Mon Sep 17 00:00:00 2001 From: chensuyue Date: Thu, 11 Aug 2022 22:52:13 +0800 Subject: [PATCH 225/271] debug --- .azure-pipelines/code-scan.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index de29eb91783..1035d91a942 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -154,13 +154,19 @@ stages: - job: CopyRight displayName: CopyRight steps: + - script: | + echo "--------run with script-----------" + git show-ref -s remotes/origin/master + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) $(CURRENT_PATH)/neural_compressor + + - task: Bash@3 inputs: targetType: "inline" script: | echo "--------BEFORE docker Run-----------" git show-ref -s remotes/origin/master - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) $CURRENT_PATH/neural_compressor + git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) $(CURRENT_PATH)/neural_compressor echo "--------neural_compressor Path-----------" echo $(CURRENT_PATH) cd $(CURRENT_PATH)/neural_compressor From 9bd14f0a342c2205a1461215e2453027fe4cdb5d Mon Sep 17 00:00:00 2001 From: chensuyue Date: Thu, 11 Aug 2022 23:16:30 +0800 Subject: [PATCH 226/271] test --- .azure-pipelines/code-scan.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 1035d91a942..d840dfd0086 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -154,23 +154,17 @@ stages: - job: CopyRight displayName: CopyRight steps: - - script: | - echo "--------run with script-----------" - git show-ref -s remotes/origin/master - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) $(CURRENT_PATH)/neural_compressor - - - task: Bash@3 inputs: targetType: "inline" script: | echo "--------BEFORE docker Run-----------" git show-ref -s remotes/origin/master - git --no-pager diff --name-only --no-index $(git show-ref -s remotes/origin/master) $(CURRENT_PATH)/neural_compressor + git --no-pager diff --name-only $(git show-ref -s remotes/origin/master) $(CURRENT_PATH)/neural_compressor echo "--------neural_compressor Path-----------" echo $(CURRENT_PATH) - cd $(CURRENT_PATH)/neural_compressor - ls + cd $(CURRENT_PATH) + ll -a echo "-----------pr-----------------" $(System.PullRequest.TargetBranch) echo "-----------pr--------------" From 242a54e23f6e0608450d3b9972b90398ae7f1aee Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 09:40:25 +0800 Subject: [PATCH 227/271] test --- .azure-pipelines/code-scan.yml | 48 ++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index d840dfd0086..7a720da05c6 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -7,16 +7,15 @@ variables: IMAGE_NAME: "code-scan" IMAGE_TAG: "1.0" - TARGET_PATH: "/neural_compressor" - CODE_SCAN_PATH: ".azure-pipelines/scripts/codeScan" - CODE_SCAN_LOG_PATH: "scanLog" + # TARGET_PATH: "/neural_compressor" + CODE_SCAN_PATH: "/neural_compressor/.azure-pipelines/scripts/codeScan" + CODE_SCAN_LOG_PATH: "neural_compressor/.azure-pipelines/scripts/codeScan/scanLog" BANDIT_CONTAINER_NAME: "bandit" PYLINT_CONTAINER_NAME: "pylint" PYSPELLING_CONTAINER_NAME: "pyspelling" COPYRIGHT_CONTAINER_NAME: "copyright" - TARGET_BRANCH: $(System.PullRequest.TargetBranch) CURRENT_PATH: $(Build.SourcesDirectory) stages: @@ -158,21 +157,32 @@ stages: inputs: targetType: "inline" script: | - echo "--------BEFORE docker Run-----------" - git show-ref -s remotes/origin/master - git --no-pager diff --name-only $(git show-ref -s remotes/origin/master) $(CURRENT_PATH)/neural_compressor - echo "--------neural_compressor Path-----------" - echo $(CURRENT_PATH) - cd $(CURRENT_PATH) - ll -a - echo "-----------pr-----------------" - $(System.PullRequest.TargetBranch) - echo "-----------pr--------------" - - docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(COPYRIGHT_CONTAINER_NAME)/copy_right.sh " - docker cp $(COPYRIGHT_CONTAINER_NAME):/copyright_issue_summary.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log + git --no-pager diff --name-only $(git show-ref -s remotes/origin/$(System.PullRequest.TargetBranch)) $(CURRENT_PATH)/neural_compressor > $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log + files=$(cat $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log | awk '!a[$0]++') + + for file in ${files} + + do + if [[ "${supported_extensions[@]}" =~ "${file##*.}" ]]; then + echo "Checking license in 1 ${file}" + if [ $(grep -E -c "Copyright \\(c\\) ([0-9]{4})(-[0-9]{4})? Intel Corporation" ${file}) = 0 ]; then + echo ${file} >> $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log + fi + else + echo "Skipping ${file}" + fi + done + + + ls $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log + exit_code=$? + if [ ${exit_code} -e 0 ] ; then + echo "------------------Check for wrong file list !!!!!!!!!!!!!!!!!!!!!!!"; exit 1 + fi + exit 0 + - task: PublishPipelineArtifact@1 inputs: - targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log - artifact: $(PYSPELLING_CONTAINER_NAME) + targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log + artifact: $(COPYRIGHT_CONTAINER_NAME) publishLocation: "pipeline" \ No newline at end of file From e304eda0e97f8be8f6067dbe3c27ed239e8daefc Mon Sep 17 00:00:00 2001 From: WenjiaoYue <108783334+WenjiaoYue@users.noreply.github.com> Date: Fri, 12 Aug 2022 09:43:43 +0800 Subject: [PATCH 228/271] copyright test --- neural_compressor/objective.py | 1 - 1 file changed, 1 deletion(-) diff --git a/neural_compressor/objective.py b/neural_compressor/objective.py index b6e656ff0a9..a7561cbd02b 100644 --- a/neural_compressor/objective.py +++ b/neural_compressor/objective.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2021 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From a4efa3ece8bdbe02f1ac0955dedbd5840c835fd6 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 09:47:05 +0800 Subject: [PATCH 229/271] test --- .azure-pipelines/code-scan.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 7a720da05c6..91012c5ad6f 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -157,6 +157,13 @@ stages: inputs: targetType: "inline" script: | + set -ex + echo "---------------------------" + ehco $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH) + cd $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH) + ls + echo "---------------------------" + git --no-pager diff --name-only $(git show-ref -s remotes/origin/$(System.PullRequest.TargetBranch)) $(CURRENT_PATH)/neural_compressor > $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log files=$(cat $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log | awk '!a[$0]++') From 1c46a43fd69afcd5049a13cdeb8e69cbb4185579 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 09:48:21 +0800 Subject: [PATCH 230/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 91012c5ad6f..13358f0e9c2 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -159,7 +159,7 @@ stages: script: | set -ex echo "---------------------------" - ehco $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH) + echo $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH) cd $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH) ls echo "---------------------------" From fc7b05e525d02e3e136e90bd5d746e803d3470bd Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 09:49:25 +0800 Subject: [PATCH 231/271] test --- .azure-pipelines/code-scan.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 13358f0e9c2..685ac06cdd6 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -8,8 +8,8 @@ variables: IMAGE_TAG: "1.0" # TARGET_PATH: "/neural_compressor" - CODE_SCAN_PATH: "/neural_compressor/.azure-pipelines/scripts/codeScan" - CODE_SCAN_LOG_PATH: "neural_compressor/.azure-pipelines/scripts/codeScan/scanLog" + CODE_SCAN_PATH: ".azure-pipelines/scripts/codeScan" + CODE_SCAN_LOG_PATH: ".azure-pipelines/scripts/codeScan/scanLog" BANDIT_CONTAINER_NAME: "bandit" PYLINT_CONTAINER_NAME: "pylint" From 4b942552ab6a6d885d9111bfea1f547615513d27 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 09:51:54 +0800 Subject: [PATCH 232/271] test --- .azure-pipelines/code-scan.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 685ac06cdd6..480a0f88b45 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -164,6 +164,8 @@ stages: ls echo "---------------------------" + supported_extensions=(py, sh, yaml) + git --no-pager diff --name-only $(git show-ref -s remotes/origin/$(System.PullRequest.TargetBranch)) $(CURRENT_PATH)/neural_compressor > $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log files=$(cat $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log | awk '!a[$0]++') From 3a36f278d620dfcea915cf40fbf8fa60e4d403bb Mon Sep 17 00:00:00 2001 From: WenjiaoYue <108783334+WenjiaoYue@users.noreply.github.com> Date: Fri, 12 Aug 2022 09:53:23 +0800 Subject: [PATCH 233/271] Update code-scan.yml for Azure Pipelines --- .azure-pipelines/code-scan.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 480a0f88b45..97553b57958 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -158,19 +158,12 @@ stages: targetType: "inline" script: | set -ex - echo "---------------------------" - echo $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH) - cd $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH) - ls - echo "---------------------------" - supported_extensions=(py, sh, yaml) git --no-pager diff --name-only $(git show-ref -s remotes/origin/$(System.PullRequest.TargetBranch)) $(CURRENT_PATH)/neural_compressor > $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log files=$(cat $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log | awk '!a[$0]++') for file in ${files} - do if [[ "${supported_extensions[@]}" =~ "${file##*.}" ]]; then echo "Checking license in 1 ${file}" @@ -182,7 +175,6 @@ stages: fi done - ls $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log exit_code=$? if [ ${exit_code} -e 0 ] ; then From f51756f686e1694ac0dc0383a64e9dde45776ce8 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 09:58:29 +0800 Subject: [PATCH 234/271] test --- .azure-pipelines/code-scan.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 97553b57958..ce9fffebe16 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -176,8 +176,7 @@ stages: done ls $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log - exit_code=$? - if [ ${exit_code} -e 0 ] ; then + if [ $? -eq 0 ] ; then echo "------------------Check for wrong file list !!!!!!!!!!!!!!!!!!!!!!!"; exit 1 fi exit 0 From b8a68b76de272d0e5f17e2900b4598c3875f06fa Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 10:00:51 +0800 Subject: [PATCH 235/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index ce9fffebe16..cfa56e11718 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -1,4 +1,4 @@ -trigger: none +trigger: code-scan pr: - master pool: suyue-test From 864dcca7a1dfaec1634cfac16ccbf6affe71cc50 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 10:01:28 +0800 Subject: [PATCH 236/271] test --- .azure-pipelines/code-scan.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index cfa56e11718..15cb9d0406f 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -1,4 +1,5 @@ -trigger: code-scan +trigger: + - code-scan pr: - master pool: suyue-test From dccc7adcffbd3000129935d6421762710abb38d6 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 10:03:33 +0800 Subject: [PATCH 237/271] TEST --- .azure-pipelines/code-scan.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 15cb9d0406f..d8e7f43b742 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -176,14 +176,18 @@ stages: fi done - ls $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log - if [ $? -eq 0 ] ; then - echo "------------------Check for wrong file list !!!!!!!!!!!!!!!!!!!!!!!"; exit 1 - fi - exit 0 - - task: PublishPipelineArtifact@1 inputs: targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log artifact: $(COPYRIGHT_CONTAINER_NAME) - publishLocation: "pipeline" \ No newline at end of file + publishLocation: "pipeline" + + - task: Bash@3 + inputs: + targetType: "inline" + script: | + ls $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log + if [ $? -eq 0 ] ; then + echo "------------------Check for wrong file list !!!!!!!!!!!!!!!!!!!!!!!"; exit 1 + fi + exit 0 \ No newline at end of file From 7bb6ee76ce58e36092808c633feea412ae42c058 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 10:36:07 +0800 Subject: [PATCH 238/271] test --- .azure-pipelines/code-scan.yml | 89 ++++++++++--------- .../scripts/codeScan/bandit/bandit.sh | 9 +- 2 files changed, 54 insertions(+), 44 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index d8e7f43b742..899a403cb79 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -1,5 +1,4 @@ -trigger: - - code-scan +trigger: none pr: - master pool: suyue-test @@ -11,6 +10,8 @@ variables: # TARGET_PATH: "/neural_compressor" CODE_SCAN_PATH: ".azure-pipelines/scripts/codeScan" CODE_SCAN_LOG_PATH: ".azure-pipelines/scripts/codeScan/scanLog" + DOCKER_CODE_SCAN_PATH: "neural_compressor/.azure-pipelines/scripts/codeScan" + BANDIT_CONTAINER_NAME: "bandit" PYLINT_CONTAINER_NAME: "pylint" @@ -20,47 +21,51 @@ variables: CURRENT_PATH: $(Build.SourcesDirectory) stages: - # - stage: BanditCodeScan - # displayName: Bandit Code Scan - # dependsOn: [] - # jobs: - # - job: Bandit - # displayName: Bandit - # steps: - # - script: | - # echo ${BUILD_SOURCESDIRECTORY} - # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # echo y | docker system prune - # displayName: "Clean workspace" - # - checkout: self - # displayName: "Checkout out Repo" - # - script: | - # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - # fi - # docker images | grep -i ${IMAGE_NAME} - # if [[ $? -ne 0 ]]; then - # echo "NO Such Image ${IMAGE_NAME}" - # exit 1 - # fi - # displayName: "Build Devel Images" - # - script: | - # docker stop $(docker ps -aq) - # docker rm -vf $(docker ps -aq) || true - # displayName: "Clean Docker" - - # - task: Bash@3 - # inputs: - # targetType: "inline" - # script: | - # docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh $(TARGET_PATH)" - # docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + - stage: BanditCodeScan + displayName: Bandit Code Scan + dependsOn: [] + jobs: + - job: Bandit + displayName: Bandit + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + echo y | docker system prune + displayName: "Clean workspace" + - checkout: self + displayName: "Checkout out Repo" + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: "Clean Docker" - # - task: PublishPipelineArtifact@1 - # inputs: - # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - # artifact: $(BANDIT_CONTAINER_NAME) - # publishLocation: "pipeline" + - task: Bash@3 + inputs: + targetType: "inline" + script: | + docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash $(DOCKER_CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh + # docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + echo "---------$bandit_log_dir-------------" + echo $bandit_log_dir + echo "---------$(bandit_log_dir)-------------" + echo $(bandit_log_dir) + echo "----------------------" + - task: PublishPipelineArtifact@1 + inputs: + targetPath: $(CURRENT_PATH)/$bandit_log_dir/lpot-bandit.log + artifact: $(BANDIT_CONTAINER_NAME) + publishLocation: "pipeline" # - stage: PylintCodeScan diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index a3788248cf2..b52ded2b6a8 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -1,10 +1,15 @@ +set -ex +bandit_log_dir = "/neural-compressor/neural_compressor/.azure-pipelines/scripts/codeScan/scanLog" + pip install bandit -python -m bandit -r -lll -iii $1/neural_compressor > /lpot-bandit.log +python -m bandit -r -lll -iii /neural-compressor/neural_compressor > $bandit_log_dir/lpot-bandit.log exit_code=$? if [ ${exit_code} -ne 0 ] ; then echo "Bandit exited with non-zero exit code."; exit 1 fi -exit 0 \ No newline at end of file +exit 0 + +export bandit_log_dir \ No newline at end of file From fbb3faf5d29aa26b0cb03a9921d7094544abb6db Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 10:39:06 +0800 Subject: [PATCH 239/271] test --- .azure-pipelines/code-scan.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 899a403cb79..f2ed986be47 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -54,7 +54,7 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash $(DOCKER_CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh + docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /$(DOCKER_CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh # docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log echo "---------$bandit_log_dir-------------" echo $bandit_log_dir @@ -63,7 +63,7 @@ stages: echo "----------------------" - task: PublishPipelineArtifact@1 inputs: - targetPath: $(CURRENT_PATH)/$bandit_log_dir/lpot-bandit.log + targetPath: $(CURRENT_PATH)/$(DOCKER_CODE_SCAN_PATH)/lpot-bandit.log artifact: $(BANDIT_CONTAINER_NAME) publishLocation: "pipeline" From 08f685305d818bddcfabebb071dd7f9f829f4d3b Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 10:39:34 +0800 Subject: [PATCH 240/271] test --- .azure-pipelines/code-scan.yml | 84 +++++++++++++++++----------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index f2ed986be47..07b0bf896c9 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -152,47 +152,47 @@ stages: # artifact: $(PYSPELLING_CONTAINER_NAME) # publishLocation: "pipeline" - - stage: CopyRight - displayName: CopyRight Code Scan - dependsOn: [] - jobs: - - job: CopyRight - displayName: CopyRight - steps: - - task: Bash@3 - inputs: - targetType: "inline" - script: | - set -ex - supported_extensions=(py, sh, yaml) - - git --no-pager diff --name-only $(git show-ref -s remotes/origin/$(System.PullRequest.TargetBranch)) $(CURRENT_PATH)/neural_compressor > $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log - files=$(cat $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log | awk '!a[$0]++') - - for file in ${files} - do - if [[ "${supported_extensions[@]}" =~ "${file##*.}" ]]; then - echo "Checking license in 1 ${file}" - if [ $(grep -E -c "Copyright \\(c\\) ([0-9]{4})(-[0-9]{4})? Intel Corporation" ${file}) = 0 ]; then - echo ${file} >> $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log - fi - else - echo "Skipping ${file}" - fi - done + # - stage: CopyRight + # displayName: CopyRight Code Scan + # dependsOn: [] + # jobs: + # - job: CopyRight + # displayName: CopyRight + # steps: + # - task: Bash@3 + # inputs: + # targetType: "inline" + # script: | + # set -ex + # supported_extensions=(py, sh, yaml) + + # git --no-pager diff --name-only $(git show-ref -s remotes/origin/$(System.PullRequest.TargetBranch)) $(CURRENT_PATH)/neural_compressor > $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log + # files=$(cat $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log | awk '!a[$0]++') + + # for file in ${files} + # do + # if [[ "${supported_extensions[@]}" =~ "${file##*.}" ]]; then + # echo "Checking license in 1 ${file}" + # if [ $(grep -E -c "Copyright \\(c\\) ([0-9]{4})(-[0-9]{4})? Intel Corporation" ${file}) = 0 ]; then + # echo ${file} >> $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log + # fi + # else + # echo "Skipping ${file}" + # fi + # done - - task: PublishPipelineArtifact@1 - inputs: - targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log - artifact: $(COPYRIGHT_CONTAINER_NAME) - publishLocation: "pipeline" + # - task: PublishPipelineArtifact@1 + # inputs: + # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log + # artifact: $(COPYRIGHT_CONTAINER_NAME) + # publishLocation: "pipeline" - - task: Bash@3 - inputs: - targetType: "inline" - script: | - ls $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log - if [ $? -eq 0 ] ; then - echo "------------------Check for wrong file list !!!!!!!!!!!!!!!!!!!!!!!"; exit 1 - fi - exit 0 \ No newline at end of file + # - task: Bash@3 + # inputs: + # targetType: "inline" + # script: | + # ls $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log + # if [ $? -eq 0 ] ; then + # echo "------------------Check for wrong file list !!!!!!!!!!!!!!!!!!!!!!!"; exit 1 + # fi + # exit 0 \ No newline at end of file From fa4e279fd770a463bba1f6129eebb988fd0f325d Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 10:41:59 +0800 Subject: [PATCH 241/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 07b0bf896c9..9c0db2dc171 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -10,7 +10,7 @@ variables: # TARGET_PATH: "/neural_compressor" CODE_SCAN_PATH: ".azure-pipelines/scripts/codeScan" CODE_SCAN_LOG_PATH: ".azure-pipelines/scripts/codeScan/scanLog" - DOCKER_CODE_SCAN_PATH: "neural_compressor/.azure-pipelines/scripts/codeScan" + DOCKER_CODE_SCAN_PATH: "neural-compressor/.azure-pipelines/scripts/codeScan" BANDIT_CONTAINER_NAME: "bandit" From 88d746bd409ddd45b43e64215962a10e53d5a45f Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 10:45:22 +0800 Subject: [PATCH 242/271] test --- .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index b52ded2b6a8..9f11587a694 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -1,5 +1,5 @@ set -ex -bandit_log_dir = "/neural-compressor/neural_compressor/.azure-pipelines/scripts/codeScan/scanLog" +bandit_log_dir="/neural-compressor/neural_compressor/.azure-pipelines/scripts/codeScan/scanLog" pip install bandit @@ -12,4 +12,4 @@ if [ ${exit_code} -ne 0 ] ; then fi exit 0 -export bandit_log_dir \ No newline at end of file + \ No newline at end of file From 389368413b011557dad21c8a3d1d16c01eef8a6a Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 10:46:56 +0800 Subject: [PATCH 243/271] test --- .azure-pipelines/code-scan.yml | 5 ----- .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 3 +-- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 9c0db2dc171..d5e385d0c96 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -56,11 +56,6 @@ stages: script: | docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /$(DOCKER_CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh # docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - echo "---------$bandit_log_dir-------------" - echo $bandit_log_dir - echo "---------$(bandit_log_dir)-------------" - echo $(bandit_log_dir) - echo "----------------------" - task: PublishPipelineArtifact@1 inputs: targetPath: $(CURRENT_PATH)/$(DOCKER_CODE_SCAN_PATH)/lpot-bandit.log diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index 9f11587a694..544040617a9 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -1,5 +1,5 @@ set -ex -bandit_log_dir="/neural-compressor/neural_compressor/.azure-pipelines/scripts/codeScan/scanLog" +bandit_log_dir="/neural-compressor/.azure-pipelines/scripts/codeScan/scanLog" pip install bandit @@ -12,4 +12,3 @@ if [ ${exit_code} -ne 0 ] ; then fi exit 0 - \ No newline at end of file From fb3583ad387814022f720533d1131cd039c2f369 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 10:50:21 +0800 Subject: [PATCH 244/271] test --- .azure-pipelines/code-scan.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index d5e385d0c96..a26b0804dd6 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -55,6 +55,15 @@ stages: targetType: "inline" script: | docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /$(DOCKER_CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh + echo "-----------$(CURRENT_PATH)/neural-compressor------------------" + cd $(CURRENT_PATH)/neural-compressor + ls + echo "-----------------------------" + + echo "-----------$(CURRENT_PATH)------------------" + cd $(CURRENT_PATH) + ls + echo "-----------------------------" # docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - task: PublishPipelineArtifact@1 inputs: From 1aec85cc43a345fea571eee95cb44eb172609902 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 10:56:43 +0800 Subject: [PATCH 245/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index a26b0804dd6..38cee731c4a 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -56,7 +56,7 @@ stages: script: | docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /$(DOCKER_CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh echo "-----------$(CURRENT_PATH)/neural-compressor------------------" - cd $(CURRENT_PATH)/neural-compressor + cd $(CURRENT_PATH)/docker ls echo "-----------------------------" From 1700de4aa82fa816090fdcb1324eb699613b5808 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 11:00:33 +0800 Subject: [PATCH 246/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 38cee731c4a..95f42dc761b 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -56,7 +56,7 @@ stages: script: | docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /$(DOCKER_CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh echo "-----------$(CURRENT_PATH)/neural-compressor------------------" - cd $(CURRENT_PATH)/docker + cd $(CURRENT_PATH)/.azure-pipelines/scripts/codeScan/scanLog ls echo "-----------------------------" From 37827dbaaa6a8426699be152a245abfa17600748 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 11:02:55 +0800 Subject: [PATCH 247/271] test --- .azure-pipelines/code-scan.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 95f42dc761b..98b286aafc3 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -55,19 +55,10 @@ stages: targetType: "inline" script: | docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /$(DOCKER_CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh - echo "-----------$(CURRENT_PATH)/neural-compressor------------------" - cd $(CURRENT_PATH)/.azure-pipelines/scripts/codeScan/scanLog - ls - echo "-----------------------------" - - echo "-----------$(CURRENT_PATH)------------------" - cd $(CURRENT_PATH) - ls - echo "-----------------------------" # docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - task: PublishPipelineArtifact@1 inputs: - targetPath: $(CURRENT_PATH)/$(DOCKER_CODE_SCAN_PATH)/lpot-bandit.log + targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log artifact: $(BANDIT_CONTAINER_NAME) publishLocation: "pipeline" From 34e50d8e82976dedeb9fc0acb0892ae42c9c2edb Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 11:14:31 +0800 Subject: [PATCH 248/271] test --- .azure-pipelines/code-scan.yml | 108 ++++++++---------- .../scripts/codeScan/pylint/pylint.sh | 6 +- 2 files changed, 53 insertions(+), 61 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 98b286aafc3..62ba2a7c1c4 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -10,65 +10,16 @@ variables: # TARGET_PATH: "/neural_compressor" CODE_SCAN_PATH: ".azure-pipelines/scripts/codeScan" CODE_SCAN_LOG_PATH: ".azure-pipelines/scripts/codeScan/scanLog" - DOCKER_CODE_SCAN_PATH: "neural-compressor/.azure-pipelines/scripts/codeScan" - - - BANDIT_CONTAINER_NAME: "bandit" - PYLINT_CONTAINER_NAME: "pylint" - PYSPELLING_CONTAINER_NAME: "pyspelling" - COPYRIGHT_CONTAINER_NAME: "copyright" CURRENT_PATH: $(Build.SourcesDirectory) stages: - - stage: BanditCodeScan - displayName: Bandit Code Scan - dependsOn: [] - jobs: - - job: Bandit - displayName: Bandit - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - echo y | docker system prune - displayName: "Clean workspace" - - checkout: self - displayName: "Checkout out Repo" - - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: "Clean Docker" - - - task: Bash@3 - inputs: - targetType: "inline" - script: | - docker run --disable-content-trust --privileged --name=$(BANDIT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /$(DOCKER_CODE_SCAN_PATH)/$(BANDIT_CONTAINER_NAME)/bandit.sh - # docker cp $(BANDIT_CONTAINER_NAME):/lpot-bandit.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - - task: PublishPipelineArtifact@1 - inputs: - targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - artifact: $(BANDIT_CONTAINER_NAME) - publishLocation: "pipeline" - - - # - stage: PylintCodeScan - # displayName: Pylint Code Scan + # - stage: BanditCodeScan + # displayName: Bandit Code Scan # dependsOn: [] # jobs: - # - job: Pylint - # displayName: Pylint + # - job: Bandit + # displayName: Bandit # steps: # - script: | # echo ${BUILD_SOURCESDIRECTORY} @@ -96,15 +47,56 @@ stages: # inputs: # targetType: "inline" # script: | - # docker run --disable-content-trust --privileged --name=$(PYLINT_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYLINT_CONTAINER_NAME)/pylint.sh $(TARGET_PATH)" - # docker cp $(PYLINT_CONTAINER_NAME):/lpot-pylint.json $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json - + # docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/bandit/bandit.sh + # - task: PublishPipelineArtifact@1 # inputs: - # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json - # artifact: $(PYLINT_CONTAINER_NAME) + # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + # artifact: bandit # publishLocation: "pipeline" + + - stage: PylintCodeScan + displayName: Pylint Code Scan + dependsOn: [] + jobs: + - job: Pylint + displayName: Pylint + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + echo y | docker system prune + displayName: "Clean workspace" + - checkout: self + displayName: "Checkout out Repo" + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: "Clean Docker" + + - task: Bash@3 + inputs: + targetType: "inline" + script: | + docker run --disable-content-trust --privileged --name="pylint" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/pylint/pylint.sh + + - task: PublishPipelineArtifact@1 + inputs: + targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.log + artifact: pylint + publishLocation: "pipeline" + # - stage: PyspellingCodeScan # displayName: Pyspelling Code Scan # dependsOn: [] diff --git a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh index a6ff9db0999..7026071c2d1 100644 --- a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh +++ b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh @@ -1,5 +1,5 @@ -# $1: $(VAL_PATH) -# $2: $(target_path) +set -ex +pylint_log_dir="/neural-compressor/.azure-pipelines/scripts/codeScan/scanLog" pip install pylint==2.12.1 pip install flask==2.1.3 @@ -16,7 +16,7 @@ pip install onnxruntime_extensions -python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto --ignored-modules=tensorflow,torch,torch.quantization,torch.tensor,torchvision,mxnet,onnx,onnxruntime $1/$1 > /lpot-pylint.json +python -m pylint -f json --disable=R,C,W,E1129 --enable=line-too-long --max-line-length=120 --extension-pkg-whitelist=numpy --ignored-classes=TensorProto,NodeProto --ignored-modules=tensorflow,torch,torch.quantization,torch.tensor,torchvision,mxnet,onnx,onnxruntime /neural-compressor/neural_compressor > $pylint_log_dir/lpot-pylint.json exit_code=$? if [ ${exit_code} -ne 0 ] ; then From bc4a783569c3bc3a0e4b9d9b4f4780af069eb83f Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 11:18:00 +0800 Subject: [PATCH 249/271] test --- .azure-pipelines/scripts/codeScan/pylint/pylint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh index 7026071c2d1..cef8620dae5 100644 --- a/.azure-pipelines/scripts/codeScan/pylint/pylint.sh +++ b/.azure-pipelines/scripts/codeScan/pylint/pylint.sh @@ -11,7 +11,7 @@ pip install autograd pip install pymoo pip install tf_slim pip install transformers -pip install -r requirements.txt +pip install -r /neural-compressor/requirements.txt pip install onnxruntime_extensions From eaec1bde90be83a6c9c80368c919fa59bc83aced Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 11:23:05 +0800 Subject: [PATCH 250/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 62ba2a7c1c4..baaf867a2ff 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -93,7 +93,7 @@ stages: - task: PublishPipelineArtifact@1 inputs: - targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.log + targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json artifact: pylint publishLocation: "pipeline" From 7fa9242e9909c26f74f330ea964e58fc15de5c07 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 11:41:13 +0800 Subject: [PATCH 251/271] test --- .azure-pipelines/code-scan.yml | 101 +++++++++--------- .../scripts/codeScan/pyspelling/pyspelling.sh | 13 ++- 2 files changed, 58 insertions(+), 56 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index baaf867a2ff..4ba39ec9048 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -56,53 +56,12 @@ stages: # publishLocation: "pipeline" - - stage: PylintCodeScan - displayName: Pylint Code Scan - dependsOn: [] - jobs: - - job: Pylint - displayName: Pylint - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - echo y | docker system prune - displayName: "Clean workspace" - - checkout: self - displayName: "Checkout out Repo" - - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: "Clean Docker" - - - task: Bash@3 - inputs: - targetType: "inline" - script: | - docker run --disable-content-trust --privileged --name="pylint" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/pylint/pylint.sh - - - task: PublishPipelineArtifact@1 - inputs: - targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json - artifact: pylint - publishLocation: "pipeline" - - # - stage: PyspellingCodeScan - # displayName: Pyspelling Code Scan + # - stage: PylintCodeScan + # displayName: Pylint Code Scan # dependsOn: [] # jobs: - # - job: Pyspelling - # displayName: Pyspelling + # - job: Pylint + # displayName: Pylint # steps: # - script: | # echo ${BUILD_SOURCESDIRECTORY} @@ -130,14 +89,54 @@ stages: # inputs: # targetType: "inline" # script: | - # docker run --disable-content-trust --privileged --name=$(PYSPELLING_CONTAINER_NAME) -v ${BUILD_SOURCESDIRECTORY}:$(TARGET_PATH) ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash +x -c "cd $(TARGET_PATH) && bash $(TARGET_PATH)/$(CODE_SCAN_PATH)/$(PYSPELLING_CONTAINER_NAME)/pyspelling.sh $(TARGET_PATH)/$(CODE_SCAN_PATH)" - # docker cp $(PYSPELLING_CONTAINER_NAME):/lpot_pyspelling.log $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log - + # docker run --disable-content-trust --privileged --name="pylint" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/pylint/pylint.sh + # - task: PublishPipelineArtifact@1 # inputs: - # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log - # artifact: $(PYSPELLING_CONTAINER_NAME) - # publishLocation: "pipeline" + # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json + # artifact: pylint + # publishLocation: "pipeline" + + - stage: PyspellingCodeScan + displayName: Pyspelling Code Scan + dependsOn: [] + jobs: + - job: Pyspelling + displayName: Pyspelling + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + echo y | docker system prune + displayName: "Clean workspace" + - checkout: self + displayName: "Checkout out Repo" + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: "Clean Docker" + + - task: Bash@3 + inputs: + targetType: "inline" + script: | + docker run --disable-content-trust --privileged --name="pyspelling" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/pyspelling/pyspelling.sh + + - task: PublishPipelineArtifact@1 + inputs: + targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log + artifact: pyspelling + publishLocation: "pipeline" # - stage: CopyRight # displayName: CopyRight Code Scan diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh index f03e726c73c..2d64786d74c 100644 --- a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh @@ -1,3 +1,7 @@ +set -ex +pyspelling_dir="/neural-compressor/.azure-pipelines/scripts/codeScan" +pyspelling_log_dir="/neural-compressor/.azure-pipelines/scripts/codeScan/scanLog" + pip install pyspelling pip install -r requirements.txt @@ -6,11 +10,10 @@ apt-get install aspell-en -y -sed -i "s|\${VAL_REPO}|$1|g" /neural_compressor/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling_conf.yaml -sed -i "s|\${LPOT_REPO}|.|g" /neural_compressor/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling_conf.yaml -echo "Modified config:" -cat /neural_compressor/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling_conf.yaml -pyspelling -c /neural_compressor/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling_conf.yaml > /lpot_pyspelling.log +sed -i "s|\${VAL_REPO}|$1|g" $pyspelling_dir/pyspelling/pyspelling_conf.yaml +sed -i "s|\${LPOT_REPO}|.|g" $pyspelling_dir/pyspelling/pyspelling_conf.yaml + +pyspelling -c $pyspelling_dir/pyspelling/pyspelling_conf.yaml > $pyspelling_log_dir/lpot_pyspelling.log exit_code=$? if [ ${exit_code} -ne 0 ] ; then echo "Pyspelling exited with non-zero exit code."; exit 1 From a4a952fc36b4d221268ed6a651650cc5e3c94cef Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 11:43:03 +0800 Subject: [PATCH 252/271] test --- .azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh index 2d64786d74c..845ccd20377 100644 --- a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh @@ -3,7 +3,7 @@ pyspelling_dir="/neural-compressor/.azure-pipelines/scripts/codeScan" pyspelling_log_dir="/neural-compressor/.azure-pipelines/scripts/codeScan/scanLog" pip install pyspelling -pip install -r requirements.txt +pip install -r /neural-compressor/requirements.txt apt-get install aspell -y apt-get install aspell-en -y From cdca6deea0a63ebd95d70cc8d16c624e5c725676 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 11:44:44 +0800 Subject: [PATCH 253/271] test --- .azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh index 845ccd20377..1b2268384c0 100644 --- a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh @@ -10,7 +10,7 @@ apt-get install aspell-en -y -sed -i "s|\${VAL_REPO}|$1|g" $pyspelling_dir/pyspelling/pyspelling_conf.yaml +sed -i "s|\${VAL_REPO}|$pyspelling_dir|g" $pyspelling_dir/pyspelling/pyspelling_conf.yaml sed -i "s|\${LPOT_REPO}|.|g" $pyspelling_dir/pyspelling/pyspelling_conf.yaml pyspelling -c $pyspelling_dir/pyspelling/pyspelling_conf.yaml > $pyspelling_log_dir/lpot_pyspelling.log From 6cbb390102cf648bd7f16c6e3679abc041819bb1 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 12:28:18 +0800 Subject: [PATCH 254/271] test --- .azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh index 1b2268384c0..73b431ed8e4 100644 --- a/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh +++ b/.azure-pipelines/scripts/codeScan/pyspelling/pyspelling.sh @@ -11,7 +11,7 @@ apt-get install aspell-en -y sed -i "s|\${VAL_REPO}|$pyspelling_dir|g" $pyspelling_dir/pyspelling/pyspelling_conf.yaml -sed -i "s|\${LPOT_REPO}|.|g" $pyspelling_dir/pyspelling/pyspelling_conf.yaml +sed -i "s|\${LPOT_REPO}|/neural-compressor|g" $pyspelling_dir/pyspelling/pyspelling_conf.yaml pyspelling -c $pyspelling_dir/pyspelling/pyspelling_conf.yaml > $pyspelling_log_dir/lpot_pyspelling.log exit_code=$? From 5ae14a9489a19bc353f59cbd86fcf3fd232ba2a6 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 12:42:39 +0800 Subject: [PATCH 255/271] test --- .azure-pipelines/code-scan.yml | 234 ++++++++++++++++----------------- 1 file changed, 116 insertions(+), 118 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 4ba39ec9048..9aa7571492c 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -7,95 +7,93 @@ variables: IMAGE_NAME: "code-scan" IMAGE_TAG: "1.0" - # TARGET_PATH: "/neural_compressor" CODE_SCAN_PATH: ".azure-pipelines/scripts/codeScan" CODE_SCAN_LOG_PATH: ".azure-pipelines/scripts/codeScan/scanLog" - CURRENT_PATH: $(Build.SourcesDirectory) stages: - # - stage: BanditCodeScan - # displayName: Bandit Code Scan - # dependsOn: [] - # jobs: - # - job: Bandit - # displayName: Bandit - # steps: - # - script: | - # echo ${BUILD_SOURCESDIRECTORY} - # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # echo y | docker system prune - # displayName: "Clean workspace" - # - checkout: self - # displayName: "Checkout out Repo" - # - script: | - # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - # fi - # docker images | grep -i ${IMAGE_NAME} - # if [[ $? -ne 0 ]]; then - # echo "NO Such Image ${IMAGE_NAME}" - # exit 1 - # fi - # displayName: "Build Devel Images" - # - script: | - # docker stop $(docker ps -aq) - # docker rm -vf $(docker ps -aq) || true - # displayName: "Clean Docker" + - stage: BanditCodeScan + displayName: Bandit Code Scan + dependsOn: [] + jobs: + - job: Bandit + displayName: Bandit + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + echo y | docker system prune + displayName: "Clean workspace" + - checkout: self + displayName: "Checkout out Repo" + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: "Clean Docker" - # - task: Bash@3 - # inputs: - # targetType: "inline" - # script: | - # docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/bandit/bandit.sh + - task: Bash@3 + inputs: + targetType: "inline" + script: | + docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/bandit/bandit.sh - # - task: PublishPipelineArtifact@1 - # inputs: - # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log - # artifact: bandit - # publishLocation: "pipeline" + - task: PublishPipelineArtifact@1 + inputs: + targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log + artifact: bandit + publishLocation: "pipeline" - # - stage: PylintCodeScan - # displayName: Pylint Code Scan - # dependsOn: [] - # jobs: - # - job: Pylint - # displayName: Pylint - # steps: - # - script: | - # echo ${BUILD_SOURCESDIRECTORY} - # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - # echo y | docker system prune - # displayName: "Clean workspace" - # - checkout: self - # displayName: "Checkout out Repo" - # - script: | - # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - # fi - # docker images | grep -i ${IMAGE_NAME} - # if [[ $? -ne 0 ]]; then - # echo "NO Such Image ${IMAGE_NAME}" - # exit 1 - # fi - # displayName: "Build Devel Images" - # - script: | - # docker stop $(docker ps -aq) - # docker rm -vf $(docker ps -aq) || true - # displayName: "Clean Docker" + - stage: PylintCodeScan + displayName: Pylint Code Scan + dependsOn: [] + jobs: + - job: Pylint + displayName: Pylint + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + echo y | docker system prune + displayName: "Clean workspace" + - checkout: self + displayName: "Checkout out Repo" + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: "Clean Docker" - # - task: Bash@3 - # inputs: - # targetType: "inline" - # script: | - # docker run --disable-content-trust --privileged --name="pylint" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/pylint/pylint.sh + - task: Bash@3 + inputs: + targetType: "inline" + script: | + docker run --disable-content-trust --privileged --name="pylint" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/pylint/pylint.sh - # - task: PublishPipelineArtifact@1 - # inputs: - # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json - # artifact: pylint - # publishLocation: "pipeline" + - task: PublishPipelineArtifact@1 + inputs: + targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json + artifact: pylint + publishLocation: "pipeline" - stage: PyspellingCodeScan displayName: Pyspelling Code Scan @@ -138,47 +136,47 @@ stages: artifact: pyspelling publishLocation: "pipeline" - # - stage: CopyRight - # displayName: CopyRight Code Scan - # dependsOn: [] - # jobs: - # - job: CopyRight - # displayName: CopyRight - # steps: - # - task: Bash@3 - # inputs: - # targetType: "inline" - # script: | - # set -ex - # supported_extensions=(py, sh, yaml) + - stage: CopyRight + displayName: CopyRight Code Scan + dependsOn: [] + jobs: + - job: CopyRight + displayName: CopyRight + steps: + - task: Bash@3 + inputs: + targetType: "inline" + script: | + set -ex + supported_extensions=(py, sh, yaml) - # git --no-pager diff --name-only $(git show-ref -s remotes/origin/$(System.PullRequest.TargetBranch)) $(CURRENT_PATH)/neural_compressor > $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log - # files=$(cat $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log | awk '!a[$0]++') + git --no-pager diff --name-only $(git show-ref -s remotes/origin/$(System.PullRequest.TargetBranch)) $(CURRENT_PATH)/neural_compressor > $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log + files=$(cat $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log | awk '!a[$0]++') - # for file in ${files} - # do - # if [[ "${supported_extensions[@]}" =~ "${file##*.}" ]]; then - # echo "Checking license in 1 ${file}" - # if [ $(grep -E -c "Copyright \\(c\\) ([0-9]{4})(-[0-9]{4})? Intel Corporation" ${file}) = 0 ]; then - # echo ${file} >> $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log - # fi - # else - # echo "Skipping ${file}" - # fi - # done + for file in ${files} + do + if [[ "${supported_extensions[@]}" =~ "${file##*.}" ]]; then + echo "Checking license in 1 ${file}" + if [ $(grep -E -c "Copyright \\(c\\) ([0-9]{4})(-[0-9]{4})? Intel Corporation" ${file}) = 0 ]; then + echo ${file} >> $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log + fi + else + echo "Skipping ${file}" + fi + done - # - task: PublishPipelineArtifact@1 - # inputs: - # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log - # artifact: $(COPYRIGHT_CONTAINER_NAME) - # publishLocation: "pipeline" + - task: PublishPipelineArtifact@1 + inputs: + targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log + artifact: $(COPYRIGHT_CONTAINER_NAME) + publishLocation: "pipeline" - # - task: Bash@3 - # inputs: - # targetType: "inline" - # script: | - # ls $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log - # if [ $? -eq 0 ] ; then - # echo "------------------Check for wrong file list !!!!!!!!!!!!!!!!!!!!!!!"; exit 1 - # fi - # exit 0 \ No newline at end of file + - task: Bash@3 + inputs: + targetType: "inline" + script: | + ls $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log + if [ $? -eq 0 ] ; then + echo "------------------Check for wrong file list !!!!!!!!!!!!!!!!!!!!!!!"; exit 1 + fi + exit 0 \ No newline at end of file From e739aef3ef5a96da837f6a95304b6fab7a56f368 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 12:45:32 +0800 Subject: [PATCH 256/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 9aa7571492c..9eddea96795 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -168,7 +168,7 @@ stages: - task: PublishPipelineArtifact@1 inputs: targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log - artifact: $(COPYRIGHT_CONTAINER_NAME) + artifact: copyright publishLocation: "pipeline" - task: Bash@3 From 3da4e4fc089999a2e8455d30eaf2812d36468ed1 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 12:59:42 +0800 Subject: [PATCH 257/271] test --- .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index 544040617a9..4436af6f342 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -7,7 +7,7 @@ pip install bandit python -m bandit -r -lll -iii /neural-compressor/neural_compressor > $bandit_log_dir/lpot-bandit.log exit_code=$? -if [ ${exit_code} -ne 0 ] ; then +if [ ${exit_code} -eq 0 ] ; then echo "Bandit exited with non-zero exit code."; exit 1 fi exit 0 From 6de9c5179209b48e3b8f28e3a81f401546592996 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 13:24:27 +0800 Subject: [PATCH 258/271] test --- .azure-pipelines/code-scan.yml | 269 ++++++++++-------- .../scripts/codeScan/bandit/bandit.sh | 3 +- 2 files changed, 150 insertions(+), 122 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 9eddea96795..576783e464a 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -6,10 +6,10 @@ pool: suyue-test variables: IMAGE_NAME: "code-scan" IMAGE_TAG: "1.0" - CODE_SCAN_PATH: ".azure-pipelines/scripts/codeScan" CODE_SCAN_LOG_PATH: ".azure-pipelines/scripts/codeScan/scanLog" CURRENT_PATH: $(Build.SourcesDirectory) + CURRENT_STATUS: 0 stages: - stage: BanditCodeScan @@ -18,7 +18,13 @@ stages: jobs: - job: Bandit displayName: Bandit + continueOnError: true steps: + - script: | + if [ $(CURRENT_STATUS) -ne 0 ] ; then + exit 1 + fi + exit 0 - script: | echo ${BUILD_SOURCESDIRECTORY} sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true @@ -45,7 +51,7 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/bandit/bandit.sh + docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/bandit/bandit.sh $(CURRENT_STATUS) - task: PublishPipelineArtifact@1 inputs: @@ -53,130 +59,153 @@ stages: artifact: bandit publishLocation: "pipeline" + # - script: | + # if [ $(CURRENT_STATUS) -ne 0 ] ; then + # exit 1 + # fi + # exit 0 + + - - stage: PylintCodeScan - displayName: Pylint Code Scan - dependsOn: [] - jobs: - - job: Pylint - displayName: Pylint - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - echo y | docker system prune - displayName: "Clean workspace" - - checkout: self - displayName: "Checkout out Repo" - - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: "Clean Docker" + # - stage: PylintCodeScan + # displayName: Pylint Code Scan + # dependsOn: [] + # jobs: + # - job: Pylint + # displayName: Pylint + # steps: + # - script: | + # if [ $(CURRENT_STATUS) -ne 0 ] ; then + # exit 1 + # fi + # exit 0 + # - script: | + # echo ${BUILD_SOURCESDIRECTORY} + # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # echo y | docker system prune + # displayName: "Clean workspace" + # - checkout: self + # displayName: "Checkout out Repo" + # - script: | + # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + # fi + # docker images | grep -i ${IMAGE_NAME} + # if [[ $? -ne 0 ]]; then + # echo "NO Such Image ${IMAGE_NAME}" + # exit 1 + # fi + # displayName: "Build Devel Images" + # - script: | + # docker stop $(docker ps -aq) + # docker rm -vf $(docker ps -aq) || true + # displayName: "Clean Docker" - - task: Bash@3 - inputs: - targetType: "inline" - script: | - docker run --disable-content-trust --privileged --name="pylint" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/pylint/pylint.sh + # - task: Bash@3 + # inputs: + # targetType: "inline" + # script: | + # docker run --disable-content-trust --privileged --name="pylint" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/pylint/pylint.sh - - task: PublishPipelineArtifact@1 - inputs: - targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json - artifact: pylint - publishLocation: "pipeline" + # - task: PublishPipelineArtifact@1 + # inputs: + # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-pylint.json + # artifact: pylint + # publishLocation: "pipeline" - - stage: PyspellingCodeScan - displayName: Pyspelling Code Scan - dependsOn: [] - jobs: - - job: Pyspelling - displayName: Pyspelling - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - echo y | docker system prune - displayName: "Clean workspace" - - checkout: self - displayName: "Checkout out Repo" - - script: | - if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build Devel Images" - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - displayName: "Clean Docker" + # - script: | + # if [ $(CURRENT_STATUS) -ne 0 ] ; then + # exit 1 + # fi + # exit 0 - - task: Bash@3 - inputs: - targetType: "inline" - script: | - docker run --disable-content-trust --privileged --name="pyspelling" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/pyspelling/pyspelling.sh + # - stage: PyspellingCodeScan + # displayName: Pyspelling Code Scan + # dependsOn: [] + # jobs: + # - job: Pyspelling + # displayName: Pyspelling + # steps: + # - script: | + # if [ $(CURRENT_STATUS) -ne 0 ] ; then + # exit 1 + # fi + # exit 0 + # - script: | + # echo ${BUILD_SOURCESDIRECTORY} + # sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + # echo y | docker system prune + # displayName: "Clean workspace" + # - checkout: self + # displayName: "Checkout out Repo" + # - script: | + # if [[ ! $(docker images | grep -i ${IMAGE_NAME}) ]]; then + # docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + # fi + # docker images | grep -i ${IMAGE_NAME} + # if [[ $? -ne 0 ]]; then + # echo "NO Such Image ${IMAGE_NAME}" + # exit 1 + # fi + # displayName: "Build Devel Images" + # - script: | + # docker stop $(docker ps -aq) + # docker rm -vf $(docker ps -aq) || true + # displayName: "Clean Docker" - - task: PublishPipelineArtifact@1 - inputs: - targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log - artifact: pyspelling - publishLocation: "pipeline" + # - task: Bash@3 + # inputs: + # targetType: "inline" + # script: | + # docker run --disable-content-trust --privileged --name="pyspelling" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/pyspelling/pyspelling.sh - - stage: CopyRight - displayName: CopyRight Code Scan - dependsOn: [] - jobs: - - job: CopyRight - displayName: CopyRight - steps: - - task: Bash@3 - inputs: - targetType: "inline" - script: | - set -ex - supported_extensions=(py, sh, yaml) - - git --no-pager diff --name-only $(git show-ref -s remotes/origin/$(System.PullRequest.TargetBranch)) $(CURRENT_PATH)/neural_compressor > $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log - files=$(cat $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log | awk '!a[$0]++') - - for file in ${files} - do - if [[ "${supported_extensions[@]}" =~ "${file##*.}" ]]; then - echo "Checking license in 1 ${file}" - if [ $(grep -E -c "Copyright \\(c\\) ([0-9]{4})(-[0-9]{4})? Intel Corporation" ${file}) = 0 ]; then - echo ${file} >> $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log - fi - else - echo "Skipping ${file}" - fi - done + # - task: PublishPipelineArtifact@1 + # inputs: + # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot_pyspelling.log + # artifact: pyspelling + # publishLocation: "pipeline" - - task: PublishPipelineArtifact@1 - inputs: - targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log - artifact: copyright - publishLocation: "pipeline" + # - stage: CopyRight + # displayName: CopyRight Code Scan + # dependsOn: [] + # jobs: + # - job: CopyRight + # displayName: CopyRight + # steps: + # - task: Bash@3 + # inputs: + # targetType: "inline" + # script: | + # set -ex + # supported_extensions=(py, sh, yaml) - - task: Bash@3 - inputs: - targetType: "inline" - script: | - ls $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log - if [ $? -eq 0 ] ; then - echo "------------------Check for wrong file list !!!!!!!!!!!!!!!!!!!!!!!"; exit 1 - fi - exit 0 \ No newline at end of file + # git --no-pager diff --name-only $(git show-ref -s remotes/origin/$(System.PullRequest.TargetBranch)) $(CURRENT_PATH)/neural_compressor > $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log + # files=$(cat $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/diff.log | awk '!a[$0]++') + + # for file in ${files} + # do + # if [[ "${supported_extensions[@]}" =~ "${file##*.}" ]]; then + # echo "Checking license in 1 ${file}" + # if [ $(grep -E -c "Copyright \\(c\\) ([0-9]{4})(-[0-9]{4})? Intel Corporation" ${file}) = 0 ]; then + # echo ${file} >> $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log + # fi + # else + # echo "Skipping ${file}" + # fi + # done + + # - task: PublishPipelineArtifact@1 + # inputs: + # targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log + # artifact: copyright + # publishLocation: "pipeline" + + # - task: Bash@3 + # inputs: + # targetType: "inline" + # script: | + # ls $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/copyright_issue_summary.log + # if [ $? -eq 0 ] ; then + # echo "------------------Check for wrong file list !!!!!!!!!!!!!!!!!!!!!!!"; exit 1 + # fi + # exit 0 \ No newline at end of file diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index 4436af6f342..27cffc3edb2 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -1,13 +1,12 @@ set -ex bandit_log_dir="/neural-compressor/.azure-pipelines/scripts/codeScan/scanLog" - pip install bandit - python -m bandit -r -lll -iii /neural-compressor/neural_compressor > $bandit_log_dir/lpot-bandit.log exit_code=$? if [ ${exit_code} -eq 0 ] ; then + $1 = 1; echo "Bandit exited with non-zero exit code."; exit 1 fi exit 0 From 9eb8b2f543073fd9487931e10b0768a0b0f297c9 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 13:27:26 +0800 Subject: [PATCH 259/271] test --- .azure-pipelines/code-scan.yml | 2 +- .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 576783e464a..7b62b6fe89f 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -51,7 +51,7 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/bandit/bandit.sh $(CURRENT_STATUS) + docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/bandit/bandit.sh - task: PublishPipelineArtifact@1 inputs: diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index 27cffc3edb2..bccba11bd28 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -6,7 +6,6 @@ python -m bandit -r -lll -iii /neural-compressor/neural_compressor > $bandit_lo exit_code=$? if [ ${exit_code} -eq 0 ] ; then - $1 = 1; echo "Bandit exited with non-zero exit code."; exit 1 fi exit 0 From c21efdff7e75bd474b4ca06cee9cbdb801697725 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 13:33:38 +0800 Subject: [PATCH 260/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 7b62b6fe89f..7c8b401fb1c 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -18,7 +18,7 @@ stages: jobs: - job: Bandit displayName: Bandit - continueOnError: true + condition: false steps: - script: | if [ $(CURRENT_STATUS) -ne 0 ] ; then From 87cf1046dd046d6e923d6c1f8735d36ae6e99e3b Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 13:36:05 +0800 Subject: [PATCH 261/271] test --- .azure-pipelines/code-scan.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 7c8b401fb1c..2b274402dbd 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -9,7 +9,7 @@ variables: CODE_SCAN_PATH: ".azure-pipelines/scripts/codeScan" CODE_SCAN_LOG_PATH: ".azure-pipelines/scripts/codeScan/scanLog" CURRENT_PATH: $(Build.SourcesDirectory) - CURRENT_STATUS: 0 + CURRENT_STATUS: true stages: - stage: BanditCodeScan @@ -18,7 +18,7 @@ stages: jobs: - job: Bandit displayName: Bandit - condition: false + condition: $(CURRENT_STATUS) steps: - script: | if [ $(CURRENT_STATUS) -ne 0 ] ; then From 17f299edcef5e2efc68d35dddf3263f2f0847497 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 13:41:10 +0800 Subject: [PATCH 262/271] test --- .azure-pipelines/code-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 2b274402dbd..ef05e295b0d 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -18,7 +18,7 @@ stages: jobs: - job: Bandit displayName: Bandit - condition: $(CURRENT_STATUS) + condition: variables['CURRENT_STATUS'] steps: - script: | if [ $(CURRENT_STATUS) -ne 0 ] ; then From ed8700b49469fb9496135ab664a459e2a3f6dc6e Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 13:47:45 +0800 Subject: [PATCH 263/271] test --- .azure-pipelines/code-scan.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index ef05e295b0d..4957fa129ea 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -9,7 +9,7 @@ variables: CODE_SCAN_PATH: ".azure-pipelines/scripts/codeScan" CODE_SCAN_LOG_PATH: ".azure-pipelines/scripts/codeScan/scanLog" CURRENT_PATH: $(Build.SourcesDirectory) - CURRENT_STATUS: true + CURRENT_STATUS: 'false' stages: - stage: BanditCodeScan @@ -18,7 +18,7 @@ stages: jobs: - job: Bandit displayName: Bandit - condition: variables['CURRENT_STATUS'] + condition: and(succeeded(), eq(variables.CURRENT_PATH, 'true')) steps: - script: | if [ $(CURRENT_STATUS) -ne 0 ] ; then From 37279fcd9c6fd4488f72c5565fcae5b039847e18 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 13:48:52 +0800 Subject: [PATCH 264/271] test --- .azure-pipelines/code-scan.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 4957fa129ea..cc304516f97 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -18,13 +18,8 @@ stages: jobs: - job: Bandit displayName: Bandit - condition: and(succeeded(), eq(variables.CURRENT_PATH, 'true')) + condition: eq(variables['CURRENT_STATUS'], 'true') steps: - - script: | - if [ $(CURRENT_STATUS) -ne 0 ] ; then - exit 1 - fi - exit 0 - script: | echo ${BUILD_SOURCESDIRECTORY} sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true From d56968d6febb205fd13b5f75cfa3f25e85244469 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 13:54:46 +0800 Subject: [PATCH 265/271] test --- .azure-pipelines/code-scan.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index cc304516f97..f581e1f3787 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -9,7 +9,7 @@ variables: CODE_SCAN_PATH: ".azure-pipelines/scripts/codeScan" CODE_SCAN_LOG_PATH: ".azure-pipelines/scripts/codeScan/scanLog" CURRENT_PATH: $(Build.SourcesDirectory) - CURRENT_STATUS: 'false' + CURRENT_STATUS: 'true' stages: - stage: BanditCodeScan @@ -46,7 +46,7 @@ stages: inputs: targetType: "inline" script: | - docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/bandit/bandit.sh + docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/bandit/bandit.sh $(CURRENT_STATUS) - task: PublishPipelineArtifact@1 inputs: From 5e747880de3e5bb4020a5b916221a49a7d4d2a0c Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 14:06:40 +0800 Subject: [PATCH 266/271] test --- .azure-pipelines/code-scan.yml | 6 ++++-- .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index f581e1f3787..91fae6f2749 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -9,7 +9,7 @@ variables: CODE_SCAN_PATH: ".azure-pipelines/scripts/codeScan" CODE_SCAN_LOG_PATH: ".azure-pipelines/scripts/codeScan/scanLog" CURRENT_PATH: $(Build.SourcesDirectory) - CURRENT_STATUS: 'true' + CURRENT_STATUS: true stages: - stage: BanditCodeScan @@ -47,7 +47,9 @@ stages: targetType: "inline" script: | docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/bandit/bandit.sh $(CURRENT_STATUS) - + echo "------$(CURRENT_STATUS)-------" + echo $(CURRENT_STATUS) + echo "-------------" - task: PublishPipelineArtifact@1 inputs: targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index bccba11bd28..58247134251 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -1,4 +1,4 @@ -set -ex +# set -ex bandit_log_dir="/neural-compressor/.azure-pipelines/scripts/codeScan/scanLog" pip install bandit @@ -6,6 +6,7 @@ python -m bandit -r -lll -iii /neural-compressor/neural_compressor > $bandit_lo exit_code=$? if [ ${exit_code} -eq 0 ] ; then + sed -i 's/CURRENT_STATUS:.*$/CURRENT_STATUS: false' /neural-compressor/azure-pipelines.yml echo "Bandit exited with non-zero exit code."; exit 1 fi exit 0 From 90ff87f3b6671804868c890973b795a337fc2ce1 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 14:09:14 +0800 Subject: [PATCH 267/271] test --- .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index 58247134251..30bcbbcd1f1 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -6,7 +6,9 @@ python -m bandit -r -lll -iii /neural-compressor/neural_compressor > $bandit_lo exit_code=$? if [ ${exit_code} -eq 0 ] ; then - sed -i 's/CURRENT_STATUS:.*$/CURRENT_STATUS: false' /neural-compressor/azure-pipelines.yml + sed -i "s|CURRENT_STATUS:.*|CURRENT_STATUS: false|g" /neural-compressor/azure-pipelines.yml + + # sed -i 's/CURRENT_STATUS:.*$/CURRENT_STATUS: false' /neural-compressor/azure-pipelines.yml echo "Bandit exited with non-zero exit code."; exit 1 fi exit 0 From 3b81d2c408a2d4c6b6fe6e79c519f139e81190b9 Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 14:12:13 +0800 Subject: [PATCH 268/271] test --- .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index 30bcbbcd1f1..9a943a8ae00 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -6,7 +6,7 @@ python -m bandit -r -lll -iii /neural-compressor/neural_compressor > $bandit_lo exit_code=$? if [ ${exit_code} -eq 0 ] ; then - sed -i "s|CURRENT_STATUS:.*|CURRENT_STATUS: false|g" /neural-compressor/azure-pipelines.yml + sed -i "s|CURRENT_STATUS\: true|CURRENT_STATUS\: false|g" /neural-compressor/azure-pipelines.yml # sed -i 's/CURRENT_STATUS:.*$/CURRENT_STATUS: false' /neural-compressor/azure-pipelines.yml echo "Bandit exited with non-zero exit code."; exit 1 From 86cd3fbcfcf487cbfb4784e0dc021dd5b067965c Mon Sep 17 00:00:00 2001 From: "Yue, Wenjiao" Date: Fri, 12 Aug 2022 14:15:34 +0800 Subject: [PATCH 269/271] test --- .azure-pipelines/code-scan.yml | 4 +++- .azure-pipelines/scripts/codeScan/bandit/bandit.sh | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/code-scan.yml b/.azure-pipelines/code-scan.yml index 91fae6f2749..4cb89626c89 100644 --- a/.azure-pipelines/code-scan.yml +++ b/.azure-pipelines/code-scan.yml @@ -10,6 +10,7 @@ variables: CODE_SCAN_LOG_PATH: ".azure-pipelines/scripts/codeScan/scanLog" CURRENT_PATH: $(Build.SourcesDirectory) CURRENT_STATUS: true + ER: "1212" stages: - stage: BanditCodeScan @@ -49,7 +50,8 @@ stages: docker run --disable-content-trust --privileged --name="bandit" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} bash /neural-compressor/$(CODE_SCAN_PATH)/bandit/bandit.sh $(CURRENT_STATUS) echo "------$(CURRENT_STATUS)-------" echo $(CURRENT_STATUS) - echo "-------------" + + echo "---$(ER)----$(QR)------" - task: PublishPipelineArtifact@1 inputs: targetPath: $(CURRENT_PATH)/$(CODE_SCAN_LOG_PATH)/lpot-bandit.log diff --git a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh index 9a943a8ae00..e8f868a6f3f 100644 --- a/.azure-pipelines/scripts/codeScan/bandit/bandit.sh +++ b/.azure-pipelines/scripts/codeScan/bandit/bandit.sh @@ -7,6 +7,7 @@ python -m bandit -r -lll -iii /neural-compressor/neural_compressor > $bandit_lo exit_code=$? if [ ${exit_code} -eq 0 ] ; then sed -i "s|CURRENT_STATUS\: true|CURRENT_STATUS\: false|g" /neural-compressor/azure-pipelines.yml + sed -i "s|ER|QR|g" /neural-compressor/azure-pipelines.yml # sed -i 's/CURRENT_STATUS:.*$/CURRENT_STATUS: false' /neural-compressor/azure-pipelines.yml echo "Bandit exited with non-zero exit code."; exit 1 From a148e8b6452515041d897a8153b31fab7d47d3d3 Mon Sep 17 00:00:00 2001 From: Wenxin Zhang Date: Mon, 15 Aug 2022 13:38:52 +0800 Subject: [PATCH 270/271] change ut structure and try coverage combine --- .azure-pipelines/scripts/install_nc.sh | 2 + .azure-pipelines/scripts/ut/coverage.file | 25 +++ ...basic_adaptor.sh => run_basic_strategy.sh} | 12 +- ...run_basic_others.sh => run_basic_utils.sh} | 12 +- .azure-pipelines/ut-basic.yml | 132 -------------- .azure-pipelines/ut-coverage.yml | 171 ++++++++++++++++++ 6 files changed, 216 insertions(+), 138 deletions(-) create mode 100644 .azure-pipelines/scripts/ut/coverage.file rename .azure-pipelines/scripts/ut/{run_basic_adaptor.sh => run_basic_strategy.sh} (64%) rename .azure-pipelines/scripts/ut/{run_basic_others.sh => run_basic_utils.sh} (70%) delete mode 100644 .azure-pipelines/ut-basic.yml create mode 100644 .azure-pipelines/ut-coverage.yml diff --git a/.azure-pipelines/scripts/install_nc.sh b/.azure-pipelines/scripts/install_nc.sh index 38fd439404b..f333a42cc3a 100644 --- a/.azure-pipelines/scripts/install_nc.sh +++ b/.azure-pipelines/scripts/install_nc.sh @@ -4,4 +4,6 @@ cd /neural-compressor python -m pip install --no-cache-dir -r requirements.txt python setup.py sdist bdist_wheel pip install dist/neural_compressor*.whl +pip install pytest +pip install coverage pip list \ No newline at end of file diff --git a/.azure-pipelines/scripts/ut/coverage.file b/.azure-pipelines/scripts/ut/coverage.file new file mode 100644 index 00000000000..4e649650502 --- /dev/null +++ b/.azure-pipelines/scripts/ut/coverage.file @@ -0,0 +1,25 @@ +[run] +branch = True +relative_files=True +[paths] +source = + /usr/local/lib/python3.8/dist-packages/neural_compressor + /neural-compressor/neural_compressor +[report] +omit = + */**/fake*yaml + */**/fake.py + */neural_compressor/ux/* + */neural_compressor/model/nets_factory.py + */neural_compressor/experimental/benchmark.py + */neural_compressor/contrib/strategy/tpe.py + */nlp_toolkit/backends/* +exclude_lines = + pragma: no cover + raise NotImplementedError + raise TypeError + if self.device == "gpu": + if device == "gpu": + except ImportError: + onnx_version < ONNX18_VERSION + onnx_version >= ONNX18_VERSION diff --git a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh b/.azure-pipelines/scripts/ut/run_basic_strategy.sh similarity index 64% rename from .azure-pipelines/scripts/ut/run_basic_adaptor.sh rename to .azure-pipelines/scripts/ut/run_basic_strategy.sh index 334be82959e..f5b66560a7f 100644 --- a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh +++ b/.azure-pipelines/scripts/ut/run_basic_strategy.sh @@ -11,9 +11,9 @@ export mxnet_version='1.7.0' echo "set up UT env..." bash /neural-compressor/.azure-pipelines/scripts/ut/env_setup.sh - +lpot_path=$(python -c 'import neural_compressor; import os; print(os.path.dirname(neural_compressor.__file__))') cd /neural-compressor/test || exit 1 -find ./adaptor -name "test*.py" | sed 's,\.\/,python ,g' | sed 's/$/ --verbose/' > run.sh +find ./strategy -name "test*.py" | sed 's,\.\/,coverage run --source='"${lpot_path}"' --append ,g' | sed 's/$/ --verbose/'> run.sh LOG_DIR=/neural-compressor/log_dir mkdir -p ${LOG_DIR} @@ -23,7 +23,13 @@ echo "cat run.sh..." cat run.sh | tee ${ut_log_name} echo "-------------" bash run.sh 2>&1 | tee -a ${ut_log_name} - +echo "working in directory" +pwd +echo "list all component" +ls -a +cp .coverage ${LOG_DIR}/.coverage.strategy +echo "list all in ${LOG_DIR}" +ls -a ${LOG_DIR} if [ $(grep -c "FAILED" ${ut_log_name}) != 0 ] || [ $(grep -c "OK" ${ut_log_name}) == 0 ];then exit 1 fi \ No newline at end of file diff --git a/.azure-pipelines/scripts/ut/run_basic_others.sh b/.azure-pipelines/scripts/ut/run_basic_utils.sh similarity index 70% rename from .azure-pipelines/scripts/ut/run_basic_others.sh rename to .azure-pipelines/scripts/ut/run_basic_utils.sh index 5cd2e39d1e5..7cd4c371b88 100644 --- a/.azure-pipelines/scripts/ut/run_basic_others.sh +++ b/.azure-pipelines/scripts/ut/run_basic_utils.sh @@ -13,9 +13,9 @@ export mxnet_version='1.7.0' echo "set up UT env..." bash /neural-compressor/.azure-pipelines/scripts/ut/env_setup.sh - +lpot_path=$(python -c 'import neural_compressor; import os; print(os.path.dirname(neural_compressor.__file__))') cd /neural-compressor/test || exit 1 -find . -name "test*.py" | sed 's,\.\/,python ,g' | sed 's/$/ --verbose/' > run.sh +find ./utils -name "test*.py" | sed 's,\.\/,coverage run --source='"${lpot_path}"' --append ,g' | sed 's/$/ --verbose/'> run.sh sed -i '/ adaptor\//d' run.sh sed -i '/ tfnewapi\//d' run.sh sed -i '/ ux\//d' run.sh @@ -29,7 +29,13 @@ echo "cat run.sh..." cat run.sh | tee ${ut_log_name} echo "-------------" bash run.sh 2>&1 | tee -a ${ut_log_name} - +echo "working in directory" +pwd +echo "list all component" +ls -a +cp .coverage ${LOG_DIR}/.coverage.util +echo "list all in ${LOG_DIR}" +ls -a ${LOG_DIR} if [ $(grep -c "FAILED" ${ut_log_name}) != 0 ] || [ $(grep -c "OK" ${ut_log_name}) == 0 ];then exit 1 fi \ No newline at end of file diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml deleted file mode 100644 index 4e7ec62d2bc..00000000000 --- a/.azure-pipelines/ut-basic.yml +++ /dev/null @@ -1,132 +0,0 @@ -trigger: none - -pr: - branches: - include: - - master - paths: - include: - - neural_compressor - exclude: - - neural_compressor/ux - -pool: suyue-test - -variables: - IMAGE_NAME: 'neural-compressor' - IMAGE_TAG: 'py38' - -stages: -- stage: - displayName: Unit Test FWKs adaptor - dependsOn: [] - jobs: - - job: - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - displayName: 'Clean workspace' - - - checkout: self - displayName: "Checkout out Repo" - - - script: | - if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build develop docker image" - - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - env | sort - displayName: 'Clean docker' - - - script: | - docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} \ - bash -c "cd /neural-compressor/.azure-pipelines/scripts \ - && bash install_nc.sh \ - && bash ut/run_basic_adaptor.sh" - displayName: 'Install Neural Compressor and run UT' - -- stage: - displayName: Unit Test tf newAPI - dependsOn: [] - jobs: - - job: - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - displayName: 'Clean workspace' - - - checkout: self - displayName: "Checkout out Repo" - - - script: | - if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build develop docker image" - - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - env | sort - displayName: 'Clean docker' - - - script: | - docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor -v /tf_dataset:/tf_dataset ${IMAGE_NAME}:${IMAGE_TAG} \ - bash -c "cd /neural-compressor/.azure-pipelines/scripts \ - && bash install_nc.sh \ - && bash ut/run_basic_adaptor_tfnewapi.sh" - displayName: 'Install Neural Compressor and run UT' - -- stage: - displayName: Unit Test other basic case - dependsOn: [] - jobs: - - job: - steps: - - script: | - echo ${BUILD_SOURCESDIRECTORY} - sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true - displayName: 'Clean workspace' - - - checkout: self - displayName: "Checkout out Repo" - - - script: | - if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then - docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . - fi - docker images | grep -i ${IMAGE_NAME} - if [[ $? -ne 0 ]]; then - echo "NO Such Image ${IMAGE_NAME}" - exit 1 - fi - displayName: "Build develop docker image" - - - script: | - docker stop $(docker ps -aq) - docker rm -vf $(docker ps -aq) || true - env | sort - displayName: 'Clean docker' - - - script: | - docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} \ - bash -c "cd /neural-compressor/.azure-pipelines/scripts \ - && bash install_nc.sh \ - && bash ut/run_basic_others.sh" - displayName: 'Install Neural Compressor and run UT' diff --git a/.azure-pipelines/ut-coverage.yml b/.azure-pipelines/ut-coverage.yml new file mode 100644 index 00000000000..c852011966c --- /dev/null +++ b/.azure-pipelines/ut-coverage.yml @@ -0,0 +1,171 @@ +trigger: none + +pr: + - wenxin/ut-coverage + +pool: suyue-test + +variables: + IMAGE_NAME: 'neural-compressor' + IMAGE_TAG: 'py38' + UPLOAD_PATH: $(Build.SourcesDirectory)/log_dir + DOWNLOAD_PATH: $(Build.SourcesDirectory)/log_dir + OS: 'linux' + PLATFORM: 'clx8280' + ARTIFACT_NAME: 'UT_coverage_log' + +stages: +- stage: Strategy + displayName: "Unit Test Strategy" + dependsOn: [] + jobs: + - job: + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + displayName: 'Clean workspace' + + - checkout: self + displayName: "Checkout out Repo" + + - script: | + if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build develop docker image" + + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + env | sort + displayName: 'Clean docker' + + - script: | + docker run --disable-content-trust --privileged --name="ut-stra" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} \ + bash -c "cd /neural-compressor/.azure-pipelines/scripts \ + && bash install_nc.sh \ + && bash ut/run_basic_strategy.sh" + # docker cp 'ut-stra':/neural-compressor/log_dir/.coverage.strategy $(UPLOAD_PATH)/ + ls -l $(UPLOAD_PATH) + ls -l $(DOWNLOAD_PATH) + displayName: 'Install Neural Compressor and run UT' + - task: PublishPipelineArtifact@1 + inputs: + targetPath: $(UPLOAD_PATH) + artifact: 'ut-coverage-strategy' + publishLocation: 'pipeline' + +- stage: Utils + displayName: "Unit Test Utils" + dependsOn: [] + jobs: + - job: + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + displayName: 'Clean workspace' + + - checkout: self + displayName: "Checkout out Repo" + + - script: | + if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build develop docker image" + + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + env | sort + displayName: 'Clean docker' + + - script: | + docker run --disable-content-trust --privileged --name="ut-util" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} \ + bash -c "cd /neural-compressor/.azure-pipelines/scripts \ + && bash install_nc.sh \ + && bash ut/run_basic_utils.sh" + # docker cp 'ut-util':/neural-compressor/log_dir/.coverage.util $(UPLOAD_PATH)/ + ls -l $(UPLOAD_PATH) + ls -l $(DOWNLOAD_PATH) + displayName: 'Install Neural Compressor and run UT' + - task: PublishPipelineArtifact@1 + inputs: + targetPath: $(UPLOAD_PATH) + artifact: 'ut-coverage-util' + publishLocation: 'pipeline' + +- stage: Coverage + displayName: "Coverage Combine" + dependsOn: [Utils, Strategy] + jobs: + - job: CollectDatafiles + displayName: collect coverage files + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + echo y | docker system prune + displayName: 'Clean workspace' + - checkout: self + clean: true + displayName: 'Checkout out Repo' + - script: | + if [[ ! $(docker images | grep -i ${IMAGE_NAME}:${IMAGE_TAG}) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build Devel Images" + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + displayName: 'Clean Docker' + - task: DownloadPipelineArtifact@2 + inputs: + artifact: + path: $(DOWNLOAD_PATH) + - script: | + echo "------ Collecting logs ------" + echo "--- create container ---" + docker run -d -it --name="collectLogs" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash + echo "------ make coverage datas directory" + docker exec collectLogs /bin/bash +x -c "mkdir -p /neural-compressor/.azure-pipelines/scripts/ut/coverage_datas" + echo "--- copy files into container ---" + docker cp $(DOWNLOAD_PATH)/ 'collectLogs':/neural-compressor/.azure-pipelines/scripts/ut/coverage_datas/ + echo "--- docker ps ---" + docker ps + echo "--- collect logs ---" + docker exec collectLogs /bin/bash +x -c \ + "cd /neural-compressor/.azure-pipelines/scripts/ut/coverage_datas/log_dir \ + && cp ut-coverage-strategy/.coverage.strategy ./ \ + && cp ut-coverage-util/.coverage.util ./ \ + && bash /neural-compressor/.azure-pipelines/scripts/install_nc.sh \ + && export COVERAGE_RCFILE=/neural-compressor/.azure-pipelines/scripts/ut/coverage.file \ + && coverage combine --keep --rcfile=${COVERAGE_RCFILE} \ + && cp .coverage /neural-compressor/.coverage \ + && cd /neural-compressor/ && coverage report -m --rcfile=${COVERAGE_RCFILE} \ + && cat coverage_report.html" + echo "--- docker cp ---" + docker cp 'collectLogs':/neural-compressor/.azure-pipelines/scripts/ut/coverage_datas/ $(UPLOAD_PATH)/ + displayName: 'collect logs' + - task: PublishPipelineArtifact@1 + inputs: + targetPath: $(UPLOAD_PATH) + artifact: $(ARTIFACT_NAME) + publishLocation: 'pipeline' From b09b3d89f6336dee5e65c2e97c7bf52ba149fd34 Mon Sep 17 00:00:00 2001 From: Wenxin Zhang Date: Wed, 17 Aug 2022 09:41:16 +0800 Subject: [PATCH 271/271] modity --- .azure-pipelines/scripts/collect_log.sh | 12 ++ .azure-pipelines/scripts/install_nc.sh | 2 - .../scripts/install_nc_coverage.sh | 7 + .../scripts/ut/run_basic_adaptor.sh | 29 ++++ .../scripts/ut/run_basic_others.sh | 35 +++++ .azure-pipelines/ut-basic.yml | 132 ++++++++++++++++++ .azure-pipelines/ut-coverage.yml | 30 ++-- 7 files changed, 226 insertions(+), 21 deletions(-) create mode 100644 .azure-pipelines/scripts/collect_log.sh create mode 100644 .azure-pipelines/scripts/install_nc_coverage.sh create mode 100644 .azure-pipelines/scripts/ut/run_basic_adaptor.sh create mode 100644 .azure-pipelines/scripts/ut/run_basic_others.sh create mode 100644 .azure-pipelines/ut-basic.yml diff --git a/.azure-pipelines/scripts/collect_log.sh b/.azure-pipelines/scripts/collect_log.sh new file mode 100644 index 00000000000..2c36ca2afa7 --- /dev/null +++ b/.azure-pipelines/scripts/collect_log.sh @@ -0,0 +1,12 @@ + +export COVERAGE_RCFILE=/neural-compressor/.azure-pipelines/scripts/ut/coverage.file +cd /neural-compressor/log_dir +cp ut-coverage-strategy/.coverage.strategy ./ +cp ut-coverage-util/.coverage.util ./ +coverage combine --keep --rcfile=${COVERAGE_RCFILE} +cp .coverage /neural-compressor/.coverage +cd /neural-compressor +coverage report -m --rcfile=${COVERAGE_RCFILE} +coverage html -d log_dir/htmlcov --rcfile=${COVERAGE_RCFILE} +ls -l log_dir/htmlcov +cat log_dir/htmlcov/index.html diff --git a/.azure-pipelines/scripts/install_nc.sh b/.azure-pipelines/scripts/install_nc.sh index f333a42cc3a..38fd439404b 100644 --- a/.azure-pipelines/scripts/install_nc.sh +++ b/.azure-pipelines/scripts/install_nc.sh @@ -4,6 +4,4 @@ cd /neural-compressor python -m pip install --no-cache-dir -r requirements.txt python setup.py sdist bdist_wheel pip install dist/neural_compressor*.whl -pip install pytest -pip install coverage pip list \ No newline at end of file diff --git a/.azure-pipelines/scripts/install_nc_coverage.sh b/.azure-pipelines/scripts/install_nc_coverage.sh new file mode 100644 index 00000000000..63c9bdcaab9 --- /dev/null +++ b/.azure-pipelines/scripts/install_nc_coverage.sh @@ -0,0 +1,7 @@ +cd /neural-compressor +python -m pip install --no-cache-dir -r requirements.txt +python setup.py sdist bdist_wheel +pip install dist/neural_compressor*.whl +pip install pytest +pip install coverage +pip list \ No newline at end of file diff --git a/.azure-pipelines/scripts/ut/run_basic_adaptor.sh b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh new file mode 100644 index 00000000000..334be82959e --- /dev/null +++ b/.azure-pipelines/scripts/ut/run_basic_adaptor.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -x + +echo "specify fwk version..." +export tensorflow_version='2.9.1' +export pytorch_version='1.11.0+cpu' +export torchvision_version='0.12.0' +export onnx_version='1.9.0' +export onnxruntime_version='1.10.0' +export mxnet_version='1.7.0' + +echo "set up UT env..." +bash /neural-compressor/.azure-pipelines/scripts/ut/env_setup.sh + +cd /neural-compressor/test || exit 1 +find ./adaptor -name "test*.py" | sed 's,\.\/,python ,g' | sed 's/$/ --verbose/' > run.sh + +LOG_DIR=/neural-compressor/log_dir +mkdir -p ${LOG_DIR} +ut_log_name=${LOG_DIR}/ut_tf_${tensorflow_version}_pt_${pytorch_version}.log + +echo "cat run.sh..." +cat run.sh | tee ${ut_log_name} +echo "-------------" +bash run.sh 2>&1 | tee -a ${ut_log_name} + +if [ $(grep -c "FAILED" ${ut_log_name}) != 0 ] || [ $(grep -c "OK" ${ut_log_name}) == 0 ];then + exit 1 +fi \ No newline at end of file diff --git a/.azure-pipelines/scripts/ut/run_basic_others.sh b/.azure-pipelines/scripts/ut/run_basic_others.sh new file mode 100644 index 00000000000..5cd2e39d1e5 --- /dev/null +++ b/.azure-pipelines/scripts/ut/run_basic_others.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -x +python -c "import neural_compressor as nc;print(nc.version.__version__)" +echo "run basic" + +echo "specify fwk version..." +export tensorflow_version='2.9.1' +export pytorch_version='1.11.0+cpu' +export torchvision_version='0.12.0' +export onnx_version='1.9.0' +export onnxruntime_version='1.10.0' +export mxnet_version='1.7.0' + +echo "set up UT env..." +bash /neural-compressor/.azure-pipelines/scripts/ut/env_setup.sh + +cd /neural-compressor/test || exit 1 +find . -name "test*.py" | sed 's,\.\/,python ,g' | sed 's/$/ --verbose/' > run.sh +sed -i '/ adaptor\//d' run.sh +sed -i '/ tfnewapi\//d' run.sh +sed -i '/ ux\//d' run.sh +sed -i '/ neural_coder\//d' run.sh + +LOG_DIR=/neural-compressor/log_dir +mkdir -p ${LOG_DIR} +ut_log_name=${LOG_DIR}/ut_tf_${tensorflow_version}_pt_${pytorch_version}.log + +echo "cat run.sh..." +cat run.sh | tee ${ut_log_name} +echo "-------------" +bash run.sh 2>&1 | tee -a ${ut_log_name} + +if [ $(grep -c "FAILED" ${ut_log_name}) != 0 ] || [ $(grep -c "OK" ${ut_log_name}) == 0 ];then + exit 1 +fi \ No newline at end of file diff --git a/.azure-pipelines/ut-basic.yml b/.azure-pipelines/ut-basic.yml new file mode 100644 index 00000000000..4e7ec62d2bc --- /dev/null +++ b/.azure-pipelines/ut-basic.yml @@ -0,0 +1,132 @@ +trigger: none + +pr: + branches: + include: + - master + paths: + include: + - neural_compressor + exclude: + - neural_compressor/ux + +pool: suyue-test + +variables: + IMAGE_NAME: 'neural-compressor' + IMAGE_TAG: 'py38' + +stages: +- stage: + displayName: Unit Test FWKs adaptor + dependsOn: [] + jobs: + - job: + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + displayName: 'Clean workspace' + + - checkout: self + displayName: "Checkout out Repo" + + - script: | + if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build develop docker image" + + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + env | sort + displayName: 'Clean docker' + + - script: | + docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} \ + bash -c "cd /neural-compressor/.azure-pipelines/scripts \ + && bash install_nc.sh \ + && bash ut/run_basic_adaptor.sh" + displayName: 'Install Neural Compressor and run UT' + +- stage: + displayName: Unit Test tf newAPI + dependsOn: [] + jobs: + - job: + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + displayName: 'Clean workspace' + + - checkout: self + displayName: "Checkout out Repo" + + - script: | + if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build develop docker image" + + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + env | sort + displayName: 'Clean docker' + + - script: | + docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor -v /tf_dataset:/tf_dataset ${IMAGE_NAME}:${IMAGE_TAG} \ + bash -c "cd /neural-compressor/.azure-pipelines/scripts \ + && bash install_nc.sh \ + && bash ut/run_basic_adaptor_tfnewapi.sh" + displayName: 'Install Neural Compressor and run UT' + +- stage: + displayName: Unit Test other basic case + dependsOn: [] + jobs: + - job: + steps: + - script: | + echo ${BUILD_SOURCESDIRECTORY} + sudo rm -fr ${BUILD_SOURCESDIRECTORY} || true + displayName: 'Clean workspace' + + - checkout: self + displayName: "Checkout out Repo" + + - script: | + if [[ ! $(docker images | grep -i '${IMAGE_NAME}:${IMAGE_TAG}' ) ]]; then + docker build -f ${BUILD_SOURCESDIRECTORY}/.azure-pipelines/docker/Dockerfile.devel -t ${IMAGE_NAME}:${IMAGE_TAG} . + fi + docker images | grep -i ${IMAGE_NAME} + if [[ $? -ne 0 ]]; then + echo "NO Such Image ${IMAGE_NAME}" + exit 1 + fi + displayName: "Build develop docker image" + + - script: | + docker stop $(docker ps -aq) + docker rm -vf $(docker ps -aq) || true + env | sort + displayName: 'Clean docker' + + - script: | + docker run --disable-content-trust --privileged --name="pr" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} \ + bash -c "cd /neural-compressor/.azure-pipelines/scripts \ + && bash install_nc.sh \ + && bash ut/run_basic_others.sh" + displayName: 'Install Neural Compressor and run UT' diff --git a/.azure-pipelines/ut-coverage.yml b/.azure-pipelines/ut-coverage.yml index c852011966c..9c968673edb 100644 --- a/.azure-pipelines/ut-coverage.yml +++ b/.azure-pipelines/ut-coverage.yml @@ -12,7 +12,7 @@ variables: DOWNLOAD_PATH: $(Build.SourcesDirectory)/log_dir OS: 'linux' PLATFORM: 'clx8280' - ARTIFACT_NAME: 'UT_coverage_log' + ARTIFACT_NAME: 'UT_coverage_report' stages: - stage: Strategy @@ -49,7 +49,7 @@ stages: - script: | docker run --disable-content-trust --privileged --name="ut-stra" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} \ bash -c "cd /neural-compressor/.azure-pipelines/scripts \ - && bash install_nc.sh \ + && bash install_nc_coverage.sh \ && bash ut/run_basic_strategy.sh" # docker cp 'ut-stra':/neural-compressor/log_dir/.coverage.strategy $(UPLOAD_PATH)/ ls -l $(UPLOAD_PATH) @@ -95,7 +95,7 @@ stages: - script: | docker run --disable-content-trust --privileged --name="ut-util" --hostname="pr-host" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} \ bash -c "cd /neural-compressor/.azure-pipelines/scripts \ - && bash install_nc.sh \ + && bash install_nc_coverage.sh \ && bash ut/run_basic_utils.sh" # docker cp 'ut-util':/neural-compressor/log_dir/.coverage.util $(UPLOAD_PATH)/ ls -l $(UPLOAD_PATH) @@ -144,25 +144,17 @@ stages: echo "------ Collecting logs ------" echo "--- create container ---" docker run -d -it --name="collectLogs" -v ${BUILD_SOURCESDIRECTORY}:/neural-compressor ${IMAGE_NAME}:${IMAGE_TAG} /bin/bash - echo "------ make coverage datas directory" - docker exec collectLogs /bin/bash +x -c "mkdir -p /neural-compressor/.azure-pipelines/scripts/ut/coverage_datas" - echo "--- copy files into container ---" - docker cp $(DOWNLOAD_PATH)/ 'collectLogs':/neural-compressor/.azure-pipelines/scripts/ut/coverage_datas/ + #echo "------ make coverage datas directory" + #docker exec collectLogs /bin/bash +x -c "mkdir -p /neural-compressor/.azure-pipelines/scripts/ut/coverage_datas" + #echo "--- copy files into container ---" + #docker cp $(DOWNLOAD_PATH)/ 'collectLogs':/neural-compressor/log_dir echo "--- docker ps ---" docker ps echo "--- collect logs ---" - docker exec collectLogs /bin/bash +x -c \ - "cd /neural-compressor/.azure-pipelines/scripts/ut/coverage_datas/log_dir \ - && cp ut-coverage-strategy/.coverage.strategy ./ \ - && cp ut-coverage-util/.coverage.util ./ \ - && bash /neural-compressor/.azure-pipelines/scripts/install_nc.sh \ - && export COVERAGE_RCFILE=/neural-compressor/.azure-pipelines/scripts/ut/coverage.file \ - && coverage combine --keep --rcfile=${COVERAGE_RCFILE} \ - && cp .coverage /neural-compressor/.coverage \ - && cd /neural-compressor/ && coverage report -m --rcfile=${COVERAGE_RCFILE} \ - && cat coverage_report.html" - echo "--- docker cp ---" - docker cp 'collectLogs':/neural-compressor/.azure-pipelines/scripts/ut/coverage_datas/ $(UPLOAD_PATH)/ + docker exec collectLogs /bin/bash +x -c "cd /neural-compressor/.azure-pipelines/scripts \ + && bash install_nc_coverage.sh \ + && bash collect_log.sh" + #docker cp 'collectLogs':/neural-compressor/log_dir/htmlcov $(UPLOAD_PATH)/htmlcov displayName: 'collect logs' - task: PublishPipelineArtifact@1 inputs: