Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create folder hierarchy #105

Merged
merged 15 commits into from
Apr 9, 2020
2 changes: 1 addition & 1 deletion 8/alpine3.9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

FROM openjdk:8-jdk-alpine3.9
krufab marked this conversation as resolved.
Show resolved Hide resolved
FROM openjdk:8-jdk-alpine
MAINTAINER Oleg Nenashev <o.v.nenashev@gmail.com>

ARG VERSION=4.3
Expand Down
4 changes: 2 additions & 2 deletions make.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ if(![String]::IsNullOrWhiteSpace($env:DOCKERHUB_ORGANISATION)) {

$builds = @{
'jdk8' = @{
'Folder' = '8\windows\servercore-1809';
'Folder' = '8\windows\windowsservercore-1809';
krufab marked this conversation as resolved.
Show resolved Hide resolved
'Tags' = @( "latest", "windowsservercore-$WindowsTag", "jdk8", "windowsservercore-$WindowsTag-jdk8" )
};
'jdk11' = @{
'Folder' = '11\windows\servercore-1809';
'Folder' = '11\windows\windowsservercore-1809';
'Tags' = @( "windowsservercore-$WindowsTag-jdk11", "jdk11" )
};
'nanoserver' = @{
Expand Down
28 changes: 8 additions & 20 deletions tests/agent.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if([System.String]::IsNullOrWhiteSpace($FLAVOR)) {

Cleanup($AGENT_CONTAINER)

Describe "[$FLAVOR] build image" {
Describe "[$JDK $FLAVOR] build image" {
BeforeEach {
Push-Location -StackName 'agent' -Path "$PSScriptRoot/.."
}
Expand All @@ -45,21 +45,17 @@ Describe "[$FLAVOR] build image" {
}
}

Describe "[$FLAVOR] correct image metadata" {
Describe "[$JDK $FLAVOR] correct image metadata" {
It 'has correct volumes' {
$exitCode, $stdout, $stderr = Run-Program 'docker.exe' "inspect -f '{{.Config.Volumes}}' $AGENT_IMAGE"
$stdout | Should -Match 'C:/Users/jenkins/.jenkins'
$stdout | Should -Match 'C:/Users/jenkins/Work'
}
}

Describe "[$FLAVOR] image has correct applications in the PATH" {
Describe "[$JDK $FLAVOR] image has correct applications in the PATH" {
BeforeAll {
if($FOLDER.Contains('nanoserver')) {
docker run -d -it --name "$AGENT_CONTAINER" -P "$AGENT_IMAGE" pwsh
} else {
docker run -d -it --name "$AGENT_CONTAINER" -P "$AGENT_IMAGE" powershell
}
docker run -d -it --name "$AGENT_CONTAINER" -P "$AGENT_IMAGE" "$SHELL"
Is-AgentContainerRunning $AGENT_CONTAINER
}

Expand Down Expand Up @@ -92,13 +88,9 @@ Describe "[$FLAVOR] image has correct applications in the PATH" {
}
}

Describe "[$FLAVOR] check user access to directories" {
Describe "[$JDK $FLAVOR] check user access to directories" {
BeforeAll {
if($FOLDER.Contains('nanoserver')) {
docker run -d -it --name "$AGENT_CONTAINER" -P "$AGENT_IMAGE" pwsh
} else {
docker run -d -it --name "$AGENT_CONTAINER" -P "$AGENT_IMAGE" powershell
}
docker run -d -it --name "$AGENT_CONTAINER" -P "$AGENT_IMAGE" "$SHELL"
Is-AgentContainerRunning $AGENT_CONTAINER
}

Expand Down Expand Up @@ -126,18 +118,14 @@ $TEST_VERSION="3.36"
$TEST_USER="test-user"
$TEST_AGENT_WORKDIR="C:/test-user/something"

Describe "[$FLAVOR] use build args correctly" {
Describe "[$JDK $FLAVOR] use build args correctly" {
BeforeAll {
Push-Location -StackName 'agent' -Path "$PSScriptRoot/.."

$exitCode, $stdout, $stderr = Run-Program 'docker.exe' "build --build-arg `"VERSION=${TEST_VERSION}`" --build-arg `"user=${TEST_USER}`" --build-arg `"AGENT_WORKDIR=${TEST_AGENT_WORKDIR}`" -t ${AGENT_IMAGE} ${FOLDER}"
$exitCode | Should -Be 0

if($FOLDER.Contains('nanoserver')) {
docker run -d -it --name "$AGENT_CONTAINER" -P "$AGENT_IMAGE" pwsh
} else {
docker run -d -it --name "$AGENT_CONTAINER" -P "$AGENT_IMAGE" powershell
}
docker run -d -it --name "$AGENT_CONTAINER" -P "$AGENT_IMAGE" "$SHELL"
Is-AgentContainerRunning $AGENT_CONTAINER
}

Expand Down