Skip to content

Commit

Permalink
Merge pull request #18 from CybercentreCanada/feature/updated_python_…
Browse files Browse the repository at this point in the history
…debian

Use python 3.9
  • Loading branch information
cccs-sgaron authored Jul 29, 2021
2 parents f52810c + d1d19e0 commit 51aaf9c
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 116 deletions.
140 changes: 52 additions & 88 deletions pipelines/azure-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,93 +6,57 @@ trigger:
pr: none

pool:
vmImage: 'ubuntu-18.04'
vmImage: "ubuntu-20.04"

stages:
- stage: build
jobs:
- job: build_package
displayName: Build Package
steps:
- task: UsePythonVersion@0
displayName: Set python version
inputs: {versionSpec: 3.8}
- script: |
export VERSION=${BUILD_SOURCEBRANCH#"refs/tags/v"}
export COMMIT=`git rev-parse --verify ${BUILD_SOURCEBRANCH}`
export BRANCH=`git ls-remote --heads origin | grep $COMMIT | sed "s/.*\///"`
echo "Building $VERSION On branch $BRANCH"
if [[ "$VERSION" == *stable* ]] && [[ $BRANCH != "master" ]]; then exit 1; fi
if [[ "$VERSION" == *dev* ]] && [[ $BRANCH != "dev" ]]; then exit 1; fi
export VERSION=${VERSION/stable}
export VERSION=${VERSION/beta/b}
echo $VERSION > assemblyline_service_client/VERSION
sudo env "PATH=$PATH" python -m pip install --no-cache-dir -U wheel cython pip
python setup.py bdist_wheel
- publish: $(System.DefaultWorkingDirectory)/dist/
artifact: dist
# - publish: $(System.DefaultWorkingDirectory)/test/
# artifact: test
#- stage: test
# jobs:
# - job: run_test
# strategy:
# matrix:
# python3_7:
# python.version: '3.7'
# Python3_8:
# python.version: '3.8'
# timeoutInMinutes: 10
# steps:
# - checkout: none
# - task: UsePythonVersion@0
# displayName: Set python version
# inputs:
# versionSpec: '$(python.version)'
# - download: current
# artifact: dist
# - download: current
# artifact: test
# - script: |
# set -x # Echo commands before they are run
# sudo apt-get update
# sudo apt-get install -y build-essential libffi-dev libfuzzy-dev python3-dev
# export VERSION=${BUILD_SOURCEBRANCH#"refs/tags/v"}
# sudo -E env "PATH=$PATH" python -m pip install --no-cache-dir -f $(Pipeline.Workspace)/dist/ "assemblyline-service-client==${VERSION}" -r $(Pipeline.Workspace)/test/requirements.txt
# sudo mkdir -p /etc/assemblyline/
# sudo mkdir -p /var/cache/assemblyline/
# sudo chmod a+rw /var/cache/assemblyline/
# sudo cp $(Pipeline.Workspace)/pipelines/config.yml /etc/assemblyline
# displayName: Install package
# - script: pytest -rsx -vv
# workingDirectory: $(Pipeline.Workspace)/test
# displayName: Test
- stage: deploy
jobs:
- job: deploy
displayName: Deploy packages and containers
variables:
- group: deployment-information
steps:
- download: current
artifact: dist
- script: |
set -xv # Echo commands before they are run
sudo env "PATH=$PATH" python -m pip install --no-cache-dir twine
ls dist
twine upload --skip-existing --repository-url $TEST_REPOSITORY_URL dist/*
workingDirectory: $(Pipeline.Workspace)
displayName: Deploy to Test PyPI
env:
TWINE_USERNAME: $(twineUsername)
TWINE_PASSWORD: $(twinePassword)
- script: |
set -xv # Echo commands before they are run
sudo env "PATH=$PATH" python -m pip install --no-cache-dir twine
ls dist
twine upload --skip-existing dist/*
workingDirectory: $(Pipeline.Workspace)
displayName: Deploy to PyPI
env:
TWINE_USERNAME: $(twineUsername)
TWINE_PASSWORD: $(twinePassword)
- stage: build
jobs:
- job: build_package
displayName: Build Package
steps:
- task: UsePythonVersion@0
displayName: Set python version
inputs: { versionSpec: 3.9 }
- script: |
export VERSION=${BUILD_SOURCEBRANCH#"refs/tags/v"}
export COMMIT=`git rev-parse --verify ${BUILD_SOURCEBRANCH}`
export BRANCH=`git ls-remote --heads origin | grep $COMMIT | sed "s/.*\///"`
echo "Building $VERSION On branch $BRANCH"
if [[ "$VERSION" == *stable* ]] && [[ $BRANCH != "master" ]]; then exit 1; fi
if [[ "$VERSION" == *dev* ]] && [[ $BRANCH != "dev" ]]; then exit 1; fi
export VERSION=${VERSION/stable}
export VERSION=${VERSION/beta/b}
echo $VERSION > assemblyline_service_client/VERSION
sudo env "PATH=$PATH" python -m pip install --no-cache-dir -U wheel cython pip
python setup.py bdist_wheel
- publish: $(System.DefaultWorkingDirectory)/dist/
artifact: dist
- stage: deploy
jobs:
- job: deploy
displayName: Deploy packages and containers
variables:
- group: deployment-information
steps:
- download: current
artifact: dist
- script: |
set -xv # Echo commands before they are run
sudo env "PATH=$PATH" python -m pip install --no-cache-dir twine
ls dist
twine upload --skip-existing --repository-url $TEST_REPOSITORY_URL dist/*
workingDirectory: $(Pipeline.Workspace)
displayName: Deploy to Test PyPI
env:
TWINE_USERNAME: $(twineUsername)
TWINE_PASSWORD: $(twinePassword)
- script: |
set -xv # Echo commands before they are run
sudo env "PATH=$PATH" python -m pip install --no-cache-dir twine
ls dist
twine upload --skip-existing dist/*
workingDirectory: $(Pipeline.Workspace)
displayName: Deploy to PyPI
env:
TWINE_USERNAME: $(twineUsername)
TWINE_PASSWORD: $(twinePassword)
54 changes: 27 additions & 27 deletions pipelines/azure-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,34 @@ trigger: ["*"]
pr: ["*"]

pool:
vmImage: 'ubuntu-18.04'
vmImage: "ubuntu-20.04"

jobs:
- job: run_test
strategy:
matrix:
python3_7:
python.version: '3.7'
Python3_8:
python.version: '3.8'
- job: run_test
strategy:
matrix:
python3_9:
python.version: "3.9"
# Python3_10:
# python.version: '3.10'

timeoutInMinutes: 10
timeoutInMinutes: 10

steps:
- task: UsePythonVersion@0
displayName: Set python version
inputs:
versionSpec: '$(python.version)'
- script: |
sudo mkdir -p /etc/assemblyline/
sudo mkdir -p /var/cache/assemblyline/
sudo cp pipelines/config.yml /etc/assemblyline
sudo chmod a+rw /var/cache/assemblyline/
sudo apt-get update
sudo apt-get install -y build-essential libffi-dev libfuzzy-dev python3-dev
sudo env "PATH=$PATH" python -m pip install --no-cache-dir -U pip cython setuptools
sudo env "PATH=$PATH" python -m pip install --no-cache-dir -e .
sudo env "PATH=$PATH" python -m pip install --no-cache-dir -r test/requirements.txt
displayName: Setup environment
- script: python -m pytest -rsx -vv
displayName: Test
steps:
- task: UsePythonVersion@0
displayName: Set python version
inputs:
versionSpec: "$(python.version)"
- script: |
sudo mkdir -p /etc/assemblyline/
sudo mkdir -p /var/cache/assemblyline/
sudo cp pipelines/config.yml /etc/assemblyline
sudo chmod a+rw /var/cache/assemblyline/
sudo apt-get update
sudo apt-get install -y build-essential libffi-dev libfuzzy-dev python3-dev
sudo env "PATH=$PATH" python -m pip install --no-cache-dir -U pip cython setuptools
sudo env "PATH=$PATH" python -m pip install --no-cache-dir -e .
sudo env "PATH=$PATH" python -m pip install --no-cache-dir -r test/requirements.txt
displayName: Setup environment
- script: python -m pytest -rsx -vv
displayName: Test
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@
author_email="[email protected]",
license="MIT",
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
],
keywords="assemblyline automated malware analysis gc canada cse-cst cse cst cyber cccs",
packages=find_packages(exclude=['test/*']),
Expand Down

0 comments on commit 51aaf9c

Please sign in to comment.