Skip to content

Commit

Permalink
v1.0.10 (#14)
Browse files Browse the repository at this point in the history
* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* Update azure-pipelines.yml for Azure Pipelines

* update tests

* initial devcontainer push

* tlstestgate works

* Update azure-pipelines.yml for Azure Pipelines

* fix windows unit test

* Set up CI with Azure Pipelines

[skip ci]

* Update azure-pipelines.yml for Azure Pipelines

* update dependencies and fix test

* fix ci tests

* fix ci

* remove is-ip as a dependency

* remove temp file

* add eslint

* update changelog

* fix pipeline

* fix ci

* fix ci
  • Loading branch information
gattjoe committed Apr 11, 2022
1 parent 6657f01 commit 962391b
Show file tree
Hide file tree
Showing 14 changed files with 1,676 additions and 5,229 deletions.
11 changes: 3 additions & 8 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,9 @@
// Add the IDs of extensions you want installed when the container is created.
"extensions": ["ms-python.vscode-pylance",
"visualstudioexptteam.vscodeintellicode",
"ms-azuretools.vscode-docker"],


// Uncomment the next line to run commands after the container is created - for example installing curl.
// "postCreateCommand": "apt-get update && apt-get install -y curl",

// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
"ms-azuretools.vscode-docker",
"eamodio.gitlens",
"dbaeumer.vscode-eslint"],

// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "tlstestgate"
Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,12 @@
- Changed minimum Azure Pipeline Agent version to 2.144.0 in support of Node10
- Updated azure-pipelines-task-lib and azure-pipelines-tool-lib to latest version
- Formatted python files with black and linted with pylint
- Fixed test case that purposely failed resolving bbbbbbbbbbbbbbb.com because someone out there is now using it
- Fixed test case that purposely failed resolving bbbbbbbbbbbbbbb.com because someone out there is now using it

# v1.0.10
- Align changelog version scheme with Azure DevOps Marketplace
- Removed chai, mocha, tfx-cli, ts-node, and typescript from dev-dependencies and moved install into Dockerfile
- Added eslint to project and pipelines
- Updated SSLyze to 5.0.3 for Python 3.10 support
- Removed is-Ip TypeScript dependency
- Fixed test case that purposely failed resolving bbbbbbbbbbbbbbbbbbbbbbbbb.com because someone out there is now using it
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
# Install TlsTestGate Packages
COPY --chown=tlstestgate:tlstestgate . /home/tlstestgate/TlsTestGate/
RUN cd TlsTestGate/buildAndReleaseTask && npm install
RUN cd TlsTestGate/buildAndReleaseTask && npm install -g chai \
eslint \
mocha \
tfx-cli \
ts-node \
typescript
RUN cd TlsTestGate && pip install --no-cache-dir --quiet -r requirements.txt

CMD [ "bash" ]
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ cd buildAndReleaseTask
npm init
npm install azure-pipelines-task-lib
npm install azure-pipelines-tool-lib
npm install is-ip
npm install @types/node --save-dev
npm install @types/q --save-dev
```
Expand All @@ -107,7 +106,7 @@ cd buildAndReleaseTask
export INPUT_BASEURL = github.com
export INPUT_PORT = 443
export INPUT_DNSSERVER = 8.8.8.8
export INPUT_DECISION = false
export INPUT_FAILBUILD = false
node tlstestgate.js
```

Expand Down
39 changes: 33 additions & 6 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# 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
# Tests
# Python:
# Ensure scanner is working on Python 3.7 - 3.10
# Node:
# Ensure getPythonPath.ts functionality is working


stages:
- stage: 'Python_Tests'
Expand All @@ -18,6 +20,8 @@ stages:
python.version: '3.8'
Python39:
python.version: '3.9'
Python310:
python.version: '3.10'

steps:
- task: UsePythonVersion@0
Expand Down Expand Up @@ -54,7 +58,15 @@ stages:

steps:
- task: Npm@1
displayName: 'npm install'
displayName: 'npm install base tools'
inputs:
command: 'custom'
workingDir: buildAndReleaseTask
customCommand: 'install chai mocha ts-node eslint'
verbose: false

- task: Npm@1
displayName: 'npm install TlsTestGate'
inputs:
workingDir: buildAndReleaseTask
verbose: false
Expand All @@ -79,6 +91,14 @@ stages:
demands: npm

steps:
- task: Npm@1
displayName: 'npm install base tools'
inputs:
command: 'custom'
workingDir: buildAndReleaseTask
customCommand: 'install chai mocha ts-node eslint'
verbose: false

- task: Npm@1
displayName: 'npm install'
inputs:
Expand All @@ -93,7 +113,6 @@ stages:
customCommand: 'test'
verbose: true


- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
Expand All @@ -106,6 +125,14 @@ stages:
demands: npm

steps:
- task: Npm@1
displayName: 'npm install base tools'
inputs:
command: 'custom'
workingDir: buildAndReleaseTask
customCommand: 'install chai mocha ts-node eslint'
verbose: false

- task: Npm@1
displayName: 'npm install'
inputs:
Expand Down
15 changes: 7 additions & 8 deletions buildAndReleaseTask/getpythonpath.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/* tslint:disable:linebreak-style no-unsafe-any no-submodule-imports export-name no-unnecessary-local-variable no-console */
/**
* Python locater
*/

import * as tl from 'azure-pipelines-task-lib/task';
import { exist, which, tool as tool_1 } from 'azure-pipelines-task-lib/task';
import * as trm from 'azure-pipelines-task-lib/toolrunner';
import * as tool from 'azure-pipelines-tool-lib/tool';
import * as path from 'path';
Expand All @@ -13,23 +12,23 @@ https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/use-python-ve

export async function getPythonPath(): Promise<string> {

if (tl.exist('C:/hostedtoolcache/windows')) {
if (exist('C:/hostedtoolcache/windows')) {
// Windows
console.log('AGENT: Extension running on a Microsoft hosted Agent.');
const baseDir: string = tool.findLocalTool('python', '3.8');
const pythonPath: string = path.join(baseDir, 'python.exe');

return pythonPath;

} else if (tl.exist('/opt/hostedtoolcache')) {
} else if (exist('/opt/hostedtoolcache')) {
// Linux
console.log('AGENT: Extension running on a Microsoft hosted Agent.');
const baseDir: string = tool.findLocalTool('Python', '3.8');
const pythonPath: string = path.join(baseDir, '/bin/python3');

return pythonPath;

} else if (tl.exist('/Users/runner/hostedtoolcache')) {
} else if (exist('/Users/runner/hostedtoolcache')) {
// OS X
console.log('AGENT: Extension running on a Microsoft hosted Agent.');
const baseDir: string = tool.findLocalTool('Python', '3.8');
Expand All @@ -45,7 +44,7 @@ export async function getPythonPath(): Promise<string> {

return pythonPath;

} catch (err: any) {
} catch (err: any) { // eslint-disable-line @typescript-eslint/no-explicit-any

return err;
}
Expand All @@ -58,10 +57,10 @@ export async function getPythonPath(): Promise<string> {
*/
async function getSelfHostedPythonPath(): Promise<string> {

const selfHostedPythonPath: string = tl.which('python3', true);
const selfHostedPythonPath: string = which('python3', true);

if (selfHostedPythonPath != null) {
const pythonVer: trm.ToolRunner = tl.tool(selfHostedPythonPath);
const pythonVer: trm.ToolRunner = tool_1(selfHostedPythonPath);
pythonVer.arg('-c');
pythonVer.arg('import platform; print(platform.python_version())');
// https://github.com/microsoft/azure-pipelines-task-lib/blob/master/node/docs/azure-pipelines-task-lib.md
Expand Down
Loading

0 comments on commit 962391b

Please sign in to comment.