Skip to content

Commit bf57afd

Browse files
committed
done
1 parent 8593185 commit bf57afd

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed

.devcontainer/ADO_agent/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# You can pick any Debian/Ubuntu-based image. 😊
2+
FROM mcr.microsoft.com/vscode/devcontainers/base:bullseye
3+
4+
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
5+
ARG USERNAME=vscode
6+
ARG USER_UID=1000
7+
ARG USER_GID=$USER_UID
8+
COPY scripts/*.sh /tmp/scripts/
9+
10+
# cd into the user directory, download and unzip the Azure DevOps agent
11+
RUN cd /home/vscode && mkdir azure-pipelines && cd azure-pipelines
12+
13+
# input ADO agent version argument
14+
ARG AGENT_VERSION=2.218.1
15+
16+
# download, extract and install dependencies for Azure DevOps Pipelines Agent
17+
RUN cd /home/vscode/azure-pipelines \
18+
&& curl -O -L https://vstsagentpackage.azureedge.net/agent/${AGENT_VERSION}/vsts-agent-linux-x64-${AGENT_VERSION}.tar.gz \
19+
&& tar xzf /home/vscode/azure-pipelines/vsts-agent-linux-x64-${AGENT_VERSION}.tar.gz \
20+
&& /home/vscode/azure-pipelines/bin/installdependencies.sh
21+
22+
# copy over the start.sh script
23+
COPY scripts/start.sh /home/vscode/azure-pipelines/start.sh
24+
25+
# Apply ownership of home folder
26+
RUN chown -R vscode ~vscode
27+
28+
# make the script executable
29+
RUN chmod +x /home/vscode/azure-pipelines/start.sh
30+
31+
# Clean up
32+
RUN rm -rf /var/lib/apt/lists/* /tmp/scripts
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "AzurePipelines",
3+
"dockerFile": "Dockerfile",
4+
5+
// Configure tool-specific properties.
6+
"customizations": {
7+
// Configure properties specific to VS Code.
8+
"vscode": {
9+
// Add the IDs of extensions you want installed when the container is created.
10+
"extensions": [
11+
"ms-vscode.azurecli",
12+
"ms-vscode.powershell",
13+
"hashicorp.terraform",
14+
"tfsec.tfsec",
15+
"esbenp.prettier-vscode"
16+
]
17+
}
18+
},
19+
20+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
21+
// "forwardPorts": [],
22+
23+
// Use 'postStartCommand' to run commands each time the container is successfully started..
24+
"postStartCommand": "/home/vscode/azure-pipelines/start.sh",
25+
26+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
27+
"remoteUser": "vscode",
28+
// Amend GitHub runner version with 'RUNNER_VERSION'. https://github.com/actions/runner/releases.
29+
//"build": {
30+
//"args": {
31+
//"X": "y"
32+
//}
33+
//},
34+
"features": {
35+
"ghcr.io/devcontainers/features/common-utils:2": {},
36+
"ghcr.io/lukewiwa/features/shellcheck:0": {},
37+
"ghcr.io/devcontainers/features/github-cli:1": {}
38+
}
39+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
ADO_ORG=$ADO_ORG
4+
ADO_PAT=$ADO_PAT
5+
ADO_POOL_NAME=$ADO_POOL_NAME
6+
7+
HOSTNAME=$(hostname)
8+
AGENT_SUFFIX="ADO-agent"
9+
AGENT_NAME="${HOSTNAME}-${AGENT_SUFFIX}"
10+
ADO_URL="https://dev.azure.com/${ADO_ORG}"
11+
USER_NAME_LABEL=$( (git config --get user.name) | sed -e 's/ //g')
12+
#REPO_NAME_LABEL="$GH_REPOSITORY"
13+
14+
# !!!Ignore sensitive tokens from capabilities!!!
15+
export VSO_AGENT_IGNORE=ADO_PAT,GH_TOKEN,GITHUB_CODESPACE_TOKEN,GITHUB_TOKEN
16+
17+
/home/vscode/azure-pipelines/config.sh --unattended \
18+
--agent "${AGENT_NAME}" \
19+
--url "${ADO_URL}" \
20+
--auth PAT \
21+
--token "${ADO_PAT}" \
22+
--pool "${ADO_POOL_NAME}" \
23+
--acceptTeeEula
24+
25+
/home/vscode/azure-pipelines/run.sh

0 commit comments

Comments
 (0)