Skip to content

Commit

Permalink
Update code
Browse files Browse the repository at this point in the history
  • Loading branch information
craigthackerx committed Dec 22, 2023
1 parent 3a8f675 commit cafd1c6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
6 changes: 6 additions & 0 deletions containers/jenkins-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -104,25 +104,31 @@ RUN jenkins-plugin-cli --plugins \
apache-httpcomponents-client-4-api \
azure-credentials \
azure-ad \
branch-api \
bouncycastle-api \
caffeine-api \
cloudbees-folder \
credentials \
credentials-binding \
display-url-api \
git \
git-client \
github \
instance-identity \
jakarta-activation-api \
jakarta-mail-api \
mailer \
mina-sshd-api-common \
mina-sshd-api-core \
pipeline-utility-steps \
plain-credentials \
powershell \
scm-api \
script-security \
ssh-credentials \
structs \
trilead-api \
workflow-aggregator \
workflow-multibranch \
workflow-scm-step \
workflow-step-api
30 changes: 30 additions & 0 deletions containers/jenkins-alpine/Run-LocalJenkins.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
param (
[string]$ImageName = "jenkins-test:latest",
[string]$ContainerName = "jenkins",
[int]$ExternalWebPort = 8080,
[int]$InternalWebPort = 8080,
[int]$ExternalAgentPort = 50000,
[int]$InternalAgentPort = 50000,
[string]$VolumeMapping = "jenkins_home:/var/jenkins_home"
)

# Pull the latest Jenkins Docker image
docker pull $ImageName

# Run the Jenkins container with specified parameters
$ContainerId = $(docker run -d `
-p "${ExternalWebPort}:${InternalWebPort}" `
-p "${ExternalAgentPort}:${InternalAgentPort}" `
--name $ContainerName `
--volume $VolumeMapping `
--privileged `
$ImageName)

Write-Host "Success: The container ID is: ${ContainerId}" -ForegroundColor Green

# Wait for 7 seconds
Start-Sleep -Seconds 7

# Retrieve the initial Admin Password
$JenkinsTempPassword = $(docker exec $ContainerName cat /var/jenkins_home/secrets/initialAdminPassword)
Write-Host "Success: Jenkins temp password is ${JenkinsTempPassword}" -ForegroundColor Green

0 comments on commit cafd1c6

Please sign in to comment.