From b9b42cbb4f21693fdca0c27f71518d0494932922 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Wed, 6 Sep 2023 12:55:15 +0530 Subject: [PATCH 001/103] commit1 --- pipeline1/Jenkinsfile | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 pipeline1/Jenkinsfile diff --git a/pipeline1/Jenkinsfile b/pipeline1/Jenkinsfile new file mode 100644 index 0000000..66f5806 --- /dev/null +++ b/pipeline1/Jenkinsfile @@ -0,0 +1,36 @@ +pipeline { + agent any + + stages { + stage('Checkout') { + steps { + // This step checks out your source code from the repository. + // If your Jenkinsfile and Python script are in the same folder, it will be checked out here. + checkout scm + } + } + + stage('Run Python Script') { + steps { + script { + // Assuming your Python script is named 'my_script.py' + def pythonScript = 'my_script.py' + + // Execute the Python script using the 'sh' step + // You may need to specify the Python interpreter if it's not in the PATH + sh "python ${pythonScript}" + } + } + } + } + + post { + success { + echo 'Python script ran successfully' + } + + failure { + echo 'Python script execution failed' + } + } +} From 7c80755b4ebdfc752a8de975f4672f51be842bbc Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Wed, 6 Sep 2023 13:01:23 +0530 Subject: [PATCH 002/103] Create my_script.py --- pipeline1/my_script.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 pipeline1/my_script.py diff --git a/pipeline1/my_script.py b/pipeline1/my_script.py new file mode 100644 index 0000000..ad35e5a --- /dev/null +++ b/pipeline1/my_script.py @@ -0,0 +1 @@ +print("Hello World") From cfef90586ad9a3b82b11d9e0ee26bd2ca513991f Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Wed, 6 Sep 2023 13:17:12 +0530 Subject: [PATCH 003/103] Create my_script2.py --- pipeline1/my_script2.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 pipeline1/my_script2.py diff --git a/pipeline1/my_script2.py b/pipeline1/my_script2.py new file mode 100644 index 0000000..2f9a147 --- /dev/null +++ b/pipeline1/my_script2.py @@ -0,0 +1 @@ +print("Hello") From f74b44b0066ff3dcc2c8f23f2f7c99a2b030648c Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 7 Sep 2023 11:46:01 +0530 Subject: [PATCH 004/103] Create Jenkinsfile --- pipeline2/Jenkinsfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 pipeline2/Jenkinsfile diff --git a/pipeline2/Jenkinsfile b/pipeline2/Jenkinsfile new file mode 100644 index 0000000..c6b5400 --- /dev/null +++ b/pipeline2/Jenkinsfile @@ -0,0 +1,15 @@ +pipeline { + agent any + stages { + stage("Clone Git Repository") { + steps { + git( + url: "https://github.com/rohanmane21/Python.git", + branch: "Testing", + changelog: true, + poll: true + ) + } + } + } +} From bb8249d990db6fc88358b57dac35bfc94f8b07a4 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 7 Sep 2023 12:02:46 +0530 Subject: [PATCH 005/103] Update Jenkinsfile --- pipeline2/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline2/Jenkinsfile b/pipeline2/Jenkinsfile index c6b5400..785ce56 100644 --- a/pipeline2/Jenkinsfile +++ b/pipeline2/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { stage("Clone Git Repository") { steps { git( - url: "https://github.com/rohanmane21/Python.git", + url: "https://github.com/rohanmane21/Python/tree/Testing/pipeline2", branch: "Testing", changelog: true, poll: true From f708bcac251aa856b4f9eba0de23efe26cb5ea88 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 7 Sep 2023 12:08:07 +0530 Subject: [PATCH 006/103] Update Jenkinsfile --- pipeline2/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline2/Jenkinsfile b/pipeline2/Jenkinsfile index 785ce56..a653e50 100644 --- a/pipeline2/Jenkinsfile +++ b/pipeline2/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { stage("Clone Git Repository") { steps { git( - url: "https://github.com/rohanmane21/Python/tree/Testing/pipeline2", + url: "https://github.com/rohanmane21/Python/tree/Testing/pipeline2.git", branch: "Testing", changelog: true, poll: true From 4dc859045f080e248e592a536a1435ca389b66b2 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 7 Sep 2023 12:28:19 +0530 Subject: [PATCH 007/103] Update Jenkinsfile --- pipeline2/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline2/Jenkinsfile b/pipeline2/Jenkinsfile index a653e50..ea3465c 100644 --- a/pipeline2/Jenkinsfile +++ b/pipeline2/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { stage("Clone Git Repository") { steps { git( - url: "https://github.com/rohanmane21/Python/tree/Testing/pipeline2.git", + git branch: 'Testing', credentialsId: 'git', url: 'https://github.com/rohanmane21/Python.git', branch: "Testing", changelog: true, poll: true From 7d7bd4a1c144c2943bba74dceb2320001b26dc04 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 7 Sep 2023 12:58:36 +0530 Subject: [PATCH 008/103] Update Jenkinsfile --- pipeline2/Jenkinsfile | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/pipeline2/Jenkinsfile b/pipeline2/Jenkinsfile index ea3465c..b6a5cde 100644 --- a/pipeline2/Jenkinsfile +++ b/pipeline2/Jenkinsfile @@ -1,15 +1,27 @@ pipeline { agent any + stages { - stage("Clone Git Repository") { + stage('Clone Repository') { steps { - git( - git branch: 'Testing', credentialsId: 'git', url: 'https://github.com/rohanmane21/Python.git', - branch: "Testing", - changelog: true, - poll: true - ) + // Define the Git repository URL and credentials (if required) + script { + def gitRepoUrl = 'https://github.com/rohanmane21/Python.git' + def gitCredentialsId = 'git-token' // Optional, if using credentials + + // Clone the repository + checkout([$class: 'GitSCM', + branches: [[name: '*/Testing']], + doGenerateSubmoduleConfigurations: false, + extensions: [], + userRemoteConfigs: [[credentialsId: gitCredentialsId, url: gitRepoUrl]] + ]) + } } } + + // Add more stages for building, testing, deploying, etc. } + + // Post-build actions, notifications, etc. } From 89256e625a376bb2760e465082c1134a46702184 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 7 Sep 2023 13:09:25 +0530 Subject: [PATCH 009/103] Update Jenkinsfile --- pipeline2/Jenkinsfile | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/pipeline2/Jenkinsfile b/pipeline2/Jenkinsfile index b6a5cde..36c05ee 100644 --- a/pipeline2/Jenkinsfile +++ b/pipeline2/Jenkinsfile @@ -20,8 +20,28 @@ pipeline { } } - // Add more stages for building, testing, deploying, etc. - } + stage('Run Python Script') { + steps { + script { + // Assuming your Python script is named 'my_script.py' + def pythonScript = 'my_script.py' + + // Execute the Python script using the 'sh' step + // You may need to specify the Python interpreter if it's not in the PATH + sh "python ${pythonScript}" + } + } + } + }// Add more stages for building, testing, deploying, etc. + post { + success { + echo 'Python script ran successfully' + } + + failure { + echo 'Python script execution failed' + } + } // Post-build actions, notifications, etc. } From 3e67b8840966998a59b1edd856425133bc152f77 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 7 Sep 2023 13:10:49 +0530 Subject: [PATCH 010/103] Update Jenkinsfile --- pipeline2/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline2/Jenkinsfile b/pipeline2/Jenkinsfile index 36c05ee..a2fe23e 100644 --- a/pipeline2/Jenkinsfile +++ b/pipeline2/Jenkinsfile @@ -32,7 +32,7 @@ pipeline { } } } - }// Add more stages for building, testing, deploying, etc. + } post { success { From 914d5eadaecdc245567c1e631ecaaedd76262c73 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 7 Sep 2023 13:20:49 +0530 Subject: [PATCH 011/103] Update Jenkinsfile --- pipeline2/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline2/Jenkinsfile b/pipeline2/Jenkinsfile index a2fe23e..1139843 100644 --- a/pipeline2/Jenkinsfile +++ b/pipeline2/Jenkinsfile @@ -7,7 +7,7 @@ pipeline { // Define the Git repository URL and credentials (if required) script { def gitRepoUrl = 'https://github.com/rohanmane21/Python.git' - def gitCredentialsId = 'git-token' // Optional, if using credentials + def gitCredentialsId = 'Git-Token' // Optional, if using credentials // Clone the repository checkout([$class: 'GitSCM', From b8de771d55b03c26a942b8dbf41beea729b1c5e6 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 7 Sep 2023 13:22:50 +0530 Subject: [PATCH 012/103] Update Jenkinsfile --- pipeline2/Jenkinsfile | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/pipeline2/Jenkinsfile b/pipeline2/Jenkinsfile index 1139843..94e27a4 100644 --- a/pipeline2/Jenkinsfile +++ b/pipeline2/Jenkinsfile @@ -6,8 +6,8 @@ pipeline { steps { // Define the Git repository URL and credentials (if required) script { - def gitRepoUrl = 'https://github.com/rohanmane21/Python.git' - def gitCredentialsId = 'Git-Token' // Optional, if using credentials + def gitRepoUrl = 'https://github.com/YogeshMore2207/TechnoServe-DevOps.git' + def gitCredentialsId = 'git-token' // Optional, if using credentials // Clone the repository checkout([$class: 'GitSCM', @@ -20,28 +20,8 @@ pipeline { } } - stage('Run Python Script') { - steps { - script { - // Assuming your Python script is named 'my_script.py' - def pythonScript = 'my_script.py' - - // Execute the Python script using the 'sh' step - // You may need to specify the Python interpreter if it's not in the PATH - sh "python ${pythonScript}" - } - } - } + // Add more stages for building, testing, deploying, etc. } - post { - success { - echo 'Python script ran successfully' - } - - failure { - echo 'Python script execution failed' - } - } // Post-build actions, notifications, etc. } From 2dd044862bbbef0474084aa2602e3219266a971d Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 7 Sep 2023 13:26:22 +0530 Subject: [PATCH 013/103] Update Jenkinsfile --- pipeline2/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipeline2/Jenkinsfile b/pipeline2/Jenkinsfile index 94e27a4..f393f60 100644 --- a/pipeline2/Jenkinsfile +++ b/pipeline2/Jenkinsfile @@ -6,8 +6,8 @@ pipeline { steps { // Define the Git repository URL and credentials (if required) script { - def gitRepoUrl = 'https://github.com/YogeshMore2207/TechnoServe-DevOps.git' - def gitCredentialsId = 'git-token' // Optional, if using credentials + def gitRepoUrl = 'https://github.com/rohanmane21/Python.git' + def gitCredentialsId = 'Git-Token' // Optional, if using credentials // Clone the repository checkout([$class: 'GitSCM', From 8eafb3697dbcc5ad5304f58b805cb270bd5250aa Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 7 Sep 2023 13:33:51 +0530 Subject: [PATCH 014/103] Update Jenkinsfile --- pipeline2/Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pipeline2/Jenkinsfile b/pipeline2/Jenkinsfile index f393f60..bd611be 100644 --- a/pipeline2/Jenkinsfile +++ b/pipeline2/Jenkinsfile @@ -20,7 +20,9 @@ pipeline { } } - // Add more stages for building, testing, deploying, etc. + stage("Run Python file"){ + sh 'test.py' + }// Add more stages for building, testing, deploying, etc. } // Post-build actions, notifications, etc. From 87d4d02746fa867590f74c9b6b4a165d8e91f2dc Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 7 Sep 2023 13:36:04 +0530 Subject: [PATCH 015/103] Update Jenkinsfile --- pipeline2/Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pipeline2/Jenkinsfile b/pipeline2/Jenkinsfile index bd611be..ebb16fb 100644 --- a/pipeline2/Jenkinsfile +++ b/pipeline2/Jenkinsfile @@ -21,7 +21,9 @@ pipeline { } stage("Run Python file"){ - sh 'test.py' + steps{ + sh 'python test.py' + } }// Add more stages for building, testing, deploying, etc. } From 7fda932abdc850bcb4d5b0357a674a9c11bea829 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Fri, 8 Sep 2023 11:39:24 +0530 Subject: [PATCH 016/103] Create create_instance --- pipeline3/create_instance | 1 + 1 file changed, 1 insertion(+) create mode 100644 pipeline3/create_instance diff --git a/pipeline3/create_instance b/pipeline3/create_instance new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/pipeline3/create_instance @@ -0,0 +1 @@ + From 639824243329effb0f3b687f0a3cb95e9c9362f8 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Fri, 8 Sep 2023 11:41:13 +0530 Subject: [PATCH 017/103] Create Jenkinsfile --- pipeline3/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) create mode 100644 pipeline3/Jenkinsfile diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/pipeline3/Jenkinsfile @@ -0,0 +1 @@ + From 161b19a6472467576bc615f64b58d89ebc81e839 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Fri, 8 Sep 2023 11:44:11 +0530 Subject: [PATCH 018/103] Create jenkins.pem --- pipeline3/jenkins.pem | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 pipeline3/jenkins.pem diff --git a/pipeline3/jenkins.pem b/pipeline3/jenkins.pem new file mode 100644 index 0000000..cffac29 --- /dev/null +++ b/pipeline3/jenkins.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEAlPO/jP6Ia3xY8yJvKnXmZA1fPcO6BYCN9D+bS+88S9jSyh+m +el7rcykWA2hMB/tX4LLlzGDYhagUOXkf89vQV0eHzDG2LiqpGna2T6zylm1jm2hg +J34NV6xtt5pm9A9XJj4pBnFYPZkO2lASXSGM/1dc3GmUDlMiuokdbCv3b5aBJ/6d +E7abKc5ndDBUZjCaugm05JSKrinTWWyJkht7RfK1BOT1LlCdHo6FBR2ejVCseomH +zcFIX/RXeX//bC0IxkiJS+JEpv4LcQb8UOj9TcmLpTJUh00N3gEPVnQGbxVUZANI +UV1ayYvmqMaijxqEzPZ9t9mHKpHVTqViOXL15wIDAQABAoIBABDo2wYWn0YUh8SS +VCxt1gnluro4ThXx0iu4TNkB/8ZchxGLJkseG3ynXWhlnrwJPKC1roDVPb9upV0g +8w+sFKrT5Aa6XgQ/s5LdhzTkXWXWZUhvQPs6xCj/2jTNwoJSe4JL7DxfAbV8esMt +8+e+t1MFh/U9xyEZLwgeKMju9NgmAXX/hossz/e1Fpk+/IT6+BSzRAONCVAs0dyH +68UW5rmeZ5eqEvivxc9Bn11G1YpbeIegQWb2SsTbZ8ewPk+RGhDdTy2h5pqkvTrQ ++RNux+DCt36mDr2VEx9x2aLglMVFMj7qIr549aau+musBLdDEdf98eEtXBp/kRvZ +AwG5HwECgYEA0DNHhiYaJtRSekSBDbEZgJPIHMxghG8ZDEq8o4/j0VZP7vX46a/m ++zKKh2JtJhT9Py5pFGQgNrdOKn+d+yEHXc7n3g1I0rUzob34IDXN7tRKk1nuOwbp +jyB7tQSe5eWoTvK6yP4XYsc2bTvIyn0BfYJ0qtkO94xnmN7RWkaUTUkCgYEAtyY6 +yXwVvWZgdTnz5SAv+jrJRu5Tg1B4wlTRvwX6sroOoypkPyY7cGgubfupxGc5c8wZ +iKKezqj8uc6qNL9UrsCe4NIbOeiXfhWqhyvm6rSW6NT8EaszBgRegLHTNltjZ0v4 +nMIUR0x/RvXamKVfvAmNC5sZ7pcoL2G3cUhWGa8CgYEAoy5t8sDOYnyroFUs6TRT +jqlFgPzW8TW6Zh31uCTBJIQH5n03eMF7woqcdPw6HEz7KJgRl//aF8iYJUsc4YXD +pkzTAwFagHuxWiXw4h4JqBUP1mn4BJ+oU5vcGcbjW8Eip64ro/kzDyKgkAD5oWtU +zbCADKBP0MplMDYD1EPZXLECgYAY0OVGR7nqX+TR/Xg+o43cqfp70e8e69hw/G0v +JPBDJ1K0aRoMNHH5WSRxYpguNI5kUlNjYCWEewFDa+1EGGixBQiCDfYCcrGUM/tX +NWukgbOw+Kru+fN/7Teg2Hd19gwSAwk8tE9rGcJlKwrjhATkxaaG3A03duPLB8KD +ZvnDoQKBgE7w7o2JrR/FWaTcLOY0//ux2CXrSSkLs7xW5GZ+BAkB4JdBXODhU8/Z +mWDP/bTyqGK+GE4rcJouKx3gRKgwC6+/psOoV3OlRDwJSHFGd+mft/P5YmJhjGeD +v2qogUFSYgfX0yiV8XOrsTCAHtxQ9rXgL2Q3oHCMrvomaLvrO3rt +-----END RSA PRIVATE KEY----- From a0198f0a558a635437c45ded3c791e8a0d4f7119 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 08:28:47 +0530 Subject: [PATCH 019/103] Update --- pipeline3/create_instance | 1 - pipeline3/create_instance.py | 37 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) delete mode 100644 pipeline3/create_instance create mode 100644 pipeline3/create_instance.py diff --git a/pipeline3/create_instance b/pipeline3/create_instance deleted file mode 100644 index 8b13789..0000000 --- a/pipeline3/create_instance +++ /dev/null @@ -1 +0,0 @@ - diff --git a/pipeline3/create_instance.py b/pipeline3/create_instance.py new file mode 100644 index 0000000..2b86b2c --- /dev/null +++ b/pipeline3/create_instance.py @@ -0,0 +1,37 @@ +import boto3 + +# Get environment variables +# import os +AWS_ACCESS_KEY_ID = 'AKIASYYM73UYQV2BP2S4' +AWS_SECRET_ACCESS_KEY = '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' +AWS_REGION = 'ap-south-1' +# Create an EC2 client +ec2 = boto3.client('ec2', region_name=AWS_REGION, aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCESS_KEY) + +# Define EC2 instance parameters +instance_params = { + 'ImageId': 'ami-02bb7d8191b50f4bb', + 'InstanceType': 't2.micro', + 'KeyName': 'jenkins.pem', + 'MinCount': 1, + 'MaxCount': 1, + 'TagSpecifications':[ + { + 'ResourceType': 'instance', + 'Tags':[ + { + 'Key':'Name', + 'Value':'Ec2_user' + }, + ] + }, + ] +} + +# Create the EC2 instance +response = ec2.run_instances(**instance_params) + +# Print the instance ID +instance_id = response['Instances'][0]['InstanceId'] +print(f"EC2 instance created with ID: {instance_id}") + From 88eb07bb640d43bf1fb5271c43295a70b3507a4d Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 08:38:38 +0530 Subject: [PATCH 020/103] Update Jenkinsfile --- pipeline3/Jenkinsfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile index 8b13789..f5c0d6d 100644 --- a/pipeline3/Jenkinsfile +++ b/pipeline3/Jenkinsfile @@ -1 +1,23 @@ +pipeline { + agent any + environment { + AWS_ACCESS_KEY_ID = credentials('AWS_ACCESS_KEY_ID') + AWS_SECRET_ACCESS_KEY = credentials('AWS_SECRET_ACCESS_KEY') + AWS_REGION = 'ap-south-1' // Set your desired AWS region here + } + + stages { + stage('Checkout') { + steps { + checkout scm + } + } + + stage('Create EC2 Instance') { + steps { + sh 'python create_instance.py' + } + } + } +} From b412956e154e33ada0951bc75ff392d1d8fcb15c Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 08:43:45 +0530 Subject: [PATCH 021/103] Update Jenkinsfile --- pipeline3/Jenkinsfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile index f5c0d6d..d210b15 100644 --- a/pipeline3/Jenkinsfile +++ b/pipeline3/Jenkinsfile @@ -8,6 +8,21 @@ pipeline { } stages { + steps { + // Define the Git repository URL and credentials (if required) + script { + def gitRepoUrl = 'https://github.com/rohanmane21/Python.git' + def gitCredentialsId = 'Git-Token' // Optional, if using credentials + + // Clone the repository + checkout([$class: 'GitSCM', + branches: [[name: '*/Testing']], + doGenerateSubmoduleConfigurations: false, + extensions: [], + userRemoteConfigs: [[credentialsId: gitCredentialsId, url: gitRepoUrl]] + ]) + } + } stage('Checkout') { steps { checkout scm From e90ce870e5eea2dce1b6312d686ba47d7112430f Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 08:50:40 +0530 Subject: [PATCH 022/103] Update Jenkinsfile From 9fb4887004390efead81c92c519af9e975a72935 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 09:03:19 +0530 Subject: [PATCH 023/103] Update Jenkinsfile --- pipeline3/Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile index d210b15..d0afdd8 100644 --- a/pipeline3/Jenkinsfile +++ b/pipeline3/Jenkinsfile @@ -8,7 +8,8 @@ pipeline { } stages { - steps { + stage('Clone Repository') { + steps { // Define the Git repository URL and credentials (if required) script { def gitRepoUrl = 'https://github.com/rohanmane21/Python.git' @@ -23,6 +24,7 @@ pipeline { ]) } } + } stage('Checkout') { steps { checkout scm From 22aca30f3607e2e0a9d6bb20e80252c6b0fb5d46 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 09:08:52 +0530 Subject: [PATCH 024/103] Update Jenkinsfile --- pipeline3/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile index d0afdd8..497f035 100644 --- a/pipeline3/Jenkinsfile +++ b/pipeline3/Jenkinsfile @@ -2,8 +2,8 @@ pipeline { agent any environment { - AWS_ACCESS_KEY_ID = credentials('AWS_ACCESS_KEY_ID') - AWS_SECRET_ACCESS_KEY = credentials('AWS_SECRET_ACCESS_KEY') + AWS_ACCESS_KEY_ID = credentials('AKIASYYM73UYQV2BP2S4') + AWS_SECRET_ACCESS_KEY = credentials('GhYw53bcZdYkL9ONAVdR01WqRonu6dusaBTMC4Xm') AWS_REGION = 'ap-south-1' // Set your desired AWS region here } From fe2b8a6798f9e3d6ea176c601990a8fdf329cf16 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 09:09:29 +0530 Subject: [PATCH 025/103] Update Jenkinsfile From 9c4388aa0fe924e4438cc0bf146d9ad97583d670 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 09:20:09 +0530 Subject: [PATCH 026/103] Update create_instance.py --- pipeline3/create_instance.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pipeline3/create_instance.py b/pipeline3/create_instance.py index 2b86b2c..426d0e6 100644 --- a/pipeline3/create_instance.py +++ b/pipeline3/create_instance.py @@ -1,10 +1,10 @@ import boto3 # Get environment variables -# import os -AWS_ACCESS_KEY_ID = 'AKIASYYM73UYQV2BP2S4' -AWS_SECRET_ACCESS_KEY = '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' -AWS_REGION = 'ap-south-1' +import os +AWS_ACCESS_KEY_ID = os.environ.get('AKIASYYM73UYQV2BP2S4') +AWS_SECRET_ACCESS_KEY = os.environ.get('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') +AWS_REGION = os.environ.get('ap-south-1' ) # Create an EC2 client ec2 = boto3.client('ec2', region_name=AWS_REGION, aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCESS_KEY) From b289f7e76283fcc6f7fc06310be14d156aa14ff2 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 09:21:53 +0530 Subject: [PATCH 027/103] Update Jenkinsfile --- pipeline3/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile index 497f035..d0afdd8 100644 --- a/pipeline3/Jenkinsfile +++ b/pipeline3/Jenkinsfile @@ -2,8 +2,8 @@ pipeline { agent any environment { - AWS_ACCESS_KEY_ID = credentials('AKIASYYM73UYQV2BP2S4') - AWS_SECRET_ACCESS_KEY = credentials('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') + AWS_ACCESS_KEY_ID = credentials('AWS_ACCESS_KEY_ID') + AWS_SECRET_ACCESS_KEY = credentials('AWS_SECRET_ACCESS_KEY') AWS_REGION = 'ap-south-1' // Set your desired AWS region here } From 5a3fbd5aa0b7b7a063d32559f21936a8cbbf449f Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 11:24:23 +0530 Subject: [PATCH 028/103] Update create_instance.py --- pipeline3/create_instance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipeline3/create_instance.py b/pipeline3/create_instance.py index 426d0e6..8a9ddd5 100644 --- a/pipeline3/create_instance.py +++ b/pipeline3/create_instance.py @@ -2,8 +2,8 @@ # Get environment variables import os -AWS_ACCESS_KEY_ID = os.environ.get('AKIASYYM73UYQV2BP2S4') -AWS_SECRET_ACCESS_KEY = os.environ.get('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') +AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID') +AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY') AWS_REGION = os.environ.get('ap-south-1' ) # Create an EC2 client ec2 = boto3.client('ec2', region_name=AWS_REGION, aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCESS_KEY) From 72f225170c0877907374d39d0f421cd25bbc9f9a Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 11:57:01 +0530 Subject: [PATCH 029/103] Update create_instance.py From b1c422be70a677684f27b43e9086b1cf7a1f0d54 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 11:59:27 +0530 Subject: [PATCH 030/103] Update create_instance.py --- pipeline3/create_instance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipeline3/create_instance.py b/pipeline3/create_instance.py index 8a9ddd5..055ad68 100644 --- a/pipeline3/create_instance.py +++ b/pipeline3/create_instance.py @@ -2,8 +2,8 @@ # Get environment variables import os -AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID') -AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY') +AWS_ACCESS_KEY_ID = os.environ.get('AKIASYYM73UY4Q7QQNWO') +AWS_SECRET_ACCESS_KEY = os.environ.get('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') AWS_REGION = os.environ.get('ap-south-1' ) # Create an EC2 client ec2 = boto3.client('ec2', region_name=AWS_REGION, aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCESS_KEY) From f7cb390ff5bc96a607df9a687e984fc5de4fe7d3 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:34:59 +0530 Subject: [PATCH 031/103] Update Jenkinsfile --- pipeline3/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile index d0afdd8..65bb0c1 100644 --- a/pipeline3/Jenkinsfile +++ b/pipeline3/Jenkinsfile @@ -2,8 +2,8 @@ pipeline { agent any environment { - AWS_ACCESS_KEY_ID = credentials('AWS_ACCESS_KEY_ID') - AWS_SECRET_ACCESS_KEY = credentials('AWS_SECRET_ACCESS_KEY') + AWS_ACCESS_KEY_ID = credentials('AKIASYYM73UY4Q7QQNWO') + AWS_SECRET_ACCESS_KEY = credentials('KmmFRTfbmn0r3d+FRZAo0BGcUrQpSEx6pM+UYTkK') AWS_REGION = 'ap-south-1' // Set your desired AWS region here } From 043063659378d1f2a58a7b078bcdecc33bd07094 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:45:10 +0530 Subject: [PATCH 032/103] Update Jenkinsfile --- pipeline3/Jenkinsfile | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile index 65bb0c1..61b70e7 100644 --- a/pipeline3/Jenkinsfile +++ b/pipeline3/Jenkinsfile @@ -2,7 +2,7 @@ pipeline { agent any environment { - AWS_ACCESS_KEY_ID = credentials('AKIASYYM73UY4Q7QQNWO') + AWS_ACCESS_KEY_ID = credentials('admin') AWS_SECRET_ACCESS_KEY = credentials('KmmFRTfbmn0r3d+FRZAo0BGcUrQpSEx6pM+UYTkK') AWS_REGION = 'ap-south-1' // Set your desired AWS region here } @@ -37,4 +37,21 @@ pipeline { } } } -} +// } +// al we created. + +// pipeline { +// agent any +// stages { +// stage('test AWS credentials') { +// steps { +// withAWS(credentials: 'jenkins-test-user', region: 'us-east-1') { +// sh 'echo "hello Jenkins">hello.txt' +// s3Upload acl: 'Private', bucket: 'devopslee', file: 'hello.txt' +// s3Download bucket: 'devopslee', file: 'downloadedHello.txt', path: 'hello.txt' +// sh 'cat downloadedHello.txt' +// } +// } +// } +// } +// } From 890e1355c6204a978ea5d8c6d7600b08340e0fef Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:47:12 +0530 Subject: [PATCH 033/103] Update Jenkinsfile --- pipeline3/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile index 61b70e7..4068cdb 100644 --- a/pipeline3/Jenkinsfile +++ b/pipeline3/Jenkinsfile @@ -37,7 +37,7 @@ pipeline { } } } -// } +} // al we created. // pipeline { From 70460f31bf884b2713761dec452147d067e1e49f Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:50:10 +0530 Subject: [PATCH 034/103] Update Jenkinsfile --- pipeline3/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile index 4068cdb..e48ee06 100644 --- a/pipeline3/Jenkinsfile +++ b/pipeline3/Jenkinsfile @@ -3,7 +3,7 @@ pipeline { environment { AWS_ACCESS_KEY_ID = credentials('admin') - AWS_SECRET_ACCESS_KEY = credentials('KmmFRTfbmn0r3d+FRZAo0BGcUrQpSEx6pM+UYTkK') + AWS_SECRET_ACCESS_KEY = credentials('AKIASYYM73UY4Q7QQNWO') AWS_REGION = 'ap-south-1' // Set your desired AWS region here } From 5d930c3968d0bfeed668597fddf96beeebe0ca60 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:57:14 +0530 Subject: [PATCH 035/103] Update Jenkinsfile --- pipeline3/Jenkinsfile | 79 ++++++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 31 deletions(-) diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile index e48ee06..a503138 100644 --- a/pipeline3/Jenkinsfile +++ b/pipeline3/Jenkinsfile @@ -1,43 +1,60 @@ pipeline { agent any - - environment { - AWS_ACCESS_KEY_ID = credentials('admin') - AWS_SECRET_ACCESS_KEY = credentials('AKIASYYM73UY4Q7QQNWO') - AWS_REGION = 'ap-south-1' // Set your desired AWS region here - } - stages { - stage('Clone Repository') { + stage('Example') { steps { - // Define the Git repository URL and credentials (if required) script { - def gitRepoUrl = 'https://github.com/rohanmane21/Python.git' - def gitCredentialsId = 'Git-Token' // Optional, if using credentials - - // Clone the repository - checkout([$class: 'GitSCM', - branches: [[name: '*/Testing']], - doGenerateSubmoduleConfigurations: false, - extensions: [], - userRemoteConfigs: [[credentialsId: gitCredentialsId, url: gitRepoUrl]] - ]) + withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', + credentialsId: 'admin', + accessKeyVariable: 'AKIASYYM73UY4Q7QQNWO', + secretKeyVariable: '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']]) { + sh 'aws ec2 describe-instances --region ap-south-1' + + } } } } - stage('Checkout') { - steps { - checkout scm - } - } - - stage('Create EC2 Instance') { - steps { - sh 'python create_instance.py' - } - } } -} +}// pipeline { +// agent any + +// environment { +// AWS_ACCESS_KEY_ID = credentials('admin') +// AWS_SECRET_ACCESS_KEY = credentials('AKIASYYM73UY4Q7QQNWO') +// AWS_REGION = 'ap-south-1' // Set your desired AWS region here +// } + +// stages { +// stage('Clone Repository') { +// steps { +// // Define the Git repository URL and credentials (if required) +// script { +// def gitRepoUrl = 'https://github.com/rohanmane21/Python.git' +// def gitCredentialsId = 'Git-Token' // Optional, if using credentials + +// // Clone the repository +// checkout([$class: 'GitSCM', +// branches: [[name: '*/Testing']], +// doGenerateSubmoduleConfigurations: false, +// extensions: [], +// userRemoteConfigs: [[credentialsId: gitCredentialsId, url: gitRepoUrl]] +// ]) +// } +// } +// } +// stage('Checkout') { +// steps { +// checkout scm +// } +// } + +// stage('Create EC2 Instance') { +// steps { +// sh 'python create_instance.py' +// } +// } +// } +// } // al we created. // pipeline { From 35387ae9f29dbbf6062e98ba37b3913ad99d5dfa Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:00:21 +0530 Subject: [PATCH 036/103] Update create_instance.py --- pipeline3/create_instance.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pipeline3/create_instance.py b/pipeline3/create_instance.py index 055ad68..0cce18a 100644 --- a/pipeline3/create_instance.py +++ b/pipeline3/create_instance.py @@ -1,12 +1,13 @@ import boto3 -# Get environment variables -import os -AWS_ACCESS_KEY_ID = os.environ.get('AKIASYYM73UY4Q7QQNWO') -AWS_SECRET_ACCESS_KEY = os.environ.get('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') -AWS_REGION = os.environ.get('ap-south-1' ) +# # Get environment variables +# import os +# AWS_ACCESS_KEY_ID = os.environ.get('AKIASYYM73UY4Q7QQNWO') +# AWS_SECRET_ACCESS_KEY = os.environ.get('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') +# AWS_REGION = os.environ.get('ap-south-1' ) # Create an EC2 client -ec2 = boto3.client('ec2', region_name=AWS_REGION, aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCESS_KEY) +ec2 = boto3.client('ec2') +# , region_name=AWS_REGION, aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCESS_KEY) # Define EC2 instance parameters instance_params = { From 7760031f1fa16bf73acdb65dec2af73f0ac218a6 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:12:34 +0530 Subject: [PATCH 037/103] Update Jenkinsfile From 6d85b43e02fba5420406a22843f82e9a2e316329 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:16:33 +0530 Subject: [PATCH 038/103] Update Jenkinsfile --- pipeline3/Jenkinsfile | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile index a503138..5ea1841 100644 --- a/pipeline3/Jenkinsfile +++ b/pipeline3/Jenkinsfile @@ -1,22 +1,35 @@ pipeline { agent any stages { - stage('Example') { + stage('test AWS credentials') { steps { - script { - withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', - credentialsId: 'admin', - accessKeyVariable: 'AKIASYYM73UY4Q7QQNWO', - secretKeyVariable: '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']]) { - sh 'aws ec2 describe-instances --region ap-south-1' - - } + withAWS(credentials: 'new', region: 'ap-south-1') + { + sh 'python pipeline3/create_instance.py' } } } } }// pipeline { // agent any +// stages { +// stage('Example') { +// steps { +// script { +// withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', +// credentialsId: 'admin', +// accessKeyVariable: 'AKIASYYM73UY4Q7QQNWO', +// secretKeyVariable: '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']]) { +// sh 'aws ec2 describe-instances --region ap-south-1' + +// } +// } +// } +// } +// } +// } +// pipeline { +// agent any // environment { // AWS_ACCESS_KEY_ID = credentials('admin') From 4bc7e4082f2b1b6cbda0fe14871e445f705882b3 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:17:58 +0530 Subject: [PATCH 039/103] Update Jenkinsfile --- pipeline3/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile index 5ea1841..bf72b07 100644 --- a/pipeline3/Jenkinsfile +++ b/pipeline3/Jenkinsfile @@ -3,7 +3,7 @@ pipeline { stages { stage('test AWS credentials') { steps { - withAWS(credentials: 'new', region: 'ap-south-1') + withAWS(credentials: 'admin', region: 'ap-south-1') { sh 'python pipeline3/create_instance.py' } From 839e8d3becf6fb58e3b075b4acd357ee3236cfcd Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:26:17 +0530 Subject: [PATCH 040/103] Update create_instance.py --- pipeline3/create_instance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline3/create_instance.py b/pipeline3/create_instance.py index 0cce18a..200b223 100644 --- a/pipeline3/create_instance.py +++ b/pipeline3/create_instance.py @@ -13,7 +13,7 @@ instance_params = { 'ImageId': 'ami-02bb7d8191b50f4bb', 'InstanceType': 't2.micro', - 'KeyName': 'jenkins.pem', + 'KeyName': 'jenkins', 'MinCount': 1, 'MaxCount': 1, 'TagSpecifications':[ From c01a4feaf8158ccff5e52b46412f4a4eb60678c7 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:37:40 +0530 Subject: [PATCH 041/103] Update Jenkinsfile --- pipeline3/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile index bf72b07..e21f5d0 100644 --- a/pipeline3/Jenkinsfile +++ b/pipeline3/Jenkinsfile @@ -5,7 +5,7 @@ pipeline { steps { withAWS(credentials: 'admin', region: 'ap-south-1') { - sh 'python pipeline3/create_instance.py' + sh 'python create_instance.py' } } } From c40d8a0de0f7a356616785e7fa47e7a83d5a7f02 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:38:51 +0530 Subject: [PATCH 042/103] Update Jenkinsfile --- pipeline3/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile index e21f5d0..bf72b07 100644 --- a/pipeline3/Jenkinsfile +++ b/pipeline3/Jenkinsfile @@ -5,7 +5,7 @@ pipeline { steps { withAWS(credentials: 'admin', region: 'ap-south-1') { - sh 'python create_instance.py' + sh 'python pipeline3/create_instance.py' } } } From 449b164fbd11fade7328e7f538fa759812c4a965 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 14:11:34 +0530 Subject: [PATCH 043/103] Update Jenkinsfile --- pipeline3/Jenkinsfile | 93 ++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 49 deletions(-) diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile index bf72b07..dcbcf65 100644 --- a/pipeline3/Jenkinsfile +++ b/pipeline3/Jenkinsfile @@ -1,16 +1,16 @@ -pipeline { - agent any - stages { - stage('test AWS credentials') { - steps { - withAWS(credentials: 'admin', region: 'ap-south-1') - { - sh 'python pipeline3/create_instance.py' - } - } - } - } -}// pipeline { +// pipeline { +// agent any +// stages { +// stage('test AWS credentials') { +// steps { +// withAWS(credentials: 'admin', region: 'ap-south-1') +// { +// sh 'python pipeline3/create_instance.py' +// } +// } +// } +// } +// }// pipeline { // agent any // stages { // stage('Example') { @@ -28,46 +28,41 @@ pipeline { // } // } // } -// pipeline { -// agent any +pipeline { + agent any -// environment { -// AWS_ACCESS_KEY_ID = credentials('admin') -// AWS_SECRET_ACCESS_KEY = credentials('AKIASYYM73UY4Q7QQNWO') -// AWS_REGION = 'ap-south-1' // Set your desired AWS region here -// } -// stages { -// stage('Clone Repository') { -// steps { -// // Define the Git repository URL and credentials (if required) -// script { -// def gitRepoUrl = 'https://github.com/rohanmane21/Python.git' -// def gitCredentialsId = 'Git-Token' // Optional, if using credentials + stages { + stage('Clone Repository') { + steps { + // Define the Git repository URL and credentials (if required) + script { + def gitRepoUrl = 'https://github.com/rohanmane21/Python.git' + def gitCredentialsId = 'admin' // Optional, if using credentials -// // Clone the repository -// checkout([$class: 'GitSCM', -// branches: [[name: '*/Testing']], -// doGenerateSubmoduleConfigurations: false, -// extensions: [], -// userRemoteConfigs: [[credentialsId: gitCredentialsId, url: gitRepoUrl]] -// ]) -// } -// } -// } -// stage('Checkout') { -// steps { -// checkout scm -// } -// } + // Clone the repository + checkout([$class: 'GitSCM', + branches: [[name: '*/Testing']], + doGenerateSubmoduleConfigurations: false, + extensions: [], + userRemoteConfigs: [[credentialsId: gitCredentialsId, url: gitRepoUrl]] + ]) + } + } + } + stage('Checkout') { + steps { + checkout scm + } + } -// stage('Create EC2 Instance') { -// steps { -// sh 'python create_instance.py' -// } -// } -// } -// } + stage('Create EC2 Instance') { + steps { + sh 'python create_instance.py' + } + } + } +} // al we created. // pipeline { From 8ef67b539dd58d293471f5511885480017d07714 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 14:13:13 +0530 Subject: [PATCH 044/103] Update Jenkinsfile --- pipeline3/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile index dcbcf65..c62e9c3 100644 --- a/pipeline3/Jenkinsfile +++ b/pipeline3/Jenkinsfile @@ -58,7 +58,7 @@ pipeline { stage('Create EC2 Instance') { steps { - sh 'python create_instance.py' + sh 'python pipeline3/create_instance.py' } } } From 81b95494db1298d7ed39504515c0cc1596fa69a9 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 14:16:16 +0530 Subject: [PATCH 045/103] Update Jenkinsfile --- pipeline3/Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile index c62e9c3..e14c339 100644 --- a/pipeline3/Jenkinsfile +++ b/pipeline3/Jenkinsfile @@ -39,8 +39,7 @@ pipeline { script { def gitRepoUrl = 'https://github.com/rohanmane21/Python.git' def gitCredentialsId = 'admin' // Optional, if using credentials - - // Clone the repository + sh 'aws ec2 describe-instances --region ap-south-1' // Clone the repository checkout([$class: 'GitSCM', branches: [[name: '*/Testing']], doGenerateSubmoduleConfigurations: false, From 73f3d71fed6c9b42dca78ed7688915ea8523dc04 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Mon, 11 Sep 2023 14:20:00 +0530 Subject: [PATCH 046/103] Update Jenkinsfile --- pipeline3/Jenkinsfile | 86 +++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile index e14c339..c36fafa 100644 --- a/pipeline3/Jenkinsfile +++ b/pipeline3/Jenkinsfile @@ -1,15 +1,15 @@ -// pipeline { -// agent any -// stages { -// stage('test AWS credentials') { -// steps { -// withAWS(credentials: 'admin', region: 'ap-south-1') -// { -// sh 'python pipeline3/create_instance.py' -// } -// } -// } -// } +pipeline { + agent any + stages { + stage('test AWS credentials') { + steps { + withAWS(credentials: 'admin', region: 'ap-south-1') + { + sh 'python pipeline3/create_instance.py' + } + } + } + } // }// pipeline { // agent any // stages { @@ -28,40 +28,40 @@ // } // } // } -pipeline { - agent any +// pipeline { +// agent any - stages { - stage('Clone Repository') { - steps { - // Define the Git repository URL and credentials (if required) - script { - def gitRepoUrl = 'https://github.com/rohanmane21/Python.git' - def gitCredentialsId = 'admin' // Optional, if using credentials - sh 'aws ec2 describe-instances --region ap-south-1' // Clone the repository - checkout([$class: 'GitSCM', - branches: [[name: '*/Testing']], - doGenerateSubmoduleConfigurations: false, - extensions: [], - userRemoteConfigs: [[credentialsId: gitCredentialsId, url: gitRepoUrl]] - ]) - } - } - } - stage('Checkout') { - steps { - checkout scm - } - } +// stages { +// stage('Clone Repository') { +// steps { +// // Define the Git repository URL and credentials (if required) +// script { +// def gitRepoUrl = 'https://github.com/rohanmane21/Python.git' +// def gitCredentialsId = 'admin' // Optional, if using credentials +// sh 'aws ec2 describe-instances --region ap-south-1' // Clone the repository +// checkout([$class: 'GitSCM', +// branches: [[name: '*/Testing']], +// doGenerateSubmoduleConfigurations: false, +// extensions: [], +// userRemoteConfigs: [[credentialsId: gitCredentialsId, url: gitRepoUrl]] +// ]) +// } +// } +// } +// stage('Checkout') { +// steps { +// checkout scm +// } +// } - stage('Create EC2 Instance') { - steps { - sh 'python pipeline3/create_instance.py' - } - } - } -} +// stage('Create EC2 Instance') { +// steps { +// sh 'python pipeline3/create_instance.py' +// } +// } +// } +// } // al we created. // pipeline { From 483b54ba134f7f6f4aea7b997920987b7f218ecf Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 12:47:34 +0530 Subject: [PATCH 047/103] Update Jenkinsfile --- pipeline3/Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pipeline3/Jenkinsfile b/pipeline3/Jenkinsfile index c36fafa..27b44be 100644 --- a/pipeline3/Jenkinsfile +++ b/pipeline3/Jenkinsfile @@ -10,7 +10,8 @@ pipeline { } } } -// }// pipeline { +} +// pipeline { // agent any // stages { // stage('Example') { From 04c8dd6e89ebfeeed2ac48b0e849084e609ca331 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 12:55:02 +0530 Subject: [PATCH 048/103] Create policy.py --- pipeline4/policy.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 pipeline4/policy.py diff --git a/pipeline4/policy.py b/pipeline4/policy.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/pipeline4/policy.py @@ -0,0 +1 @@ + From 944b80aa7f69c803ad153736b39cb0f2d29d1a80 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 12:56:05 +0530 Subject: [PATCH 049/103] Create policy.json --- pipeline4/policy.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 pipeline4/policy.json diff --git a/pipeline4/policy.json b/pipeline4/policy.json new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/pipeline4/policy.json @@ -0,0 +1 @@ + From f5b33d55c61437aab6d142cb255a268e43600bd4 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 12:58:13 +0530 Subject: [PATCH 050/103] Create Jenkinsfile --- pipeline4/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) create mode 100644 pipeline4/Jenkinsfile diff --git a/pipeline4/Jenkinsfile b/pipeline4/Jenkinsfile new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/pipeline4/Jenkinsfile @@ -0,0 +1 @@ + From 9625c0866ff456d3bd93d3aaf9bbe25a0dc41074 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 13:02:55 +0530 Subject: [PATCH 051/103] Update policy.json --- pipeline4/policy.json | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pipeline4/policy.json b/pipeline4/policy.json index 8b13789..75cadd8 100644 --- a/pipeline4/policy.json +++ b/pipeline4/policy.json @@ -1 +1,13 @@ - +{ + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "Statement1", + "Effect": "Allow", + "Action": [ + "ec2:*" + ], + "Resource": [] + } + ] +} From 9ccf5a0a7a7dbf715b6ac1762dcc8d2bf0e8e7d0 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 13:06:20 +0530 Subject: [PATCH 052/103] Update policy.json --- pipeline4/policy.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline4/policy.json b/pipeline4/policy.json index 75cadd8..cde4eac 100644 --- a/pipeline4/policy.json +++ b/pipeline4/policy.json @@ -7,7 +7,7 @@ "Action": [ "ec2:*" ], - "Resource": [] + "Resource": "arn:aws:ec2:::*" } ] } From 6a2f8a9a15e8d4ad3607af802556ddd0b846254d Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 13:09:55 +0530 Subject: [PATCH 053/103] Update policy.py --- pipeline4/policy.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pipeline4/policy.py b/pipeline4/policy.py index 8b13789..6207e5c 100644 --- a/pipeline4/policy.py +++ b/pipeline4/policy.py @@ -1 +1,10 @@ +import boto3 +import json +user=boto3.client('iam') + +response = user.create_policy( +PolicyName=policy_name, +PolicyDocument=json.load(policy.json), +Description='All policy' +) From eb945903a022fb59d566de29a0ba0da8d50d3b04 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 13:12:52 +0530 Subject: [PATCH 054/103] Update Jenkinsfile --- pipeline4/Jenkinsfile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pipeline4/Jenkinsfile b/pipeline4/Jenkinsfile index 8b13789..d95393d 100644 --- a/pipeline4/Jenkinsfile +++ b/pipeline4/Jenkinsfile @@ -1 +1,13 @@ - +pipeline { + agent any + stages { + stage('Create Policy') { + steps { + withAWS(credentials: 'admin', region: 'ap-south-1') + { + sh 'python pipeline4/policy.py' + } + } + } + } +} From 43f3501b837f8faeca2a67bbe550e86b89718f1f Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 13:14:30 +0530 Subject: [PATCH 055/103] Update policy.py --- pipeline4/policy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipeline4/policy.py b/pipeline4/policy.py index 6207e5c..2e75551 100644 --- a/pipeline4/policy.py +++ b/pipeline4/policy.py @@ -3,8 +3,8 @@ user=boto3.client('iam') response = user.create_policy( -PolicyName=policy_name, -PolicyDocument=json.load(policy.json), +# PolicyName=policy_name, +PolicyDocument=json.load('policy.json'), Description='All policy' ) From 7acbd55bfb0d3c4e696512752b161da823a14e90 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 13:16:01 +0530 Subject: [PATCH 056/103] Update policy.py --- pipeline4/policy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline4/policy.py b/pipeline4/policy.py index 2e75551..f2292a5 100644 --- a/pipeline4/policy.py +++ b/pipeline4/policy.py @@ -4,7 +4,7 @@ response = user.create_policy( # PolicyName=policy_name, -PolicyDocument=json.load('policy.json'), +PolicyDocument=json.loads('policy.json'), Description='All policy' ) From c14cf4dfb582fe7dbaa34269e75cf68bb89b6719 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 13:27:59 +0530 Subject: [PATCH 057/103] Update policy.py --- pipeline4/policy.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pipeline4/policy.py b/pipeline4/policy.py index f2292a5..be86540 100644 --- a/pipeline4/policy.py +++ b/pipeline4/policy.py @@ -3,8 +3,10 @@ user=boto3.client('iam') response = user.create_policy( -# PolicyName=policy_name, -PolicyDocument=json.loads('policy.json'), +PolicyName='All_Policy', +f = open('policy.json') +PolicyDocument = json.load(f) +# =json.loads('policy.json'), Description='All policy' ) From 7af036c1f5220ad277f10c6687cc250b32cea30a Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 13:29:18 +0530 Subject: [PATCH 058/103] Update policy.py --- pipeline4/policy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipeline4/policy.py b/pipeline4/policy.py index be86540..9fc3ae0 100644 --- a/pipeline4/policy.py +++ b/pipeline4/policy.py @@ -4,8 +4,8 @@ response = user.create_policy( PolicyName='All_Policy', -f = open('policy.json') -PolicyDocument = json.load(f) +f = open('policy.json'), +PolicyDocument = json.load(f), # =json.loads('policy.json'), Description='All policy' ) From 4c6f5aff775713712bd4d10669044d95bb8bb15a Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 13:52:39 +0530 Subject: [PATCH 059/103] Update policy.py --- pipeline4/policy.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pipeline4/policy.py b/pipeline4/policy.py index 9fc3ae0..bb29f5e 100644 --- a/pipeline4/policy.py +++ b/pipeline4/policy.py @@ -1,12 +1,10 @@ import boto3 import json -user=boto3.client('iam') +user = boto3.client('iam') +with open('policy.json', 'r') as f: + policy_document = json.load(f) response = user.create_policy( -PolicyName='All_Policy', -f = open('policy.json'), -PolicyDocument = json.load(f), -# =json.loads('policy.json'), -Description='All policy' + PolicyName="All_P", + PolicyDocument=json.dumps(policy_document) ) - From 7276709899eeb7a8eaa6643177d5a36fcc56867f Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 13:58:42 +0530 Subject: [PATCH 060/103] Update policy.py --- pipeline4/policy.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/pipeline4/policy.py b/pipeline4/policy.py index bb29f5e..c006326 100644 --- a/pipeline4/policy.py +++ b/pipeline4/policy.py @@ -2,9 +2,17 @@ import json user = boto3.client('iam') -with open('policy.json', 'r') as f: - policy_document = json.load(f) -response = user.create_policy( - PolicyName="All_P", - PolicyDocument=json.dumps(policy_document) -) +def create_policy(): + with open('pipeline4/policy.json', 'r') as f: + policy_document = json.load(f) + response = user.create_policy( + PolicyName="All_Policy", + PolicyDocument=json.dumps(policy_document) + ) +def create_user(): + response = iam.create_user( + UserName='boburao' + ) + print(response) + +create_policy() From 0988727365c67e0528d36a581a194f15bb5436bc Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 15:40:18 +0530 Subject: [PATCH 061/103] Update policy.py --- pipeline4/policy.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pipeline4/policy.py b/pipeline4/policy.py index c006326..c3e2255 100644 --- a/pipeline4/policy.py +++ b/pipeline4/policy.py @@ -10,9 +10,14 @@ def create_policy(): PolicyDocument=json.dumps(policy_document) ) def create_user(): - response = iam.create_user( + response = user.create_user( UserName='boburao' ) - print(response) - -create_policy() +create_user() +def attach_policy(): + response = user.attach_user_policy( + UserName= 'boburao', + PolicyArn='arn:aws:iam::190616427825:policy/All_Policy' +) +attach_policy() +# create_policy() From 2e1c27650d4a9249363ba5d2be5ce0a4ae4ec585 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 15:54:10 +0530 Subject: [PATCH 062/103] Update policy.py --- pipeline4/policy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipeline4/policy.py b/pipeline4/policy.py index c3e2255..e83f1a8 100644 --- a/pipeline4/policy.py +++ b/pipeline4/policy.py @@ -13,11 +13,11 @@ def create_user(): response = user.create_user( UserName='boburao' ) -create_user() +# create_user() def attach_policy(): response = user.attach_user_policy( UserName= 'boburao', PolicyArn='arn:aws:iam::190616427825:policy/All_Policy' ) -attach_policy() +# attach_policy() # create_policy() From 51541b72f2f1587473ced6d4366463572f7159ff Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:04:11 +0530 Subject: [PATCH 063/103] Create Jenkinsfile --- create_policy/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) create mode 100644 create_policy/Jenkinsfile diff --git a/create_policy/Jenkinsfile b/create_policy/Jenkinsfile new file mode 100644 index 0000000..38ac180 --- /dev/null +++ b/create_policy/Jenkinsfile @@ -0,0 +1 @@ +cre From 454a8d30333dc0a5a747890478e5099132d71481 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:04:54 +0530 Subject: [PATCH 064/103] Create Jenkinsfile --- create_user/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) create mode 100644 create_user/Jenkinsfile diff --git a/create_user/Jenkinsfile b/create_user/Jenkinsfile new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/create_user/Jenkinsfile @@ -0,0 +1 @@ + From c747b9eface3926584f0929e107f0583a331904a Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:05:33 +0530 Subject: [PATCH 065/103] Create Jenkinsfile --- map_policy/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) create mode 100644 map_policy/Jenkinsfile diff --git a/map_policy/Jenkinsfile b/map_policy/Jenkinsfile new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/map_policy/Jenkinsfile @@ -0,0 +1 @@ + From f9e38c1b1838fc8972662335842b0eb2aba865c9 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:16:51 +0530 Subject: [PATCH 066/103] Update and rename Jenkinsfile to Jenkinsfile.py --- create_user/Jenkinsfile | 1 - create_user/Jenkinsfile.py | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) delete mode 100644 create_user/Jenkinsfile create mode 100644 create_user/Jenkinsfile.py diff --git a/create_user/Jenkinsfile b/create_user/Jenkinsfile deleted file mode 100644 index 8b13789..0000000 --- a/create_user/Jenkinsfile +++ /dev/null @@ -1 +0,0 @@ - diff --git a/create_user/Jenkinsfile.py b/create_user/Jenkinsfile.py new file mode 100644 index 0000000..4ffd4c8 --- /dev/null +++ b/create_user/Jenkinsfile.py @@ -0,0 +1,12 @@ +import boto3 +import json + +user = boto3.client('iam') +def create_policy(): + with open('pipeline4/policy.json', 'r') as f: + policy_document = json.load(f) + response = user.create_policy( + PolicyName="All_Policies", + PolicyDocument=json.dumps(policy_document) + ) +create_policy() From d10c3f5ab88fc70358da4c21858095719c7cacfb Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:25:45 +0530 Subject: [PATCH 067/103] Update and rename Jenkinsfile to Jenkinsfile.py --- create_policy/Jenkinsfile | 1 - create_policy/Jenkinsfile.py | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) delete mode 100644 create_policy/Jenkinsfile create mode 100644 create_policy/Jenkinsfile.py diff --git a/create_policy/Jenkinsfile b/create_policy/Jenkinsfile deleted file mode 100644 index 38ac180..0000000 --- a/create_policy/Jenkinsfile +++ /dev/null @@ -1 +0,0 @@ -cre diff --git a/create_policy/Jenkinsfile.py b/create_policy/Jenkinsfile.py new file mode 100644 index 0000000..4ffd4c8 --- /dev/null +++ b/create_policy/Jenkinsfile.py @@ -0,0 +1,12 @@ +import boto3 +import json + +user = boto3.client('iam') +def create_policy(): + with open('pipeline4/policy.json', 'r') as f: + policy_document = json.load(f) + response = user.create_policy( + PolicyName="All_Policies", + PolicyDocument=json.dumps(policy_document) + ) +create_policy() From 867764220da6b5c51f9255383dc2a1c62a3e752a Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:28:56 +0530 Subject: [PATCH 068/103] Update Jenkinsfile.py --- create_user/Jenkinsfile.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/create_user/Jenkinsfile.py b/create_user/Jenkinsfile.py index 4ffd4c8..fdd5abb 100644 --- a/create_user/Jenkinsfile.py +++ b/create_user/Jenkinsfile.py @@ -2,11 +2,9 @@ import json user = boto3.client('iam') -def create_policy(): - with open('pipeline4/policy.json', 'r') as f: - policy_document = json.load(f) - response = user.create_policy( - PolicyName="All_Policies", - PolicyDocument=json.dumps(policy_document) + +def create_user(): + response = user.create_user( + UserName='boburao' ) -create_policy() +create_user() From 8beb209e9a0b739af8cb6c01bcfe7526f7a8f514 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:31:13 +0530 Subject: [PATCH 069/103] Update and rename Jenkinsfile to Jenkinsfile.py --- map_policy/Jenkinsfile | 1 - map_policy/Jenkinsfile.py | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) delete mode 100644 map_policy/Jenkinsfile create mode 100644 map_policy/Jenkinsfile.py diff --git a/map_policy/Jenkinsfile b/map_policy/Jenkinsfile deleted file mode 100644 index 8b13789..0000000 --- a/map_policy/Jenkinsfile +++ /dev/null @@ -1 +0,0 @@ - diff --git a/map_policy/Jenkinsfile.py b/map_policy/Jenkinsfile.py new file mode 100644 index 0000000..48bf8c0 --- /dev/null +++ b/map_policy/Jenkinsfile.py @@ -0,0 +1,11 @@ + +import boto3 +import json + +user = boto3.client('iam') +def attach_policy(): + response = user.attach_user_policy( + UserName= 'boburao', + PolicyArn='arn:aws:iam::190616427825:policy/All_Policy' +) +attach_policy() From 2e8a1e51b6c6746fcf0c67c9510b39271fb67b27 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:32:11 +0530 Subject: [PATCH 070/103] Update Jenkinsfile.py --- create_policy/Jenkinsfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/create_policy/Jenkinsfile.py b/create_policy/Jenkinsfile.py index 4ffd4c8..db5648a 100644 --- a/create_policy/Jenkinsfile.py +++ b/create_policy/Jenkinsfile.py @@ -6,7 +6,7 @@ def create_policy(): with open('pipeline4/policy.json', 'r') as f: policy_document = json.load(f) response = user.create_policy( - PolicyName="All_Policies", + PolicyName="All_Policy", PolicyDocument=json.dumps(policy_document) ) -create_policy() +# create_policy() From cccdf4ad26ecd13a2bdff59d4a5878dba8f87ffb Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:33:07 +0530 Subject: [PATCH 071/103] Create policy.json --- create_policy/policy.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 create_policy/policy.json diff --git a/create_policy/policy.json b/create_policy/policy.json new file mode 100644 index 0000000..cde4eac --- /dev/null +++ b/create_policy/policy.json @@ -0,0 +1,13 @@ +{ + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "Statement1", + "Effect": "Allow", + "Action": [ + "ec2:*" + ], + "Resource": "arn:aws:ec2:::*" + } + ] +} From daa5d18db886be91d363473dcb3e047e93f8c78f Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:40:51 +0530 Subject: [PATCH 072/103] Create Jenkinsfile --- pipeline5/Jenkinsfile | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 pipeline5/Jenkinsfile diff --git a/pipeline5/Jenkinsfile b/pipeline5/Jenkinsfile new file mode 100644 index 0000000..821c00e --- /dev/null +++ b/pipeline5/Jenkinsfile @@ -0,0 +1,35 @@ +pipeline { + agent any + stages { + stage{ + steps{ + withAWS(credentials: 'admin', region: 'ap-south-1') + } + + } + stage('Create IAM User') { + steps { + script { + // Call the Create IAM User Pipeline + sh 'python create_user/Jenkinsfile.py' + } + } + } + stage('Create IAM Policy') { + steps { + script { + // Call the Create IAM Policy Pipeline + sh 'python create_policy/Jenkinsfile.py' + } + } + } + stage('Attach Policy to User') { + steps { + script { + // Call the Attach Policy to User Pipeline + sh 'python map_policy/Jenkinsfile.py' + } + } + } + } +} From 5958c3322d35f3fdbbf4e19efdbcbf1c4724eeef Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:45:53 +0530 Subject: [PATCH 073/103] Update Jenkinsfile --- pipeline5/Jenkinsfile | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/pipeline5/Jenkinsfile b/pipeline5/Jenkinsfile index 821c00e..6a235c7 100644 --- a/pipeline5/Jenkinsfile +++ b/pipeline5/Jenkinsfile @@ -1,34 +1,24 @@ pipeline { agent any stages { - stage{ - steps{ - withAWS(credentials: 'admin', region: 'ap-south-1') - } - + stage('Create Policy') { + steps { + withAWS(credentials: 'admin', region: 'ap-south-1') + } } - stage('Create IAM User') { + stage('Policy') { steps { - script { - // Call the Create IAM User Pipeline - sh 'python create_user/Jenkinsfile.py' - } + build job: 'create_policy', wait: false } } - stage('Create IAM Policy') { + stage('User') { steps { - script { - // Call the Create IAM Policy Pipeline - sh 'python create_policy/Jenkinsfile.py' - } + build job: 'create_user', wait: false } } - stage('Attach Policy to User') { + stage('Map') { steps { - script { - // Call the Attach Policy to User Pipeline - sh 'python map_policy/Jenkinsfile.py' - } + build job: 'map_policy', wait: true } } } From 9887447b2d5476d741c2f3797105adec52db1f96 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:48:03 +0530 Subject: [PATCH 074/103] Rename Jenkinsfile.py to create_policy.py --- create_policy/{Jenkinsfile.py => create_policy.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename create_policy/{Jenkinsfile.py => create_policy.py} (100%) diff --git a/create_policy/Jenkinsfile.py b/create_policy/create_policy.py similarity index 100% rename from create_policy/Jenkinsfile.py rename to create_policy/create_policy.py From 791b4bfaec132a77b332f821ee7586325b90a1bb Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:49:10 +0530 Subject: [PATCH 075/103] Create Jenkinsfile --- create_policy/Jenkinsfile | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 create_policy/Jenkinsfile diff --git a/create_policy/Jenkinsfile b/create_policy/Jenkinsfile new file mode 100644 index 0000000..f93bf9b --- /dev/null +++ b/create_policy/Jenkinsfile @@ -0,0 +1,11 @@ +pipeline { + agent any + stages { + stage('Create Policy') { + steps { + // Add steps to create an IAM policy + sh 'python create_policy/create_policy.py' + } + } + } +} From 0891605f7977448ec34fe4f1c2893da767070f47 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:50:12 +0530 Subject: [PATCH 076/103] Rename Jenkinsfile.py to create_user.py --- create_user/{Jenkinsfile.py => create_user.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename create_user/{Jenkinsfile.py => create_user.py} (100%) diff --git a/create_user/Jenkinsfile.py b/create_user/create_user.py similarity index 100% rename from create_user/Jenkinsfile.py rename to create_user/create_user.py From f3cfade841d4ad4894af905d38d45ac6a3f48ce3 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:50:52 +0530 Subject: [PATCH 077/103] Create Jenkinsfile --- create_user/Jenkinsfile | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 create_user/Jenkinsfile diff --git a/create_user/Jenkinsfile b/create_user/Jenkinsfile new file mode 100644 index 0000000..06f4ccd --- /dev/null +++ b/create_user/Jenkinsfile @@ -0,0 +1,11 @@ +pipeline { + agent any + stages { + stage('Create IAM User') { + steps { + // Add steps to create an IAM user + sh 'python create_user.py' + } + } + } +} From 62ce27b462e09d71c68ddd2d809e98d733eb1b6d Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:51:42 +0530 Subject: [PATCH 078/103] Update Jenkinsfile --- create_user/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create_user/Jenkinsfile b/create_user/Jenkinsfile index 06f4ccd..9521662 100644 --- a/create_user/Jenkinsfile +++ b/create_user/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { stage('Create IAM User') { steps { // Add steps to create an IAM user - sh 'python create_user.py' + sh 'python create_user/create_user.py' } } } From e4800686ed9cfb3e6b750fa1372e077a95b8c2d3 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:52:16 +0530 Subject: [PATCH 079/103] Rename Jenkinsfile.py to map.py --- map_policy/{Jenkinsfile.py => map.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename map_policy/{Jenkinsfile.py => map.py} (100%) diff --git a/map_policy/Jenkinsfile.py b/map_policy/map.py similarity index 100% rename from map_policy/Jenkinsfile.py rename to map_policy/map.py From f3fe60fa1372d0a907c33bc6d3f662141098309e Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:54:16 +0530 Subject: [PATCH 080/103] Create Jenkinsfile --- map_policy/Jenkinsfile | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 map_policy/Jenkinsfile diff --git a/map_policy/Jenkinsfile b/map_policy/Jenkinsfile new file mode 100644 index 0000000..d65b220 --- /dev/null +++ b/map_policy/Jenkinsfile @@ -0,0 +1,11 @@ +pipeline { + agent any + stages { + stage('Attach Policy') { + steps { + // Add steps to attach a policy to a user + sh 'python map_policy/map.py' + } + } + } +} From 044b0ba3e252171f5d8eda2f803e78a24c38e124 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 21:59:48 +0530 Subject: [PATCH 081/103] Update Jenkinsfile --- pipeline5/Jenkinsfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pipeline5/Jenkinsfile b/pipeline5/Jenkinsfile index 6a235c7..577c0e4 100644 --- a/pipeline5/Jenkinsfile +++ b/pipeline5/Jenkinsfile @@ -3,7 +3,10 @@ pipeline { stages { stage('Create Policy') { steps { - withAWS(credentials: 'admin', region: 'ap-south-1') + withAWS(credentials: 'admin', region: 'ap-south-1') + { + echo 'Hello' + } } } stage('Policy') { From 1871ab9fe0a98fb0bd61a42710efcc923eb12796 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 22:10:27 +0530 Subject: [PATCH 082/103] Update Jenkinsfile --- map_policy/Jenkinsfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/map_policy/Jenkinsfile b/map_policy/Jenkinsfile index d65b220..47bc19e 100644 --- a/map_policy/Jenkinsfile +++ b/map_policy/Jenkinsfile @@ -1,10 +1,12 @@ pipeline { agent any stages { - stage('Attach Policy') { + stage('Create Policy') { steps { - // Add steps to attach a policy to a user - sh 'python map_policy/map.py' + withAWS(credentials: 'admin', region: 'ap-south-1') + { + sh 'python map_policy/map.py' + } } } } From 70de0ed15b66e95ed82e87da00b000c258a3563c Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 22:14:03 +0530 Subject: [PATCH 083/103] Update Jenkinsfile --- create_user/Jenkinsfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/create_user/Jenkinsfile b/create_user/Jenkinsfile index 9521662..25709e8 100644 --- a/create_user/Jenkinsfile +++ b/create_user/Jenkinsfile @@ -3,8 +3,10 @@ pipeline { stages { stage('Create IAM User') { steps { - // Add steps to create an IAM user - sh 'python create_user/create_user.py' + withAWS(credentials: 'admin', region: 'ap-south-1') + { + sh 'python create_user/create_user.py' + } } } } From 2a81bf5c63269fa55739450c67cbaa991d86544e Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Thu, 14 Sep 2023 22:14:50 +0530 Subject: [PATCH 084/103] Update Jenkinsfile --- create_policy/Jenkinsfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/create_policy/Jenkinsfile b/create_policy/Jenkinsfile index f93bf9b..1455d38 100644 --- a/create_policy/Jenkinsfile +++ b/create_policy/Jenkinsfile @@ -3,8 +3,10 @@ pipeline { stages { stage('Create Policy') { steps { - // Add steps to create an IAM policy - sh 'python create_policy/create_policy.py' + withAWS(credentials: 'admin', region: 'ap-south-1') + { + sh 'python create_policy/create_policy.py' + } } } } From 61125cfc05dea825fd12942d74ece0cea4d0d25f Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Fri, 15 Sep 2023 15:31:42 +0530 Subject: [PATCH 085/103] Create Jenkinsfile --- Gmail/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) create mode 100644 Gmail/Jenkinsfile diff --git a/Gmail/Jenkinsfile b/Gmail/Jenkinsfile new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Gmail/Jenkinsfile @@ -0,0 +1 @@ + From d985b7c266f479f1620071a3f699721f56d95319 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Fri, 15 Sep 2023 15:32:08 +0530 Subject: [PATCH 086/103] Create sent_email.py --- Gmail/sent_email.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 Gmail/sent_email.py diff --git a/Gmail/sent_email.py b/Gmail/sent_email.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Gmail/sent_email.py @@ -0,0 +1 @@ + From 0d551ffbb4b54acf845e4c0e7ec6ff1c224fa89f Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Fri, 15 Sep 2023 15:32:54 +0530 Subject: [PATCH 087/103] Create failed.py --- Gmail/failed.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 Gmail/failed.py diff --git a/Gmail/failed.py b/Gmail/failed.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Gmail/failed.py @@ -0,0 +1 @@ + From 836b016172ace4d794c50df51dc0d214bf7d9245 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Fri, 15 Sep 2023 15:33:21 +0530 Subject: [PATCH 088/103] Rename sent_email.py to success.py --- Gmail/{sent_email.py => success.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Gmail/{sent_email.py => success.py} (100%) diff --git a/Gmail/sent_email.py b/Gmail/success.py similarity index 100% rename from Gmail/sent_email.py rename to Gmail/success.py From 4f5b5f5463cafcafd5a614554cdc3810e82ffd75 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Fri, 15 Sep 2023 15:37:52 +0530 Subject: [PATCH 089/103] Update success.py --- Gmail/success.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Gmail/success.py b/Gmail/success.py index 8b13789..35863b4 100644 --- a/Gmail/success.py +++ b/Gmail/success.py @@ -1 +1,28 @@ - +import smtplib +from email.mime.multipart import MIMEMultipart +from email.mime.text import MIMEText +# Gmail account details +gmail_user = 'rohan4562002@gmail.com' # Your Gmail address +gmail_app_password = 'D3E0A81974662ABDCDDAF2E377A98D973E98' # Use the App Password generated earlier +# Email details +to_email = 'hr@technobrilliant.com' # Recipient's email address +subject = 'Hello from Rohan' +message = 'This is a test email sent from Rohan using smtplib.' +# Create a MIMEText object with your message +msg = MIMEMultipart() +msg['From'] = gmail_user +msg['To'] = to_email +msg['Subject'] = subject +msg.attach(MIMEText(message, 'plain')) +# Connect to Gmail's SMTP server +try: + server = smtplib.SMTP('smtp.elasticemail.com', 2525) + server.starttls() + server.login(gmail_user, gmail_app_password) + # Send the email + server.sendmail(gmail_user, to_email, msg.as_string()) + print('Email sent successfully!') +except Exception as e: + print(f'Error: {str(e)}') +finally: + server.quit() From 61b270df51312e9af45d1b72ba879e7d516374f1 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Fri, 15 Sep 2023 15:39:43 +0530 Subject: [PATCH 090/103] Update failed.py --- Gmail/failed.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Gmail/failed.py b/Gmail/failed.py index 8b13789..2f5d84f 100644 --- a/Gmail/failed.py +++ b/Gmail/failed.py @@ -1 +1,28 @@ - +import smtplib +from email.mime.multipart import MIMEMultipart +from email.mime.text import MIMEText +# Gmail account details +gmail_user = 'rohan4562002@gmail.com' # Your Gmail address +gmail_app_password = 'D3E0A81974662ABDCDDAF2E377A98D973E98' # Use the App Password generated earlier +# Email details +to_email = 'hr@technobrilliant.com' # Recipient's email address +subject = 'Hello from Rohan' +message = 'Pipeline Failed.' +# Create a MIMEText object with your message +msg = MIMEMultipart() +msg['From'] = gmail_user +msg['To'] = to_email +msg['Subject'] = subject +msg.attach(MIMEText(message, 'plain')) +# Connect to Gmail's SMTP server +try: + server = smtplib.SMTP('smtp.elasticemail.com', 2525) + server.starttls() + server.login(gmail_user, gmail_app_password) + # Send the email + server.sendmail(gmail_user, to_email, msg.as_string()) + print('Email sent successfully!') +except Exception as e: + print(f'Error: {str(e)}') +finally: + server.quit() From a9fead6c2759cca611e87c9eed092f7a10c0e77c Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Fri, 15 Sep 2023 15:40:25 +0530 Subject: [PATCH 091/103] Update success.py --- Gmail/success.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gmail/success.py b/Gmail/success.py index 35863b4..a34087c 100644 --- a/Gmail/success.py +++ b/Gmail/success.py @@ -7,7 +7,7 @@ # Email details to_email = 'hr@technobrilliant.com' # Recipient's email address subject = 'Hello from Rohan' -message = 'This is a test email sent from Rohan using smtplib.' +message = 'Pipeline run successful.' # Create a MIMEText object with your message msg = MIMEMultipart() msg['From'] = gmail_user From bda1f0f5249c8b208d5d38aee1b8ff2fa477fdec Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Fri, 15 Sep 2023 15:46:46 +0530 Subject: [PATCH 092/103] Update Jenkinsfile --- Gmail/Jenkinsfile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Gmail/Jenkinsfile b/Gmail/Jenkinsfile index 8b13789..eb5c7b8 100644 --- a/Gmail/Jenkinsfile +++ b/Gmail/Jenkinsfile @@ -1 +1,28 @@ +pipeline { + agent any + environment { + AWS_DEFAULT_REGION = 'ap-south-1' + AWS_ACCESS_KEY_ID = credentials('admin') + IAM_USERNAME = 'new55' + } + stages{ + stage('Create IAM User') { + steps { + script { + sh """ + aws iam create-user --user-name ${env.IAM_USERNAME} + """ + } + } + } + } + post{ + success{ + sh'python success.py' + } + failed{ + sh 'python failed.py' + } + } + } From 8dfbbbcd524f27d358f437a1203a9d310512034b Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Fri, 15 Sep 2023 15:47:28 +0530 Subject: [PATCH 093/103] Update success.py --- Gmail/success.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gmail/success.py b/Gmail/success.py index a34087c..ea7f164 100644 --- a/Gmail/success.py +++ b/Gmail/success.py @@ -6,7 +6,7 @@ gmail_app_password = 'D3E0A81974662ABDCDDAF2E377A98D973E98' # Use the App Password generated earlier # Email details to_email = 'hr@technobrilliant.com' # Recipient's email address -subject = 'Hello from Rohan' +subject = 'Rohan Mane' message = 'Pipeline run successful.' # Create a MIMEText object with your message msg = MIMEMultipart() From 1679ef38f3e29fffb2931031bd43fa59fb6517a1 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Fri, 15 Sep 2023 15:48:18 +0530 Subject: [PATCH 094/103] Update failed.py --- Gmail/failed.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gmail/failed.py b/Gmail/failed.py index 2f5d84f..e50e65a 100644 --- a/Gmail/failed.py +++ b/Gmail/failed.py @@ -6,7 +6,7 @@ gmail_app_password = 'D3E0A81974662ABDCDDAF2E377A98D973E98' # Use the App Password generated earlier # Email details to_email = 'hr@technobrilliant.com' # Recipient's email address -subject = 'Hello from Rohan' +subject = 'Rohan Mane' message = 'Pipeline Failed.' # Create a MIMEText object with your message msg = MIMEMultipart() From bdcf5f77900faa48a886632d9991c282a0e6f808 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Fri, 15 Sep 2023 15:55:31 +0530 Subject: [PATCH 095/103] Update Jenkinsfile --- Gmail/Jenkinsfile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Gmail/Jenkinsfile b/Gmail/Jenkinsfile index eb5c7b8..a25ba73 100644 --- a/Gmail/Jenkinsfile +++ b/Gmail/Jenkinsfile @@ -5,8 +5,16 @@ pipeline { AWS_DEFAULT_REGION = 'ap-south-1' AWS_ACCESS_KEY_ID = credentials('admin') IAM_USERNAME = 'new55' + GIT_REPO_URL = 'https://github.com/rohanmane21/Python.git' } stages{ + stage('Check Credendtial'){ + steps { + script { + git branch: 'Testing', credentialsId: 'git-token', url: env.GIT_REPO_URL + } +      } + } stage('Create IAM User') { steps { script { @@ -19,10 +27,10 @@ pipeline { } post{ success{ - sh'python success.py' + sh 'python Gmail/success.py' } failed{ - sh 'python failed.py' + sh 'python Gmail/failed.py' } } } From 462263d6dd856789095a46644fd32b9572b7da6d Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Fri, 15 Sep 2023 15:56:24 +0530 Subject: [PATCH 096/103] Update Jenkinsfile --- Gmail/Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Gmail/Jenkinsfile b/Gmail/Jenkinsfile index a25ba73..ffd847d 100644 --- a/Gmail/Jenkinsfile +++ b/Gmail/Jenkinsfile @@ -14,7 +14,6 @@ pipeline { git branch: 'Testing', credentialsId: 'git-token', url: env.GIT_REPO_URL }      } - } stage('Create IAM User') { steps { script { From 8eea8a71051e0f4e84c4cc9aabb4491fa1a6669d Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Fri, 15 Sep 2023 15:59:03 +0530 Subject: [PATCH 097/103] Update Jenkinsfile --- Gmail/Jenkinsfile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Gmail/Jenkinsfile b/Gmail/Jenkinsfile index ffd847d..f79a031 100644 --- a/Gmail/Jenkinsfile +++ b/Gmail/Jenkinsfile @@ -14,12 +14,13 @@ pipeline { git branch: 'Testing', credentialsId: 'git-token', url: env.GIT_REPO_URL }      } + } stage('Create IAM User') { - steps { - script { - sh """ - aws iam create-user --user-name ${env.IAM_USERNAME} - """ + steps { + script { + sh """ + aws iam create-user --user-name ${env.IAM_USERNAME} + """ } } } @@ -32,4 +33,4 @@ pipeline { sh 'python Gmail/failed.py' } } - } +} From 2ec2c0e684329e5d831006d7918f47e317484170 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Fri, 15 Sep 2023 16:00:48 +0530 Subject: [PATCH 098/103] Update Jenkinsfile --- Gmail/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gmail/Jenkinsfile b/Gmail/Jenkinsfile index f79a031..b12e675 100644 --- a/Gmail/Jenkinsfile +++ b/Gmail/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { git branch: 'Testing', credentialsId: 'git-token', url: env.GIT_REPO_URL }      } - } + } stage('Create IAM User') { steps { script { From c3289af5661b15402d79c41f1ac48916d3fa8c20 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Fri, 15 Sep 2023 16:05:04 +0530 Subject: [PATCH 099/103] Update Jenkinsfile --- Gmail/Jenkinsfile | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/Gmail/Jenkinsfile b/Gmail/Jenkinsfile index b12e675..d38a0a9 100644 --- a/Gmail/Jenkinsfile +++ b/Gmail/Jenkinsfile @@ -8,29 +8,30 @@ pipeline { GIT_REPO_URL = 'https://github.com/rohanmane21/Python.git' } stages{ - stage('Check Credendtial'){ - steps { + stage('Adding git credentials'){ + steps { script { - git branch: 'Testing', credentialsId: 'git-token', url: env.GIT_REPO_URL + git branch: 'Testing', credentialsId: 'Git-Token', url: env.GIT_REPO_URL } -      } + } } - stage('Create IAM User') { - steps { - script { - sh """ - aws iam create-user --user-name ${env.IAM_USERNAME} - """ + stage('Create IAM User') { + steps { + script { + sh """ + aws iam create-user --user-name ${env.IAM_USERNAME} + """ } } } } post{ success{ - sh 'python Gmail/success.py' + sh'python Gmail/success.py ' } - failed{ - sh 'python Gmail/failed.py' + failure{ + sh'python Gmail/failed.py ' } } -} + } + From 359dbeab904dbc804d426c3f3f1e07bf7354e9c0 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Tue, 28 Nov 2023 12:28:58 +0530 Subject: [PATCH 100/103] Update Jenkinsfile --- pipeline1/Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pipeline1/Jenkinsfile b/pipeline1/Jenkinsfile index 66f5806..da2a28a 100644 --- a/pipeline1/Jenkinsfile +++ b/pipeline1/Jenkinsfile @@ -14,11 +14,10 @@ pipeline { steps { script { // Assuming your Python script is named 'my_script.py' - def pythonScript = 'my_script.py' // Execute the Python script using the 'sh' step // You may need to specify the Python interpreter if it's not in the PATH - sh "python ${pythonScript}" + sh "python my-script" } } } From e9ceb31122c968a830579dc0eda78a2f82ab17a8 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Tue, 28 Nov 2023 12:29:23 +0530 Subject: [PATCH 101/103] Update Jenkinsfile --- pipeline1/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline1/Jenkinsfile b/pipeline1/Jenkinsfile index da2a28a..f03006f 100644 --- a/pipeline1/Jenkinsfile +++ b/pipeline1/Jenkinsfile @@ -17,7 +17,7 @@ pipeline { // Execute the Python script using the 'sh' step // You may need to specify the Python interpreter if it's not in the PATH - sh "python my-script" + sh "python my-script.py" } } } From 5dde5d8a718b0e819959bc739f8383e5bb2c9197 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Tue, 28 Nov 2023 12:45:09 +0530 Subject: [PATCH 102/103] Update Jenkinsfile --- pipeline1/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline1/Jenkinsfile b/pipeline1/Jenkinsfile index f03006f..db5ae68 100644 --- a/pipeline1/Jenkinsfile +++ b/pipeline1/Jenkinsfile @@ -17,7 +17,7 @@ pipeline { // Execute the Python script using the 'sh' step // You may need to specify the Python interpreter if it's not in the PATH - sh "python my-script.py" + echo 'Hello World' } } } From e5827558c72d94b5555cbdd732733a9843dcf2d8 Mon Sep 17 00:00:00 2001 From: rohanmane21 <143586966+rohanmane21@users.noreply.github.com> Date: Tue, 28 Nov 2023 12:51:42 +0530 Subject: [PATCH 103/103] Update Jenkinsfile --- pipeline1/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline1/Jenkinsfile b/pipeline1/Jenkinsfile index db5ae68..c52d079 100644 --- a/pipeline1/Jenkinsfile +++ b/pipeline1/Jenkinsfile @@ -17,7 +17,7 @@ pipeline { // Execute the Python script using the 'sh' step // You may need to specify the Python interpreter if it's not in the PATH - echo 'Hello World' + sh 'python my_script.py' } } }