-
Notifications
You must be signed in to change notification settings - Fork 9
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
INFRA-427: Add a new deployment type to accommodate the new Ozone packaging #42
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f237c38
INFRA-427: Add a new deployment type to accommodate the new Ozone pac…
enyachoke 2d8c775
Allow cd to legacy docker compose folder
enyachoke 7e36d26
Add legacy Spec
enyachoke 31c548e
Update review
enyachoke 5b184e3
Remove debug
enyachoke e7bfe2c
Rename project type
enyachoke f69fd7e
Update JS doc for DockerComposeFromArtifactDeployment
enyachoke 60538fc
Fix typo
rbuisson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
ARG VERSION=2.346.3 | ||
ARG VERSION=2.387.3 | ||
FROM jenkins/jenkins:$VERSION | ||
MAINTAINER Mekom Solutions <[email protected]> | ||
|
||
USER root | ||
|
||
# Add the APP_DATA_DIR volume to keep OpenMRS CD data out of the Jenkins Home | ||
ARG APP_DATA_DIR="/var/lib/openmrs_cd/app_data" | ||
RUN mkdir -p $APP_DATA_DIR && chown -R jenkins:jenkins $APP_DATA_DIR | ||
|
||
RUN apt update --fix-missing | ||
RUN apt -y install nano jq openssh-server rsync libxml2-utils | ||
|
||
|
@@ -22,6 +18,10 @@ RUN sudo apt install -y nodejs | |
# Jenkins needs to be a sudo to execute some build tasks (particularly Bahmni Apps) | ||
RUN echo "jenkins ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | ||
|
||
# Add the APP_DATA_DIR volume to keep OpenMRS CD data out of the Jenkins Home | ||
ARG APP_DATA_DIR="/var/lib/openmrs_cd/app_data" | ||
RUN mkdir -p $APP_DATA_DIR && chown -R jenkins:jenkins $APP_DATA_DIR | ||
|
||
# Provide access to the /usr/share/jenkins directory | ||
RUN chown -R jenkins /usr/share/jenkins | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
138 changes: 138 additions & 0 deletions
138
node-scripts/spec/pipeline3/impl/dockerComposeFromArtifact.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
"use strict"; | ||
|
||
describe("Docker Compose Generic Deployment implementation", function() { | ||
// deps | ||
const path = require("path"); | ||
const config = require(path.resolve("src/utils/config")); | ||
const cst = require(path.resolve("src/const")); | ||
const dockerCompose = require(path.resolve( | ||
"src/pipeline3/impl/dockerComposeFromArtifact" | ||
)); | ||
|
||
const scripts = require(path.resolve( | ||
"src/" + config.getJobNameForPipeline3() + "/scripts" | ||
)); | ||
|
||
var instanceDef = { | ||
uuid: "336af1ee-90a1-4d1b-baaf-db12c84deec0", | ||
name: "cambodia1", | ||
type: "dev", | ||
group: "tlc", | ||
deployment: { | ||
hostDir: "/var/docker-volumes/", | ||
type: "dockerComposeFromArtifact", | ||
composePlugin: true, | ||
dockerComposeFiles: ["docker-compose.yml", "docker-compose-2.yml"], | ||
envFiles: ["env-file-1", "env-file-2"], | ||
value: { | ||
projectPath: "/var/docker-volumes/artifacts/run/docker", | ||
services: ["proxy", "openmrs", "mysql"] | ||
}, | ||
timezone: "Europe/Amsterdam", | ||
host: { | ||
type: "ssh", | ||
value: { | ||
ip: "hsc-dev.mekomsolutions.net", | ||
user: "mekom", | ||
port: "22" | ||
} | ||
} | ||
}, | ||
data: [ | ||
{ | ||
type: "sqlDocker", | ||
value: { | ||
service: "mysql", | ||
sourceFile: "/var/instance-data/sql-script.sql" | ||
} | ||
} | ||
] | ||
}; | ||
it("should use the correct compose command if composePlugin is set to true", () => { | ||
var expected = "docker compose"; | ||
expect(dockerCompose.composeExec(true)).toEqual(expected); | ||
}); | ||
|
||
it("should use the correct compose command if composePlugin is set to false", () => { | ||
var expected = "docker-compose"; | ||
expect(dockerCompose.composeExec(false)).toEqual(expected); | ||
}); | ||
|
||
it("should generate the correct compose command given multiple docker compose files", () => { | ||
var expected = " -f docker-compose.yml -f docker-compose-2.yml "; | ||
expect( | ||
dockerCompose.combineComposeFiles( | ||
instanceDef.deployment.dockerComposeFiles | ||
) | ||
).toEqual(expected); | ||
}); | ||
it("should generate Pre-Host Preparation deployment script", () => { | ||
var expected = ""; | ||
expected += scripts.initFolder( | ||
config.getCDDockerDirPath(instanceDef.uuid), | ||
"jenkins", | ||
"jenkins", | ||
true | ||
); | ||
|
||
expect( | ||
dockerCompose.preHostPreparation.getDeploymentScript(instanceDef) | ||
).toEqual(expected); | ||
}); | ||
|
||
it("should generate Host Preparation deployment script", () => { | ||
var expected = ""; | ||
|
||
expected += | ||
scripts.remote( | ||
instanceDef.deployment.host.value, | ||
scripts.writeProperty( | ||
"TIMEZONE", | ||
instanceDef.deployment.timezone, | ||
path | ||
.resolve(instanceDef.deployment.value.projectPath, ".env") | ||
.toString() | ||
) | ||
) + "\n"; | ||
|
||
expected += | ||
scripts.remote( | ||
instanceDef.deployment.host.value, | ||
scripts.createEnvVarFileDockerGeneric(instanceDef) | ||
) + | ||
"\n" + | ||
scripts.remote( | ||
instanceDef.deployment.host.value, | ||
"cd " + | ||
path.resolve(instanceDef.deployment.value.projectPath).toString() + | ||
" && docker compose -p " + | ||
instanceDef.name + | ||
" -f docker-compose.yml -f docker-compose-2.yml " + | ||
" --env-file=env-file-1 --env-file=env-file-2 --env-file=/var/docker-volumes/artifacts/run/docker/cambodia1.env" + | ||
" build --pull proxy openmrs mysql" + | ||
"\n" | ||
) + | ||
scripts.remote( | ||
instanceDef.deployment.host.value, | ||
"cd " + | ||
path.resolve(instanceDef.deployment.value.projectPath).toString() + | ||
" && docker compose -p " + | ||
instanceDef.name + | ||
" -f docker-compose.yml -f docker-compose-2.yml " + | ||
" --env-file=env-file-1 --env-file=env-file-2 --env-file=/var/docker-volumes/artifacts/run/docker/cambodia1.env" + | ||
" pull proxy openmrs mysql" + | ||
"\n" | ||
) + | ||
scripts.remote( | ||
instanceDef.deployment.host.value, | ||
"sudo chown -R root:root " + | ||
path | ||
.resolve(instanceDef.deployment.hostDir, instanceDef.name) | ||
.toString() | ||
); | ||
let generated = dockerCompose.hostPreparation.getDeploymentScript( | ||
instanceDef | ||
); | ||
expect(generated).toEqual(expected); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you replace by: