Skip to content

Commit 907fbf8

Browse files
authored
Merge bb5793f into 2e0af2f
2 parents 2e0af2f + bb5793f commit 907fbf8

File tree

10 files changed

+98
-44
lines changed

10 files changed

+98
-44
lines changed

.vsts/darwin/darwin-dependencies.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
steps:
22
- template: ../dependencies.yml
3-
- template: ../pyenv.yml
43
- script: |
54
set -e
6-
. "$(Agent.WorkFolder)/.venv/batchexplorer/bin/activate"
7-
python --version
8-
pip install -r python/requirements.txt
95
echo "Node.js version $(node --version)"
106
echo "NPM version $(npm --version)"
117
npm ci

.vsts/dependencies.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ steps:
22
- powershell: ./scripts/azpipelines/build-type.ps1 "$(Build.SourceBranch)" "$(Build.BuildNumber)"
33
displayName: Resolve build type
44

5-
- task: NodeTool@0
6-
inputs:
7-
versionSpec: '16.x.x'
5+
- template: ./node-setup.yml
6+
- template: ./python-setup.yml

.vsts/linux/linux-dependencies.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@ steps:
88
sudo apt-get install -y libxkbfile-dev pkg-config libsecret-1-dev libxss1 libgconf-2-4 dbus xvfb libgtk-3-0 rpm
99
displayName: Install Linux packages
1010
- template: ../dependencies.yml
11-
- template: ../pyenv.yml
1211
- script: |
1312
set -e
14-
. "$(Agent.WorkFolder)/.venv/batchexplorer/bin/activate"
15-
echo "Python version $(python --version)"
16-
pip install -r python/requirements.txt
1713
echo "Node.js version $(node --version)"
1814
echo "NPM version $(npm --version)"
1915
npm install -g codecov

.vsts/node-setup.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
steps:
2+
- task: NodeTool@0
3+
inputs:
4+
versionSpec: '16.x.x'
5+
6+
- script: |
7+
cp .vsts/pipelines.npmrc .npmrc
8+
displayName: Stage .npmrc configuration
9+
10+
- task: npmAuthenticate@0
11+
displayName: Authenticate with NPM private feed
12+
inputs:
13+
workingFile: .npmrc

.vsts/pipelines.npmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
registry=https://azurebatch.pkgs.visualstudio.com/_packaging/BatchExplorer/npm/registry/
2+
3+
always-auth=true

.vsts/pyenv.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.vsts/python-setup.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
steps:
2+
- task: UsePythonVersion@0
3+
condition: eq( variables['Agent.OS'], 'Windows_NT' )
4+
inputs:
5+
versionSpec: '3.8.x'
6+
displayName: Install Python 3.8 for Batch Explorer
7+
8+
- bash: ./scripts/azpipelines/setup-python.sh
9+
displayName: Set up Python environment and private feed
10+
11+
- task: PipAuthenticate@1
12+
displayName: 'Pip Authenticate'
13+
inputs:
14+
artifactFeeds: 'BatchExplorer'
15+
16+
- script: |
17+
set -e
18+
. "$(Agent.WorkFolder)/.venv/batchexplorer/bin/activate"
19+
pip install -r python/requirements.txt
20+
condition: ne( variables['Agent.OS'], 'Windows_NT' )
21+
displayName: Install Python dependencies
22+
23+
- powershell: |
24+
. .vsts/win/exec.ps1
25+
$ErrorActionPreference = "Stop"
26+
$(Agent.WorkFolder)\.venv\batchexplorer\Scripts\Activate.ps1
27+
exec { pip install -r python/requirements.txt }
28+
condition: eq( variables['Agent.OS'], 'Windows_NT' )
29+
displayName: Install Python dependencies

.vsts/update-en-loc.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ pool:
66
demands:
77
- ImageOverride -equals BatchExplorerBuildImage-Linux
88
steps:
9-
- task: NodeTool@0
10-
inputs:
11-
versionSpec: '16.x.x'
9+
- template: ./node-setup.yml
1210

1311
- script: npm ci
1412
displayName: Install dependencies

.vsts/win/win-dependencies.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
steps:
22
- template: ../dependencies.yml
33

4-
- task: UsePythonVersion@0
5-
inputs:
6-
versionSpec: '3.8.x'
7-
displayName: Install python 3.8 for BatchExplorer
8-
94
# KLUDGE: Use `npm i` instead of `npm ci` due to this issue:
105
# https://github.com/npm/cli/issues/558#issuecomment-580392554
116
- powershell: |
127
. .vsts/win/exec.ps1
138
$ErrorActionPreference = "Stop"
14-
exec { python -m pip install --upgrade pip }
15-
exec { python --version }
16-
exec { pip install -r python/requirements.txt }
179
exec { Write-Host "Node.js version" $(node --version) }
1810
exec { Write-Host "NPM version" $(npm --version) }
1911
exec { npm install --loglevel=error }
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
pyroot="$AGENT_WORKFOLDER/.venv/batchexplorer"
6+
7+
if [ "$AGENT_OS" == "Windows_NT" ]; then
8+
# Python is already installed via a pipeline task
9+
conf_file="$pyroot/pip.ini"
10+
else
11+
conf_file="$pyroot/pip.conf"
12+
python_version=3.8.5
13+
14+
echo "Installing pyenv..."
15+
export PYENV_ROOT="$AGENT_WORKFOLDER/.pyenv"
16+
archive="$PYENV_ROOT/pyenv.tar.gz"
17+
mkdir -p "$PYENV_ROOT"
18+
curl -s -S -L "https://github.com/pyenv/pyenv/archive/v1.2.20.tar.gz" > "$archive"
19+
echo "5ecd10d3ec502ce9b7d8109fbe8cb2e4a8af8b73ce5c216b8e268452724a65f3 $archive" | shasum -c
20+
tar xzf "$archive" -C "$PYENV_ROOT" --strip-components=1
21+
export PATH="$PYENV_ROOT/bin:$PATH"
22+
pyenv --version
23+
24+
echo "Installing Python $python_version..."
25+
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $python_version
26+
pyenv global 3.8.5
27+
eval "$(pyenv init -)"
28+
echo "##vso[task.prependpath]$PYENV_ROOT/bin"
29+
echo "##vso[task.prependpath]$PYENV_ROOT/shims"
30+
fi
31+
32+
echo "Setting up Python virtual environment..."
33+
python -m venv "$pyroot"
34+
if [ "$AGENT_OS" == "Windows_NT" ]; then
35+
"$pyroot/Scripts/activate"
36+
else
37+
source "$pyroot/bin/activate"
38+
fi
39+
echo "Path is $PATH"
40+
41+
echo "Upgrading pip..."
42+
python -m pip install --upgrade pip
43+
pip install keyring artifacts-keyring
44+
45+
echo "Configuring private feed..."
46+
# If the target conf file doesn't exist, pip config creates one at the user dir.
47+
# This doesn't matter all that much for build agents.
48+
touch "$conf_file"
49+
pip config set global.index-url https://azurebatch.pkgs.visualstudio.com/_packaging/BatchExplorer/pypi/simple/
50+
pip config list

0 commit comments

Comments
 (0)