Skip to content

Commit

Permalink
Add docker labels (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
timja authored Sep 13, 2021
1 parent be9b106 commit bf132a0
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 2 deletions.
8 changes: 8 additions & 0 deletions 11/bullseye/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,11 @@ COPY setup-sshd /usr/local/bin/setup-sshd
EXPOSE 22

ENTRYPOINT ["setup-sshd"]

LABEL \
org.opencontainers.image.vendor="Jenkins project" \
org.opencontainers.image.title="Official Jenkins SSH Agent Docker image" \
org.opencontainers.image.description="A Jenkins agent image which allows using SSH to establish the connection" \
org.opencontainers.image.url="https://www.jenkins.io/" \
org.opencontainers.image.source="https://github.com/jenkinsci/docker-ssh-agent" \
org.opencontainers.image.licenses="MIT"
10 changes: 9 additions & 1 deletion 11/windows/nanoserver-ltsc2019/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,12 @@ COPY setup-sshd.ps1 C:/ProgramData/Jenkins/setup-sshd.ps1

EXPOSE 22

ENTRYPOINT ["pwsh.exe", "-NoExit", "-Command", "& C:/ProgramData/Jenkins/setup-sshd.ps1"]
ENTRYPOINT ["pwsh.exe", "-NoExit", "-Command", "& C:/ProgramData/Jenkins/setup-sshd.ps1"]

LABEL `
org.opencontainers.image.vendor="Jenkins project" `
org.opencontainers.image.title="Official Jenkins SSH Agent Docker image" `
org.opencontainers.image.description="A Jenkins agent image which allows using SSH to establish the connection" `
org.opencontainers.image.url="https://www.jenkins.io/" `
org.opencontainers.image.source="https://github.com/jenkinsci/docker-ssh-agent" `
org.opencontainers.image.licenses="MIT"
8 changes: 8 additions & 0 deletions 11/windows/windowsservercore-ltsc2019/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,11 @@ COPY setup-sshd.ps1 C:/ProgramData/Jenkins/setup-sshd.ps1
EXPOSE 22

ENTRYPOINT ["powershell.exe", "-NoExit", "-Command", "& C:/ProgramData/Jenkins/setup-sshd.ps1"]

LABEL `
org.opencontainers.image.vendor="Jenkins project" `
org.opencontainers.image.title="Official Jenkins SSH Agent Docker image" `
org.opencontainers.image.description="A Jenkins agent image which allows using SSH to establish the connection" `
org.opencontainers.image.url="https://www.jenkins.io/" `
org.opencontainers.image.source="https://github.com/jenkinsci/docker-ssh-agent" `
org.opencontainers.image.licenses="MIT"
8 changes: 8 additions & 0 deletions 8/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,11 @@ COPY setup-sshd /usr/local/bin/setup-sshd
EXPOSE 22

ENTRYPOINT ["setup-sshd"]

LABEL \
org.opencontainers.image.vendor="Jenkins project" \
org.opencontainers.image.title="Official Jenkins SSH Agent Docker image" \
org.opencontainers.image.description="A Jenkins agent image which allows using SSH to establish the connection" \
org.opencontainers.image.url="https://www.jenkins.io/" \
org.opencontainers.image.source="https://github.com/jenkinsci/docker-ssh-agent" \
org.opencontainers.image.licenses="MIT"
8 changes: 8 additions & 0 deletions 8/bullseye/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,11 @@ COPY setup-sshd /usr/local/bin/setup-sshd
EXPOSE 22

ENTRYPOINT ["setup-sshd"]

LABEL \
org.opencontainers.image.vendor="Jenkins project" \
org.opencontainers.image.title="Official Jenkins SSH Agent Docker image" \
org.opencontainers.image.description="A Jenkins agent image which allows using SSH to establish the connection" \
org.opencontainers.image.url="https://www.jenkins.io/" \
org.opencontainers.image.source="https://github.com/jenkinsci/docker-ssh-agent" \
org.opencontainers.image.licenses="MIT"
10 changes: 9 additions & 1 deletion 8/windows/nanoserver-ltsc2019/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,12 @@ COPY setup-sshd.ps1 C:/ProgramData/Jenkins/setup-sshd.ps1

EXPOSE 22

ENTRYPOINT ["pwsh.exe", "-NoExit", "-Command", "& C:/ProgramData/Jenkins/setup-sshd.ps1"]
ENTRYPOINT ["pwsh.exe", "-NoExit", "-Command", "& C:/ProgramData/Jenkins/setup-sshd.ps1"]

LABEL `
org.opencontainers.image.vendor="Jenkins project" `
org.opencontainers.image.title="Official Jenkins SSH Agent Docker image" `
org.opencontainers.image.description="A Jenkins agent image which allows using SSH to establish the connection" `
org.opencontainers.image.url="https://www.jenkins.io/" `
org.opencontainers.image.source="https://github.com/jenkinsci/docker-ssh-agent" `
org.opencontainers.image.licenses="MIT"
8 changes: 8 additions & 0 deletions 8/windows/windowsservercore-ltsc2019/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,11 @@ COPY setup-sshd.ps1 C:/ProgramData/Jenkins/setup-sshd.ps1
EXPOSE 22

ENTRYPOINT ["powershell.exe", "-NoExit", "-Command", "& C:/ProgramData/Jenkins/setup-sshd.ps1"]

LABEL `
org.opencontainers.image.vendor="Jenkins project" `
org.opencontainers.image.title="Official Jenkins SSH Agent Docker image" `
org.opencontainers.image.description="A Jenkins agent image which allows using SSH to establish the connection" `
org.opencontainers.image.url="https://www.jenkins.io/" `
org.opencontainers.image.source="https://github.com/jenkinsci/docker-ssh-agent" `
org.opencontainers.image.licenses="MIT"
6 changes: 6 additions & 0 deletions tests/sshAgent.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ Describe "[$JDK $FLAVOR] checking image metadata" {
$stdout | Should -Match 'C:/Users/jenkins/AppData/Local/Temp'
$stdout | Should -Match 'C:/Users/jenkins/Work'
}

It 'source in docker metadata' {
$exitCode, $stdout, $stderr = Run-Program 'docker.exe' "inspect -f `"{{index .Config.Labels \`"org.opencontainers.image.source\`"}}`" $AGENT_IMAGE"
$exitCode | Should -Be 0
$stdout.Trim() | Should -Match 'https://github.com/jenkinsci/docker-ssh-agent'
}
}

Describe "[${JDK} ${FLAVOR}] image has correct version of java installed and in the PATH" {
Expand Down
9 changes: 9 additions & 0 deletions tests/tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ SUT_IMAGE=$(get_sut_image)
ARCH=${ARCH:-x86_64}
AGENT_CONTAINER=bats-jenkins-ssh-agent

@test "[${SUT_IMAGE}] test label in docker metadata" {
local expected_source="https://github.com/jenkinsci/docker-ssh-agent"

local actual_source
actual_source=$(docker inspect --format '{{ index .Config.Labels "org.opencontainers.image.source"}}' "${SUT_IMAGE}")

assert_equal "${expected_source}" "${actual_source}"
}

@test "[${SUT_IMAGE}] checking image metadata" {
local VOLUMES_MAP
VOLUMES_MAP="$(docker inspect -f '{{.Config.Volumes}}' "${SUT_IMAGE}")"
Expand Down

0 comments on commit bf132a0

Please sign in to comment.