diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..aa1afe9d1 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,37 @@ +@Library("myLibrary") _ + +pipeline { + agent any + + environment { + GITHUB_TOKEN = credentials('mahmoudanwer_github_token') + GITHUB_USERNAME = "mahmoud-anwer" + REPO_OWNER = "mahmoud-anwer" + REPO_NAME = "node-hello" + TARGET_DIRECTORY = "node-hello-dir" + SERVICE_NAME = "api" + BASE_BRANCH = "master" + } + + stages { + stage('Clone Repository') { + steps { + cloneRepo(github_username: env.GITHUB_USERNAME, github_token: env.GITHUB_TOKEN, repo_owner: env.REPO_OWNER, repo_name: env.REPO_NAME, target_dir: env.TARGET_DIRECTORY) + } + } + stage('Editing files') { + steps { + script{ + sh """ + echo "test" > ${TARGET_DIRECTORY}/test.file + """ + } + } + } + stage('Creating pull request') { + steps { + createPR(base_branch: env.BASE_BRANCH, target_dir: env.TARGET_DIRECTORY, service_name: env.SERVICE_NAME, build_id: env.BUILD_ID, commit_hash: env.GIT_COMMIT, github_username: env.GITHUB_USERNAME, github_token: env.GITHUB_TOKEN, repo_owner: env.REPO_OWNER, repo_name: env.REPO_NAME) + } + } + } +} diff --git a/README.md b/README.md index b84b3924e..1ae15bd86 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ -# Node Hello World +# Hello World application Simple node.js app that servers "hello world" -Great for testing simple deployments to the cloud - -## Run It +## To run: `npm start` diff --git a/index.js b/index.js index 54e5fef1f..fc4f6ee3b 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ const port = process.env.PORT || 3000; const server = http.createServer((req, res) => { res.statusCode = 200; - const msg = 'Hello Node!\n' + const msg = 'Hello Anwer!\n' res.end(msg); }); diff --git a/test.file b/test.file new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/test.file @@ -0,0 +1 @@ +test