Skip to content

Commit

Permalink
Merge pull request #17 from ayoussef-insight/fix/agent-name
Browse files Browse the repository at this point in the history
Update agent host name
  • Loading branch information
ayoussef-insight authored Jun 19, 2024
2 parents 06a928e + 662af90 commit 3e59e04
Show file tree
Hide file tree
Showing 18 changed files with 41 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/images/ado-agent-linux/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
NAME=ado-agent-linux
NAME=
AZP_URL=https://dev.azure.com/ayoussef-insight/
AZP_TOKEN=
AZP_POOL=ado-agent-linux-pool
4 changes: 4 additions & 0 deletions src/images/ado-agent-linux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ choosing "Show all scopes".
```bash
docker-compose up --build -d --scale agent=2
```
For ARM64 architecture, use the following command:
```bash
docker-compose -f docker-compose-arm64.yml up --build -d --scale agent=2
```

### Start from docker

Expand Down
2 changes: 1 addition & 1 deletion src/images/ado-agent-linux/docker-compose-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
context: .
args:
- ARCH=arm64
- AGENT_VERSION=3.224.1
- AGENT_VERSION=3.240.1
env_file:
- .env
volumes:
Expand Down
2 changes: 1 addition & 1 deletion src/images/ado-agent-linux/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
context: .
args:
- ARCH=amd64
- AGENT_VERSION=3.224.1
- AGENT_VERSION=3.240.1
env_file:
- .env
volumes:
Expand Down
2 changes: 1 addition & 1 deletion src/images/ado-agent-linux/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ trap 'cleanup; exit 143' TERM
print_header "1. Configuring Azure Pipelines agent..."

./config.sh --unattended \
--agent "${NAME:-$(hostname)}" \
--agent "${NAME:-$HOSTNAME}" \
--url "$AZP_URL" \
--auth PAT \
--token $(cat "$AZP_TOKEN_FILE") \
Expand Down
2 changes: 1 addition & 1 deletion src/images/ado-agent-win/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
NAME=ado-agent-win
NAME=
AZP_URL=https://dev.azure.com/ayoussef-insight/
AZP_TOKEN=
AZP_POOL=ado-agent-win-pool
4 changes: 2 additions & 2 deletions src/images/ado-agent-win/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ RUN (New-Object Net.WebClient).DownloadFile('https://dot.net/v1/dotnet-install.p
if (-not $currentPath.Contains($installPath)) { setx PATH ($currentPath + ';' + $installPath) } ; \
if (-not $env:path.Contains($installPath)) { $env:path += ';' + $installPath }

# Install Node 18
RUN (New-Object Net.WebClient).DownloadFile('https://nodejs.org/dist/v18.16.1/node-v18.16.1-x64.msi', '.\node.msi'); \
# Install Node 20
RUN (New-Object Net.WebClient).DownloadFile('https://nodejs.org/dist/v20.14.0/node-v20.14.0-x64.msi', '.\node.msi'); \
Start-Process msiexec.exe -Wait -ArgumentList '/I node.msi /quiet'; \
Remove-Item .\node.msi;

Expand Down
2 changes: 1 addition & 1 deletion src/images/ado-agent-win/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
build:
context: .
args:
- AGENT_VERSION=3.224.1
- AGENT_VERSION=3.240.1
env_file:
- .env
environment:
Expand Down
2 changes: 1 addition & 1 deletion src/images/ado-agent-win/start.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ try
Write-Host "1. Configuring Azure Pipelines agent..." -ForegroundColor Cyan

.\config.cmd --unattended `
--agent "$(if (Test-Path Env:NAME) { ${Env:NAME} } else { hostname })" `
--agent "$(if (Test-Path Env:NAME) { ${Env:NAME} } else { ${Env:COMPUTERNAME} })" `
--url "$(${Env:AZP_URL})" `
--auth PAT `
--token "$(Get-Content ${Env:AZP_TOKEN_FILE})" `
Expand Down
2 changes: 1 addition & 1 deletion src/images/github-runner-linux/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
NAME=hosted-runner-01
NAME=
GITHUB_TOKEN=
GITHUB_REPOSITORY=ayoussef-insight/self-hosted-agents
2 changes: 1 addition & 1 deletion src/images/github-runner-linux/docker-compose-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
context: .
args:
- ARCH=arm64
- RUNNER_VERSION=2.308.0
- RUNNER_VERSION=2.317.0
env_file:
- .env
volumes:
Expand Down
2 changes: 1 addition & 1 deletion src/images/github-runner-linux/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
context: .
args:
- ARCH=amd64
- RUNNER_VERSION=2.308.0
- RUNNER_VERSION=2.317.0
env_file:
- .env
volumes:
Expand Down
2 changes: 1 addition & 1 deletion src/images/github-runner-linux/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ print_header "2. Configuring github actions runner..."

./config.sh \
--unattended \
--name $NAME \
--name "${NAME:-$HOSTNAME}" \
--replace \
--url https://github.com/$GITHUB_REPOSITORY \
--token $TOKEN
Expand Down
2 changes: 1 addition & 1 deletion src/images/github-runner-win/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
NAME=hosted-runner-01
NAME=
GITHUB_TOKEN=
GITHUB_REPOSITORY=ayoussef-insight/self-hosted-agents
4 changes: 2 additions & 2 deletions src/images/github-runner-win/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ RUN (New-Object Net.WebClient).DownloadFile('https://dot.net/v1/dotnet-install.p
if (-not $currentPath.Contains($installPath)) { setx PATH ($currentPath + ';' + $installPath) } ; \
if (-not $env:path.Contains($installPath)) { $env:path += ';' + $installPath }

# Install Node 18
RUN (New-Object Net.WebClient).DownloadFile('https://nodejs.org/dist/v18.16.1/node-v18.16.1-x64.msi', '.\node.msi'); \
# Install Node 20
RUN (New-Object Net.WebClient).DownloadFile('https://nodejs.org/dist/v20.14.0/node-v20.14.0-x64.msi', '.\node.msi'); \
Start-Process msiexec.exe -Wait -ArgumentList '/I node.msi /quiet'; \
Remove-Item .\node.msi;

Expand Down
2 changes: 1 addition & 1 deletion src/images/github-runner-win/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
build:
context: .
args:
- RUNNER_VERSION=2.308.0
- RUNNER_VERSION=2.317.0
env_file:
- .env
environment:
Expand Down
3 changes: 1 addition & 2 deletions src/images/github-runner-win/start.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Remove-Item Env:GITHUB_TOKEN

$GITHUB_REPOSITORY=$Env:GITHUB_REPOSITORY
$GITHUB_TOKEN=$(Get-Content $Env:GITHUB_TOKEN_FILE)
$Name = if ($env:NAME) { $env:NAME } else { "hosted-runner-01" }

try
{
Expand All @@ -28,7 +27,7 @@ try
Write-Host "2. Configuring github actions runner..." -ForegroundColor Cyan

.\config.cmd --unattended `
--name "$Name" `
--name "$(if (Test-Path Env:NAME) { ${Env:NAME} } else { ${Env:COMPUTERNAME} })" `
--url "https://github.com/$GITHUB_REPOSITORY" `
--token "$Token" `
--replace
Expand Down
32 changes: 19 additions & 13 deletions src/infrastructure/acr/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,25 @@ resource acrResource 'Microsoft.ContainerRegistry/registries@2021-06-01-preview'
}
properties: {
adminUserEnabled: true
policies: acrSku == 'Premium' ? {
quarantinePolicy: {
status: 'enabled'
}
trustPolicy: {
status: 'enabled'
type: 'Notary'
}
retentionPolicy: {
status: 'enabled'
days: 30
}
} : {}
publicNetworkAccess: acrSku == 'Premium' ? 'Disabled' : 'Enabled'
networkRuleSet: acrSku == 'Premium' ? {
defaultAction: 'Deny'
} : null
policies: acrSku == 'Premium'
? {
quarantinePolicy: {
status: 'enabled'
}
trustPolicy: {
status: 'enabled'
type: 'Notary'
}
retentionPolicy: {
status: 'enabled'
days: 30
}
}
: {}
}
}

Expand Down

0 comments on commit 3e59e04

Please sign in to comment.