MozDef builds now include the tag of the branch or branch name they are built from.

This commit is contained in:
Andrew Krug 2019-03-18 12:32:58 -07:00
Родитель ad947dbd86
Коммит 428f6818e4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: BEBE65BA52166840
2 изменённых файлов: 11 добавлений и 3 удалений

Просмотреть файл

@ -2,6 +2,7 @@ ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
PARENTDIR := $(realpath ../)
AWS_REGION := us-west-2
STACK_NAME := mozdef-aws-nested
BRANCH := master
DEV_STACK_PARAMS_FILENAME := aws_parameters.dev.json
# For more information on the rationale behind the code in STACK_PARAMS see https://github.com/aws/aws-cli/issues/2429#issuecomment-441133480
DEV_STACK_PARAMS := $(shell test -e $(DEV_STACK_PARAMS_FILENAME) && python -c 'import json,sys;f=open(sys.argv[1]);print(" ".join([",".join(["%s=\\\"%s\\\""%(k,v) for k,v in x.items()]) for x in json.load(f)]));f.close()' $(DEV_STACK_PARAMS_FILENAME))
@ -28,7 +29,8 @@ all:
# Note: This requires AWS access
.PHONY: packer-build
packer-build: ## Build the base AMI with packer
cd packer && packer build packer.json
@echo "Branch based build triggered for $(BRANCH)..."
cd packer && packer -machine-readable build -var github_branch=${BRANCH} packer.json
.PHONY: create-prod-stack
create-dev-stack: test ## Create everything you need for a fresh new stack!

Просмотреть файл

@ -15,9 +15,15 @@
"ssh_pty" : "true",
"ssh_username": "ec2-user",
"ami_name": "mozdef_{{timestamp}}",
"ami_description": "An automated build of MozDef triggered via the makefile.",
"ami_groups": [
"all"
]
],
"tags": {
"github:Branch": "{{ user `github_branch`}}",
"buildTimestamp": "{{timestamp}}",
"app": "mozdef"
}
}],
"provisioners": [
{ "type": "shell",
@ -33,7 +39,7 @@
"sudo systemctl enable docker",
"sudo mkdir -p /opt/mozdef/",
"sudo git clone https://github.com/mozilla/MozDef /opt/mozdef",
"cd /opt/mozdef && sudo git checkout master"
"cd /opt/mozdef && sudo git checkout -b {{ user `github_branch`}}"
]}
]
}