Skip to content

Commit dc95c53

Browse files
committed
init
0 parents  commit dc95c53

File tree

10 files changed

+378
-0
lines changed

10 files changed

+378
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DS_Store
2+
.gradle
3+
src/*.state

Jenkinsfile

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
pipeline {
2+
agent any
3+
stages {
4+
stage('Build') {
5+
steps {
6+
echo 'Running build automation'
7+
sh './gradlew build'
8+
archiveArtifacts artifacts: 'src/index.html'
9+
}
10+
}
11+
stage('DeployToStage') {
12+
when {
13+
branch 'master'
14+
}
15+
steps {
16+
withCredentials([string(credentialsId: 'cloud_user_pw', variable: 'USERPASS')]) {
17+
sshPublisher(
18+
failOnError: true,
19+
publishers: [
20+
sshPublisherDesc(
21+
configName: 'staging',
22+
sshCredentials: [
23+
username: 'cloud_user',
24+
encryptedPassphrase: "$USERPASS"
25+
],
26+
transfers: [
27+
sshTransfer(
28+
sourceFiles: 'src/**',
29+
removePrefix: 'src/'
30+
)
31+
]
32+
)
33+
]
34+
)
35+
}
36+
}
37+
}
38+
stage('DeployToProd') {
39+
when {
40+
branch 'master'
41+
}
42+
steps {
43+
input 'Does the staging environment look OK?'
44+
milestone(1)
45+
withCredentials([string(credentialsId: 'cloud_user_pw', variable: 'USERPASS')]) {
46+
sshPublisher(
47+
failOnError: true,
48+
publishers: [
49+
sshPublisherDesc(
50+
configName: 'production',
51+
sshCredentials: [
52+
username: 'cloud_user',
53+
encryptedPassphrase: "$USERPASS"
54+
],
55+
transfers: [
56+
sshTransfer(
57+
sourceFiles: 'src/**',
58+
removePrefix: 'src/'
59+
)
60+
]
61+
)
62+
]
63+
)
64+
}
65+
}
66+
}
67+
}
68+
}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# devops-essentials-sample-app
2+
3+
This is a simple sample application intended to be used alongside the labs for DevOps Essentials.

build.gradle

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
task test {
2+
assert file ('./src/index.html').exists()
3+
}
4+
5+
task build {
6+
//this code is here to help our lab grader determine the state of the lab. It should be omitted in a real-world situation.
7+
String index = new File('src/index.html').text
8+
String labState
9+
if (index.contains("DevOps is awesome!")) {
10+
if (new File('src/brokenDeploy.state').isFile()) {
11+
labState = "rollbackDeploy"
12+
} else {
13+
labState = "firstDeploy"
14+
}
15+
} else if (index.contains("DevOps is awesbfgdsfkjh!")) {
16+
labState = "brokenDeploy"
17+
} else {
18+
labState = "unknown"
19+
}
20+
new File("src/${labState}.state").text = " "
21+
}
22+
build.dependsOn test

gradle/wrapper/gradle-wrapper.jar

53.1 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

gradlew

Lines changed: 172 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 84 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

settings.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
* This file was generated by the Gradle 'init' task.
3+
*
4+
* The settings file is used to specify which projects to include in your build.
5+
*
6+
* Detailed information about configuring a multi-project build in Gradle can be found
7+
* in the user guide at https://docs.gradle.org/4.6/userguide/multi_project_builds.html
8+
*/
9+
10+
rootProject.name = 'devops-essentials-sample-app'

src/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>DevOps Essentials Sample App</title>
5+
</head>
6+
<body style="background-color: #1A729D;">
7+
<h1 style="font-family: Courier; color: #434342; font-size: 48px; text-align: center;">
8+
DevOps is great!
9+
</h1>
10+
</body>
11+
</html>

0 commit comments

Comments
 (0)