Skip to content

Commit c210705

Browse files
TDeSainTombp85Gcolon021
authored
Release/new infrastructure/0001 (#93)
* Initial work to make create jenkins job configurable. * added new job to update config.xml to s3 * added new global properties to pass variables from centralized location to ( terraform and user-scripts ). * removed local parameters from create jenkins job * updated names for variables to more meaningful names * updated cidr terraform vars to be list. * grouped terraform security group ingress rules to be list instead of strings. Grouped by ingress rule function ( http, https, etc.. ) * making the jenkins git repo a global parameter * update to add dsm-url to user-script ( install-docker.sh ) * update to variable name in user-script * removing quotes for ami-id so it can pass variable * config updates for repos and git hashes * adding script to initialize jenkins * rework done on jenkins configurations and deployment * making maven more agnostic to version being deployed * making terraform configurable * IAC imporovements to Docker, Terraform and Jenkins * cleaning up variable naming standards for configurations * will be doing cleanup on jobs to use naming standard for variables * removing the .12 terraform experimental variable validation =( * removing a sg * fixing up some variable naming standards * updating maven variable name * more naming standards. * and some more... * updating location of user-script to more configurable * removing line terminator * user-script update * pulling some naming standards into user-script * docker args clean up * changing some things for it to be more environment agnostic * keystore is fine * missing xml closure * Update for destroy job to use new vars * useful gitignore to update jobs * gitignore * Latest jobs from dev work * Adding Maven apt-get work to ICA work * Minor naming convention update and deactivating non-fisma provider to prevent it from being applied. * Adding a script that should be able to initialize a jenkins server from an ec2. * latest state of jobs for configuring dev * changes to initialize jenkins * Latest jobs before * cleanup user-data, lookup AMI * more changes for deploy * more cleanup * fix * fixes * boolean -> bool * syntax * pass git commit * syntax * use git repo * update destroy job * fix jenkins creation * aws binary * more job changes * quotes * combine into one policy statement * fix assume role code * fix jobs * bucket policy * fix hpds job * more fix * Add open access param * Syncing jobs with current open-pic-sure state * update aws cli path shouldn't need to use an explicit path * Removing unused variable * Workaround for python introducing externally-managed-environment * Updating Script Approvals to be sha512 * Add missing IDP provider in teardown * [ALS-4884] Add analytics_id to terraform destroy and apply (#68) * [ALS-4998] Add new env vars to terraform * syncing jenkins jobs from current state to test in auth * update for analytics, open access and project id * syncing job changes. * rebase off open-picsure * add more changes * merge conflict * duplication * cleanup * declaring program variable * fix path * Add proj to name * program * Remove ssh * Feature/swap stacks (#72) * Update for including aws-cli functionality to perform swapping the green blue environments. * no need to use /usr/bin * Some logging for clarity in console. * forcing a new hash for some reason Terraform does not like the previous commit. No terraform changes were made. This commit terraform works 8964fee This commit terraform breaks 43fe6ac --------- Co-authored-by: Tom <Tom@dbmitdesainsmbp.private.wireless.med.harvard.edu> * global var for httpd staging vhost * remove unused var * Feature/fix jenkins state (#75) * Initial changes for fixing jenkins destroying itself * removing git commit from sg name - will be a random string * wget for jenkins archive fix * resource not data * create before destroying. * need to handle tags better. * Should create this tag even if we use aws cli to update it. * if terraform refreshes tags it will delete unmanaged tags. * just var * cap * moving to a green / blue stack method. * Green will be auto-promoted to blue on successful init * blue should remain functional until successful init * blue should be demoted to a * destroy job will always just destroy green. * leaving blue / green explict for now. * fixes * improving initcomplete tag lookup * method to rollback blue to green. * lowercase true * using arguments * pkcs12 as env var in container instead of user-script * removing build and just loading and running image * one dollar sign * remove misc code * moving build to jenkins job and out of user-script * config.xml.override didn't override.. * testing new create new jenkins job * removing bucket policy job * deleting unused jobs * bye bye update bucket policy * this is no longer used * Feature/build container in jenkins job (#76) * using arguments * pkcs12 as env var in container instead of user-script * removing build and just loading and running image * one dollar sign * remove misc code * moving build to jenkins job and out of user-script * config.xml.override didn't override.. * testing new create new jenkins job * removing bucket policy job * deleting unused jobs * bye bye update bucket policy * this is no longer used * added automatic dns swap for rollback and checking condition of green state while rolling back and deploying new server * fixing json flag --------- Co-authored-by: Tom <Tom@dbmitdesainsmbp.private.wireless.med.harvard.edu> * fixing conditional should be true statements for conditional * Removing reliance in jenkins to use the stack_s3_bucket. * This way the CI state is not bound to the application's s3 bucket. --------- Co-authored-by: Tom <Tom@dbmitdesainsmbp.private.wireless.med.harvard.edu> * latest updates: (#83) * tga priv_ips need to be stored in an Array not string to iterate over * adding tag_manager_id variable Co-authored-by: Tom <Tom@dbmitdesainsmbp.private.wireless.med.harvard.edu> * removing unused variable * Sync last open release with auth-migration release (#88) * [ALS-5164] Create new open access job (#86) [ALS-5164] Update deployment pipeline Our deployment pipeline to conditionally run the Open Access build. [ALS-5164] Add logic to handle potential errors These cases can happen if its not open access or a version of open access is used that doesn't contain psamaui. * Need to stage this file so it's always available for open. (#87) * Fence mapping is now needed for all environments. --------- Co-authored-by: Gcolon021 <34667267+Gcolon021@users.noreply.github.com> * [ALS-5279] - Adding Role Strategy Plugin (#89) * # Disable plugin. Making dockerfile more configurable. * added configuration to disable setup wizard * added configurations to make args optional in order to make container more portable. * Swap user around * moving debian sources * some bash cleanup * trying this way * Should do that stuff as entrypoints removing * adding cleanup and some ideas * adding role-strategy plugin * removing auto skip setup wizard. * Syncing jobs from auth-dev --------- Co-authored-by: Tom <Tom@dbmitdesainsmbp.private.wireless.med.harvard.edu> * ALS-5153 (#90) # improving RDS strategies * added functions to dynamically handle different scenarios for managing RDS instances. * Strategies are stubs atm for standalone. Should add functionality to these blocks. * added continous assume role to await init to avoid assumed role timeout. The job itself will handle init timeout. set to 4 hrs currently. Build out timer in the job. --------- Co-authored-by: Tom <Tom@dbmitdesainsmbp.private.wireless.med.harvard.edu> * Sourcing scripts to rollback jenkins (#91) --------- Co-authored-by: Tom <Tom@dbmitdesainsmbp.private.wireless.med.harvard.edu> * [ALS-5344] Banner config now uploads to S3 (#92) [ALS-5344] Banner config now uploads to S3 (#92) * Updating readme documentation --------- Co-authored-by: Tom <Tom@dbmitdesainsmbp.private.wireless.med.harvard.edu> Co-authored-by: bp85 <bhanu_prasad@hms.harvard.edu> Co-authored-by: gcolon021 <gcolon021@gmail.com> Co-authored-by: Gcolon021 <34667267+Gcolon021@users.noreply.github.com>
1 parent 10929e8 commit c210705

File tree

65 files changed

+2941
-1879
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2941
-1879
lines changed

README.md

+41-136
Original file line numberDiff line numberDiff line change
@@ -1,146 +1,51 @@
1-
Prerequisites:
2-
3-
AWS CLI installed and configured with admin access to the C&C account.
4-
Terraform installed
5-
Git installed
6-
7-
8-
Create new S3 bucket for new Jenkins instance to use setting the following options DURING CREATION some can't be set after
9-
- bucket should be named using the following template : avillach-biodatacatalyst-deployments-<Random 7 hex digits>
10-
- Object Locking must be enabled
11-
- Encryption should be AES-256
12-
- Enable Object-level logging as secrets are stored in this bucket
13-
- Enable versioning
14-
- Server access logging enabled (hms-dbmi-cnc-cloudtrail, no target prefix)
15-
16-
Set Bucket Policy in the Permissions section for the bucket to the following after replacing __BUCKET_NAME__ with the bucket name:
17-
18-
-----------------------------------------------------
19-
{
20-
"Version": "2012-10-17",
21-
"Statement": [
22-
{
23-
"Effect": "Allow",
24-
"Principal": {
25-
"AWS": "arn:aws:iam::191687121306:role/hms-dbmi-cnc-role"
26-
},
27-
"Action": [
28-
"s3:GetObject",
29-
"s3:PutObject",
30-
"s3:PutObjectAcl",
31-
"s3:GetObjectAcl",
32-
"s3:GetObjectTagging",
33-
"s3:DeleteObject"
34-
],
35-
"Resource": "arn:aws:s3:::__BUCKET_NAME__/*"
36-
},
37-
{
38-
"Effect": "Allow",
39-
"Principal": {
40-
"AWS": "arn:aws:iam::752463128620:role/system/jenkins-s3-role"
41-
},
42-
"Action": [
43-
"s3:GetObject",
44-
"s3:PutObject",
45-
"s3:PutObjectAcl",
46-
"s3:GetObjectAcl",
47-
"s3:GetObjectTagging",
48-
"s3:DeleteObject"
49-
],
50-
"Resource": "arn:aws:s3:::__BUCKET_NAME__/*"
51-
}
52-
]
53-
}
54-
-----------------------------------------------------
55-
56-
57-
58-
59-
Clone https://github.com/hms-dbmi/avillachlab-jenkins
60-
61-
Run the following commands after replacing all __VARIABLE_NAME__ entries with their correct values for the environment:
62-
63-
-----------------------------------------------------
64-
65-
cd dev-jenkins-terraform
66-
env > env.txt
67-
terraform init
68-
terraform apply -auto-approve \
69-
-var "git-commit=__GIT_COMMIT_FOR_JENKINS_REPO__" \
70-
-var "stack-s3-bucket=__S3_BUCKET_NAME_YOU_CREATED__" \
71-
-var "stack-id=__S3_BUCKET_NAME_SUFFIX__" \
72-
-var "subnet-id=__JENKINS_SUBNET_ID__" \
73-
-var "vpc-id=__JENKINS_VPC_ID__" \
74-
-var "instance-profile-name=__JENKINS_INSTANCE_PROFILE_NAME__" \
75-
-var "access-cidr=__JENKINS_ACCESS_CIDR__" \
76-
-var "provisioning-cidr=__JENKINS_PROVISIONING_CIDR__"
77-
78-
aws s3 --sse=AES256 cp terraform.tfstate s3://${stack_s3_bucket}/jenkins_state_${GIT_COMMIT}/terraform.tfstate
79-
aws s3 --sse=AES256 cp env.txt s3://${stack_s3_bucket}/jenkins_state_${GIT_COMMIT}/last_env.txt
80-
81-
INSTANCE_ID=`terraform state show aws_instance.dev-jenkins | grep "\"i-[a-f0-9]" | cut -f 2 -d "=" | sed 's/"//g'`
82-
83-
while [ -z $(/usr/local/bin/aws --region=us-east-1 ec2 describe-tags --filters "Name=resource-id,Values=${INSTANCE_ID}" | grep InitComplete) ];do echo "still initializing";sleep 10;done
84-
85-
echo "http://`terraform state show aws_instance.dev-jenkins | grep private_ip | cut -f 2 -d "=" | sed 's/\"//g' | sed 's/ //g'`"
86-
87-
-----------------------------------------------------
88-
89-
90-
Set stack_s3_bucket Value to new S3 bucket name in new Jenkins
91-
- Manage Jenkins > Configure System
92-
- under "Global properties" set stack_s3_bucket to the new bucket created in the first step
93-
94-
Add the following arn as a trusted entity in the hms-dbmi-cnc-role in the prod account:
95-
- https://console.aws.amazon.com/iam/home?region=us-east-1#/roles/hms-dbmi-cnc-role?section=trust
96-
- example template :
97-
98-
{
99-
"Effect": "Allow",
100-
"Principal": {
101-
"AWS": "arn:aws:sts::752463128620:assumed-role/jenkins-s3-role/< instance id of the jenkins ec2 you just created >"
102-
},
103-
"Action": "sts:AssumeRole",
104-
"Condition": {}
105-
}
106-
107-
- example :
108-
109-
{
110-
"Effect": "Allow",
111-
"Principal": {
112-
"AWS": "arn:aws:sts::752463128620:assumed-role/jenkins-s3-role/i-0615f53dd368cbdfc"
113-
},
114-
"Action": "sts:AssumeRole",
115-
"Condition": {}
116-
}
117-
118-
Switch to Jenkins Configuration View ( DO NOT QUEUE UP THE JOBS! Wait for each to complete successfully before going on to the next. )
119-
120-
Run Jenkins Build "Create stack_variables.tf files"
121-
Run Jenkins Build "Update VPC Settings" after confirming the following:
122-
- confirm that the R53_Zone_ID is correct for the prod account Route 53 Zone
123-
- confirm that the vpc and subnet group names are correct for the prod account
124-
Run Jenkins Build "Update PIC-SURE Token Introspection Token"
125-
Run Jenkins Build "Update Fence Client Credentials"
126-
- provide the correct Fence Client ID and Client Secret as provided by the Fence team
127-
Run Jenkins Build "Update HTTPD Certs and Key"
128-
- provide the correct Cert, Chain and Key file for the production HTTPD server
1+
# Overview
1292

3+
Welcome to the base folder of your Jenkins project. This folder contains two subfolders, each dedicated to a specific aspect of your Jenkins infrastructure: `jenkins-docker` and `jenkins-terraform`. Below, you'll find an overview of each component along with links to their respective README files for detailed information.
1304

131-
Switch to the Deployment View
5+
## Jenkins Docker (`jenkins-docker`)
1326

133-
Run Jenkins Build Check For Updates
134-
- The first time this runs it will take about 1.5 hours because it has to rekey the data.
7+
This section focuses on the Dockerization of Jenkins, incorporating additional tools and configurations to enhance its functionality. The Jenkins Docker image is extended from the official LTS image, making it a versatile and powerful solution. For more information, refer to the [Jenkins Docker README](jenkins-docker/README.md).
1358

136-
Run Jenkins Build Swap Stacks
137-
- This will point the internal production CNAME at the current stage environment
138-
- The current stage environment becomes prod and the current prod environment becomes stage
9+
## Jenkins Terraform (`jenkins-terraform`)
13910

140-
Run Jenkins Build Check For Updates
141-
- This time it should only take about a half hour because the data has already been rekeyed.
11+
Here, Terraform is leveraged to deploy and manage Jenkins infrastructure on AWS. The README provides insights into the variables, backend configuration, and outputs defined in the Terraform files. Detailed information about variables, Terraform backend configuration, and outputs can be found in the [Jenkins Terraform README](jenkins-terraform/README.md).
14212

13+
Feel free to explore each component to understand their configurations, usage, and any additional details you may need for managing your Jenkins environment efficiently. If you have any questions or need assistance, don't hesitate to reach out.
14314

15+
## Table of Contents
14416

17+
- [Jenkins Docker](#jenkins-docker)
18+
- [Jenkins Terraform](#jenkins-terraform)
14519

20+
Feel free to dive into the respective sections for detailed information and instructions.
14621

22+
# Jenkins Docker (`jenkins-docker`)
23+
24+
This section focuses on the Dockerization of Jenkins, incorporating additional tools and configurations to enhance its functionality. The Jenkins Docker image is extended from the official LTS image, making it a versatile and powerful solution.
25+
26+
## [Jenkins Docker README](jenkins-docker/README.md)
27+
28+
- [Features](jenkins-docker/README.md#features)
29+
- [Prerequisites](jenkins-docker/README.md#prerequisites)
30+
- [Building the Image](jenkins-docker/README.md#building-the-image)
31+
- [Configuration](jenkins-docker/README.md#configuration)
32+
- [Usage](jenkins-docker/README.md#usage)
33+
- [Cleanup](jenkins-docker/README.md#cleanup)
34+
- [Contributing](jenkins-docker/README.md#contributing)
35+
- [License](jenkins-docker/README.md#license)
36+
37+
Feel free to explore the Jenkins Docker README for comprehensive information on configuring, building, and using the Docker image.
38+
39+
# Jenkins Terraform (`jenkins-terraform`)
40+
41+
Here, Terraform is leveraged to deploy and manage Jenkins infrastructure on AWS. The README provides insights into the variables, backend configuration, and outputs defined in the Terraform files.
42+
43+
## [Jenkins Terraform README](jenkins-terraform/README.md)
44+
45+
- [Variables](jenkins-terraform/README.md#variables)
46+
- [Terraform Backend](jenkins-terraform/README.md#terraform-backend)
47+
- [Outputs](jenkins-terraform/README.md#outputs)
48+
49+
Feel free to explore the Jenkins Terraform README for detailed information on variables, Terraform backend configuration, and outputs.
50+
51+
Feel free to explore each component to understand their configurations, usage, and any additional details you may need for managing your Jenkins environment efficiently. If you have any questions or need assistance, don't hesitate to reach out.

0 commit comments

Comments
 (0)