Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release - v1.11.1 #434

Merged
merged 38 commits into from
Dec 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e66f19e
Added remove identity policy in destroy script
Nov 28, 2018
cb0efb5
Review changes
Nov 29, 2018
f400bbe
Split IAM role into platform and userservice basic
Dec 11, 2018
1534bf8
Merge pull request #416 from tmobile/splunk-with-node-upgrade
bleggett Dec 11, 2018
ac1f4c2
Merge pull request #417 from tmobile/master
bleggett Dec 11, 2018
e4e09b8
Merge branch 'develop' into defectsesupdate
bleggett Dec 11, 2018
63f4871
Tags reordering
Dec 12, 2018
7726cb8
Merge branch 'develop' into iamrolesplit
rajeevr2715 Dec 12, 2018
70fd9f0
Merge pull request #414 from rajeevr2715/iamrolesplit
bleggett Dec 12, 2018
0cd3cee
Merge branch 'develop' into defectsesupdate
bleggett Dec 12, 2018
83534f6
Merge pull request #419 from tmobile/master
bleggett Dec 12, 2018
b8b8460
Merge branch 'develop' into defectsesupdate
bleggett Dec 12, 2018
47b6d37
Remove duplicated Terraform resource that slipped thru PR checks
Dec 12, 2018
4d10ba4
Merge branch 'develop' into defectsesupdate
bleggett Dec 12, 2018
da95bdb
followup to remove jenkinsplugins
Dec 13, 2018
b197f84
Merge branch 'develop' into fixplugins
rajeevr2715 Dec 13, 2018
c0e5add
Followup - Splunk with IAM roles
Dec 13, 2018
5b0dcdf
Merge pull request #422 from rajeevr2715/iamrolesplit
bleggett Dec 13, 2018
070efa1
Merge branch 'develop' into fixplugins
bleggett Dec 13, 2018
f2ae486
Merge pull request #418 from rajeevr2715/fixplugins
bleggett Dec 13, 2018
5ab0867
Merge branch 'master' into develop
Dec 13, 2018
adb9962
Move splunk related policy to Platform service role
Dec 14, 2018
257bdeb
Merge branch 'develop' into defectsesupdate
bleggett Dec 14, 2018
8a94ac5
Shellcheck should check all files before failing build
Dec 14, 2018
402e62f
Properly fix shellcheck lint
Dec 14, 2018
eb3abed
Merge branch 'develop' into iamrolesplit
devsatishm Dec 14, 2018
ff2e1e8
Merge pull request #423 from rajeevr2715/iamrolesplit
devsatishm Dec 14, 2018
69118fd
Adding golang docker instance
Johnbush Dec 19, 2018
c04b142
custom recipe for golang
Johnbush Dec 19, 2018
a910b46
Merge pull request #429 from Johnbush/feature/golang
devsatishm Dec 20, 2018
15e01e8
removing RUN
Johnbush Dec 20, 2018
7a21c9e
fix Path issues
Johnbush Dec 20, 2018
98e7145
Merge pull request #430 from Johnbush/feature/golang
devsatishm Dec 20, 2018
d57cf18
Path issue fixed chef recipe
Johnbush Dec 21, 2018
d06924c
correct Indentation
Johnbush Dec 21, 2018
c1cf6d7
Merge pull request #431 from Johnbush/feature/golang
devsatishm Dec 21, 2018
aef578e
Merge branch 'develop' into defectsesupdate
devsatishm Dec 26, 2018
fdae4f5
Merge pull request #415 from rajeevr2715/defectsesupdate
devsatishm Dec 26, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion installscripts/cookbooks/Policyfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
cookbook 'nodejs', '~> 5.0.0'
cookbook 'cloudcli', '~> 1.2.0'
cookbook 'jenkins', path: './jenkins'
run_list 'jenkins::setupjenkins', 'jenkins::sonarqube-scanner', 'jenkins::configurejenkins'
run_list 'jenkins::setupjenkins', 'jenkins::sonarqube-scanner', 'jenkins::configurejenkins', 'jenkins::installgolang'
1 change: 1 addition & 0 deletions installscripts/cookbooks/jenkins/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
default['scmpath'] = "#{node['scmelb']}/scm"
default['region'] = 'us-east-1'
default['git_branch'] = 'master'
default['git_plugin_branch'] = 'master'
default['git_repo'] = 'https://github.com/tmobile/jazz.git'
default['git_content_repo'] = 'https://github.com/tmobile/jazz-content/raw'
default['git_content_plugins'] = 'jenkins/staticplugins/plugins.tar'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"CLOUDFRONT_ORIGIN_ID": "",
"ACCOUNTID": "",
"REGION": "",
"ROLEID": "",
"PLATFORMSERVICES_ROLEID": "",
"USERSERVICES_ROLEID": "",
"ES_HOSTNAME": "",
"COGNITO": {
"USER_POOL_ID": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

# Fetch the xmls.tar from our content repo
execute 'copyXmlsTar' do
command "curl -sL #{node['git_content_repo']}/#{node['git_branch']}/#{node['git_content_xmls']} -o #{node['chef_root']}/xmls.tar; chmod 755 #{node['chef_root']}/xmls.tar"
command "curl -sL #{node['git_content_repo']}/#{node['git_plugin_branch']}/#{node['git_content_xmls']} -o #{node['chef_root']}/xmls.tar; chmod 755 #{node['chef_root']}/xmls.tar"
end

#ToDo ChefRemoval
Expand Down
40 changes: 40 additions & 0 deletions installscripts/cookbooks/jenkins/recipes/installgolang.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
if node['dockerizedJenkins'] == false
# Installing go lang
remote_file "#{Chef::Config['file_cache_path']}/go1.10.3.linux-amd64.tar.gz" do
source 'https://dl.google.com/go/go1.10.3.linux-amd64.tar.gz'
mode '0755'
action :create
end

execute 'mkdir' do
command 'mkdir -p /opt/go/{bin,src,pkg}'
end

execute 'install_go' do
command "tar -C /usr/local -xzf #{Chef::Config['file_cache_path']}/go1.10.3.linux-amd64.tar.gz"
end

# Installing godep (Dependency Management tool)
remote_file "#{Chef::Config['file_cache_path']}/install.sh" do
source 'https://raw.githubusercontent.com/golang/dep/master/install.sh'
mode '0755'
action :create
end

execute 'install_godep' do
environment ({
'GOPATH' => "/opt/go",
'PATH' => "#{ENV['PATH']}:"+"#{ENV['GOPATH']}"+"/bin:"+"/usr/local/go/bin/"
})
command "bash #{Chef::Config['file_cache_path']}/install.sh"
end
# link go
link '/bin/go' do
to '/usr/local/go/bin/go'
end
# link dep
link '/bin/dep' do
to '/opt/go/bin/dep'
end
end

2 changes: 1 addition & 1 deletion installscripts/cookbooks/jenkins/recipes/setupjenkins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# plugin management
# Fetch the plugins.tar from our content repo TODO replace this with a dynamic plugin install like the dockerized version
execute 'copyPluginsTar' do
command "curl -sL #{node['git_content_repo']}/#{node['git_branch']}/#{node['git_content_repo']} -o #{node['chef_root']}/plugins.tar; chmod 755 #{node['chef_root']}/plugins.tar"
command "curl -sL #{node['git_content_repo']}/#{node['git_plugin_branch']}/#{node['git_content_plugins']} -o #{node['chef_root']}/plugins.tar; chmod 755 #{node['chef_root']}/plugins.tar"
end

execute 'extractJenkinsPlugins' do
Expand Down
9 changes: 9 additions & 0 deletions installscripts/dockerfiles/jenkins-ce/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@
FROM jenkins/jenkins:2.121.3
MAINTAINER JazzOSS Team

ARG goVersion=1.10.3
# Switching to root to configure the image with system packages
USER root
RUN apt-get update && apt-get install -y vim curl sudo libtool autoconf make unzip rsync gcc autogen shtool pkg-config lsb-release python python-dev python-pip python-setuptools groff less && \
curl https://bootstrap.pypa.io/get-pip.py | python && pip install --upgrade awscli && apt-get clean && pip install virtualenv && /usr/bin/easy_install virtualenv
RUN wget -O /opt/apache-maven-3.5.2-bin.tar.gz https://archive.apache.org/dist/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz && tar xzvf /opt/apache-maven-3.5.2-bin.tar.gz -C /opt && export PATH=$PATH:/opt/apache-maven-3.5.2/bin >> /etc/profile.d/maven.sh && ln -sf /opt/apache-maven-3.5.2/bin/mvn /usr/bin/mvn
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash && apt-get install -y nodejs && npm install -global serverless@1.30.0 @angular/cli@1.7.3 jshint
# Install scripts for golang
RUN curl -O https://storage.googleapis.com/golang/go${goVersion}.linux-amd64.tar.gz && tar -xvf go${goVersion}.linux-amd64.tar.gz && mv go /usr/local
ENV GOROOT /usr/local/go
ENV GOBIN /usr/local/go/bin
ENV GOPATH /usr/local/go/src
ENV PATH $GOROOT:$GOBIN:$GOPATH:$PATH
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh

# Copying plugins list. Downlading and installing plugins from Jenkins PluginsManager
COPY dockerfiles/jenkins-ce/plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt
Expand Down
8 changes: 4 additions & 4 deletions installscripts/jazz-terraform-unix-noinstances/api-gateway.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ resource "aws_cloudwatch_log_group" "API-Gateway-Execution-Logs_prod" {

resource "aws_cloudwatch_log_subscription_filter" "logfilter-dev" {
name = "logfilter-dev"
role_arn = "${aws_iam_role.lambda_role.arn}"
role_arn = "${aws_iam_role.platform_role.arn}"
log_group_name = "${aws_cloudwatch_log_group.API-Gateway-Execution-Logs_dev.name}"
filter_pattern = ""
destination_arn = "${aws_kinesis_stream.logs_stream_prod.arn}"
Expand All @@ -39,7 +39,7 @@ resource "aws_cloudwatch_log_subscription_filter" "logfilter-dev" {

resource "aws_cloudwatch_log_subscription_filter" "logfilter-stg" {
name = "logfilter-stg"
role_arn = "${aws_iam_role.lambda_role.arn}"
role_arn = "${aws_iam_role.platform_role.arn}"
log_group_name = "${aws_cloudwatch_log_group.API-Gateway-Execution-Logs_stg.name}"
filter_pattern = ""
destination_arn = "${aws_kinesis_stream.logs_stream_prod.arn}"
Expand All @@ -48,13 +48,13 @@ resource "aws_cloudwatch_log_subscription_filter" "logfilter-stg" {

resource "aws_cloudwatch_log_subscription_filter" "logfilter-prod" {
name = "logfilter-prod"
role_arn = "${aws_iam_role.lambda_role.arn}"
role_arn = "${aws_iam_role.platform_role.arn}"
log_group_name = "${aws_cloudwatch_log_group.API-Gateway-Execution-Logs_prod.name}"
filter_pattern = ""
destination_arn = "${aws_kinesis_stream.logs_stream_prod.arn}"
distribution = "Random"
}

resource "aws_api_gateway_account" "cloudwatchlogroleupdate" {
cloudwatch_role_arn = "${aws_iam_role.lambda_role.arn}"
cloudwatch_role_arn = "${aws_iam_role.platform_role.arn}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,7 @@ resource "null_resource" "configureJenkinsInstance" {
inline = "mkdir -p ${var.chefDestDir}"
}

#Copy the chef playbooks and jenkins binary plugin blobs over to the remote Jenkins server
provisioner "file" {
source = "${var.jenkinsPluginsSourceDir}"
destination = "${var.chefDestDir}/"
}
#Copy the chef playbooks over to the remote Jenkins server

provisioner "file" {
source = "${var.cookbooksSourceDir}"
Expand Down Expand Up @@ -115,7 +111,7 @@ resource "null_resource" "configureJenkinsDocker" {
resource "null_resource" "postJenkinsConfiguration" {
depends_on = ["null_resource.configureJenkinsInstance", "null_resource.configureJenkinsDocker", "aws_elasticsearch_domain.elasticsearch_domain"]
provisioner "local-exec" {
command = "${var.modifyCodebase_cmd} ${lookup(var.jenkinsservermap, "jenkins_security_group")} ${lookup(var.jenkinsservermap, "jenkins_subnet")} ${aws_iam_role.lambda_role.arn} ${var.region} ${var.envPrefix} ${var.cognito_pool_username}"
command = "${var.modifyCodebase_cmd} ${lookup(var.jenkinsservermap, "jenkins_security_group")} ${lookup(var.jenkinsservermap, "jenkins_subnet")} ${aws_iam_role.platform_role.arn} ${var.region} ${var.envPrefix} ${var.cognito_pool_username}"
}

// Injecting bootstrap variables into Jazz-core Jenkinsfiles*
Expand Down
60 changes: 50 additions & 10 deletions installscripts/jazz-terraform-unix-noinstances/iam.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
resource "aws_iam_role_policy_attachment" "lambdafullaccess" {
role = "${aws_iam_role.lambda_role.name}"
role = "${aws_iam_role.platform_role.name}"
policy_arn = "arn:aws:iam::aws:policy/AWSLambdaFullAccess"
}

resource "aws_iam_role_policy_attachment" "apigatewayinvokefullAccess" {
role = "${aws_iam_role.lambda_role.name}"
role = "${aws_iam_role.platform_role.name}"
policy_arn = "arn:aws:iam::aws:policy/AmazonAPIGatewayInvokeFullAccess"
}

Expand All @@ -13,33 +13,39 @@ resource "aws_iam_role_policy_attachment" "cloudwatchlogaccess" {
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
}

resource "aws_iam_role_policy_attachment" "cloudwatchlogaccessbasic" {
role = "${aws_iam_role.platform_role.name}"
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
}

resource "aws_iam_role_policy_attachment" "kinesisaccess" {
role = "${aws_iam_role.lambda_role.name}"
role = "${aws_iam_role.platform_role.name}"
policy_arn = "arn:aws:iam::aws:policy/AmazonKinesisFullAccess"
}

resource "aws_iam_role_policy_attachment" "s3fullaccess" {
role = "${aws_iam_role.lambda_role.name}"
role = "${aws_iam_role.platform_role.name}"
policy_arn = "arn:aws:iam::aws:policy/AmazonS3FullAccess"
}

resource "aws_iam_role_policy_attachment" "sqsfullaccess" {
role = "${aws_iam_role.lambda_role.name}"
role = "${aws_iam_role.platform_role.name}"
policy_arn = "arn:aws:iam::aws:policy/AmazonSQSFullAccess"
}

resource "aws_iam_role_policy_attachment" "cognitopoweruser" {
role = "${aws_iam_role.lambda_role.name}"
role = "${aws_iam_role.platform_role.name}"
policy_arn = "arn:aws:iam::aws:policy/AmazonCognitoPowerUser"
}

resource "aws_iam_role_policy_attachment" "pushtocloudwatchlogs" {
role = "${aws_iam_role.lambda_role.name}"
role = "${aws_iam_role.platform_role.name}"
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs"
}

resource "aws_iam_role" "lambda_role" {
name = "${var.envPrefix}_basic_execution"
tags = "${merge(var.additional_tags, local.common_tags)}"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
Expand Down Expand Up @@ -71,9 +77,9 @@ resource "aws_iam_role" "lambda_role" {
EOF
}

resource "aws_iam_role_policy" "basic_execution_policy" {
name = "${var.envPrefix}_basic_execution_policy"
role = "${aws_iam_role.lambda_role.id}"
resource "aws_iam_role_policy" "platform_service_policy" {
name = "${var.envPrefix}_platform_service_policy"
role = "${aws_iam_role.platform_role.id}"

policy = <<EOF
{
Expand All @@ -90,3 +96,37 @@ resource "aws_iam_role_policy" "basic_execution_policy" {
}
EOF
}

resource "aws_iam_role" "platform_role" {
name = "${var.envPrefix}_platform_services"
tags = "${merge(var.additional_tags, local.common_tags)}"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "apigateway.amazonaws.com"
},
"Action": "sts:AssumeRole"
},
{
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
},
"Action": "sts:AssumeRole"
},
{
"Effect": "Allow",
"Principal": {
"Service": "logs.${var.region}.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
EOF
}
5 changes: 4 additions & 1 deletion installscripts/jazz-terraform-unix-noinstances/jenkins.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ resource "null_resource" "update_jenkins_configs" {
command = "${var.configureS3Names_cmd} ${aws_s3_bucket.oab-apis-deployment-dev.bucket} ${aws_s3_bucket.oab-apis-deployment-stg.bucket} ${aws_s3_bucket.oab-apis-deployment-prod.bucket} ${aws_s3_bucket.jazz-web.bucket} ${var.jenkinsjsonpropsfile}"
}
provisioner "local-exec" {
command = "${var.modifyPropertyFile_cmd} ROLEID ${aws_iam_role.lambda_role.arn} ${var.jenkinsjsonpropsfile}"
command = "${var.modifyPropertyFile_cmd} PLATFORMSERVICES_ROLEID ${aws_iam_role.platform_role.arn} ${var.jenkinsjsonpropsfile}"
}
provisioner "local-exec" {
command = "${var.modifyPropertyFile_cmd} USERSERVICES_ROLEID ${aws_iam_role.lambda_role.arn} ${var.jenkinsjsonpropsfile}"
}
provisioner "local-exec" {
command = "${var.modifyPropertyFile_cmd} WEBSITE_DEV_BUCKET ${aws_s3_bucket.dev-serverless-static.bucket} ${var.jenkinsjsonpropsfile}"
Expand Down
16 changes: 8 additions & 8 deletions installscripts/jazz-terraform-unix-noinstances/s3bucket.tf
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ data "aws_iam_policy_document" "dev-serverless-static-policy-data-contents" {
]
principals {
type="AWS",
identifiers = ["${aws_iam_role.lambda_role.arn}"]
identifiers = ["${aws_iam_role.platform_role.arn}"]
}
resources = [
"${aws_s3_bucket.dev-serverless-static.arn}/*"
Expand All @@ -170,7 +170,7 @@ data "aws_iam_policy_document" "dev-serverless-static-policy-data-contents" {
]
principals {
type="AWS",
identifiers = ["${aws_iam_role.lambda_role.arn}"]
identifiers = ["${aws_iam_role.platform_role.arn}"]
}
resources = [
"${aws_s3_bucket.dev-serverless-static.arn}"
Expand All @@ -191,7 +191,7 @@ data "aws_iam_policy_document" "stg-serverless-static-policy-data-contents" {
]
principals {
type="AWS",
identifiers = ["${aws_iam_role.lambda_role.arn}"]
identifiers = ["${aws_iam_role.platform_role.arn}"]
}
resources = [
"${aws_s3_bucket.stg-serverless-static.arn}/*"
Expand All @@ -204,7 +204,7 @@ data "aws_iam_policy_document" "stg-serverless-static-policy-data-contents" {
]
principals {
type="AWS",
identifiers = ["${aws_iam_role.lambda_role.arn}"]
identifiers = ["${aws_iam_role.platform_role.arn}"]
}
resources = [
"${aws_s3_bucket.stg-serverless-static.arn}"
Expand All @@ -227,7 +227,7 @@ data "aws_iam_policy_document" "prod-serverless-static-policy-data-contents" {
]
principals {
type="AWS",
identifiers = ["${aws_iam_role.lambda_role.arn}"]
identifiers = ["${aws_iam_role.platform_role.arn}"]
}
resources = [
"${aws_s3_bucket.prod-serverless-static.arn}/*"
Expand All @@ -240,7 +240,7 @@ data "aws_iam_policy_document" "prod-serverless-static-policy-data-contents" {
]
principals {
type="AWS",
identifiers = ["${aws_iam_role.lambda_role.arn}"]
identifiers = ["${aws_iam_role.platform_role.arn}"]
}
resources = [
"${aws_s3_bucket.prod-serverless-static.arn}"
Expand All @@ -261,7 +261,7 @@ data "aws_iam_policy_document" "jazz-web-policy-data-contents" {
]
principals {
type="AWS",
identifiers = ["${aws_iam_role.lambda_role.arn}"]
identifiers = ["${aws_iam_role.platform_role.arn}"]
}
resources = [
"${aws_s3_bucket.jazz-web.arn}/*"
Expand All @@ -275,7 +275,7 @@ data "aws_iam_policy_document" "jazz-web-policy-data-contents" {
]
principals {
type="AWS",
identifiers = ["${aws_iam_role.lambda_role.arn}"]
identifiers = ["${aws_iam_role.platform_role.arn}"]
}
resources = [
"${aws_s3_bucket.jazz-web.arn}"
Expand Down
Loading