-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add packer scripts for Drumkit itself, including CLI-only PHP depende…
…ncies script. Also: fix leading @ signs in makefile. We should add a test.
- Loading branch information
Showing
8 changed files
with
188 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
CONTAINER_REGISTRY_URL ?= https://gitlab.com/consensus.enterprises/drumkit/container_registry | ||
CONTAINER_PROJECT_NAME = drumkit | ||
|
||
local_ref = $(shell git rev-parse HEAD) | ||
clone_ref = $(shell [ -d .clone ] && (cd .clone && git rev-parse HEAD)) | ||
|
||
clone: ## Create a local clone of our repo that will be used inside the CI packer image. | ||
ifneq ($(local_ref),$(clone_ref)) | ||
@echo "Cloning a fresh copy of our code in to .clone directory." | ||
@rm -rf .clone | ||
@mkdir -p .clone | ||
@git clone --recursive . .clone | ||
else | ||
@echo ".clone directory is up to date, skipping reclone." | ||
endif | ||
|
||
ci-image: packer | ||
@if [ -z ${CONTAINER_SCRIPT} ]; then echo -e "$(YELLOW)Missing required variable $(GREY)CONTAINER_SCRIPT$(YELLOW).$(RESET)"; exit 1; fi | ||
@if [ -z ${CONTAINER_PROJECT_NAME} ]; then echo -e "$(YELLOW)Missing required variable $(GREY)CONTAINER_PROJECT_NAME$(YELLOW).$(RESET)"; exit 1; fi | ||
@if [ -z ${CONTAINER_REGISTRY_URL} ]; then echo -e "$(YELLOW)Missing required variable $(GREY)CONTAINER_REGISTRY_URL$(YELLOW).$(RESET)"; exit 1; fi | ||
@echo "Building packer image for CI: $(CONTAINER_SCRIPT)" | ||
@packer build $(CONTAINER_SCRIPT) | ||
|
||
ci-images: clone | ||
@echo "Building packer images for CI." | ||
@echo "Using project name: $(CONTAINER_PROJECT_NAME)" | ||
@echo "Using container registry: $(CONTAINER_REGISTRY_URL)" | ||
@for script in `ls scripts/packer/json/*.json`; do make -s ci-image CONTAINER_SCRIPT=$$script CONTAINER_PROJECT_NAME=$(CONTAINER_PROJECT_NAME) CONTAINER_REGISTRY_URL=$(CONTAINER_REGISTRY_URL); done | ||
|
||
ci-local: gitlab-runner | ||
gitlab-runner exec docker tests | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"builders": [ | ||
{ | ||
"commit": true, | ||
"image": "ubuntu:bionic", | ||
"type": "docker" | ||
} | ||
], | ||
"post-processors": [ | ||
[ | ||
{ | ||
"repository": "{{user `repo_url`}}/{{user `image_name`}}", | ||
"tags": [ | ||
"0.0.x" | ||
], | ||
"type": "docker-tag" | ||
}, | ||
{ | ||
"repository": "{{user `repo_url`}}/{{user `image_name`}}", | ||
"tags": [ | ||
"latest" | ||
], | ||
"type": "docker-tag" | ||
}, | ||
{ | ||
"type": "docker-push" | ||
} | ||
] | ||
], | ||
"provisioners": [ | ||
{ | ||
"scripts": [ | ||
"scripts/packer/scripts/apt.sh", | ||
"scripts/packer/scripts/purge-extra-packages.sh", | ||
"scripts/packer/scripts/cleanup.sh" | ||
], | ||
"type": "shell" | ||
} | ||
], | ||
"variables": { | ||
"image_name": "bionic", | ||
"repo_url": "{{env `CONTAINER_REGISTRY_URL`}}" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"builders": [ | ||
{ | ||
"commit": true, | ||
"image": "{{user `repo_url`}}/bionic:latest", | ||
"type": "docker" | ||
} | ||
], | ||
"post-processors": [ | ||
[ | ||
{ | ||
"repository": "{{user `repo_url`}}/{{user `image_name`}}", | ||
"tags": [ | ||
"0.0.x" | ||
], | ||
"type": "docker-tag" | ||
}, | ||
{ | ||
"repository": "{{user `repo_url`}}/{{user `image_name`}}", | ||
"tags": [ | ||
"latest" | ||
], | ||
"type": "docker-tag" | ||
}, | ||
{ | ||
"type": "docker-push" | ||
} | ||
] | ||
], | ||
"provisioners": [ | ||
{ | ||
"scripts": [ | ||
"scripts/packer/scripts/utils.sh", | ||
"scripts/packer/scripts/python.sh", | ||
"scripts/packer/scripts/cleanup.sh" | ||
], | ||
"type": "shell" | ||
} | ||
], | ||
"variables": { | ||
"image_name": "base", | ||
"repo_url": "{{env `CONTAINER_REGISTRY_URL`}}" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"builders": [ | ||
{ | ||
"commit": true, | ||
"image": "{{user `repo_url`}}/base:latest", | ||
"pull": false, | ||
"type": "docker" | ||
} | ||
], | ||
"post-processors": [ | ||
[ | ||
{ | ||
"repository": "{{user `repo_url`}}/{{user `image_name`}}", | ||
"tags": [ | ||
"0.0.x" | ||
], | ||
"type": "docker-tag" | ||
}, | ||
{ | ||
"repository": "{{user `repo_url`}}/{{user `image_name`}}", | ||
"tags": [ | ||
"latest" | ||
], | ||
"type": "docker-tag" | ||
}, | ||
{ | ||
"type": "docker-push" | ||
} | ||
] | ||
], | ||
"provisioners": [ | ||
{ | ||
"scripts": [ | ||
"scripts/packer/scripts/php-cli.sh", | ||
"scripts/packer/scripts/cleanup.sh" | ||
], | ||
"type": "shell" | ||
} | ||
], | ||
"variables": { | ||
"image_name": "php", | ||
"repo_url": "{{env `CONTAINER_REGISTRY_URL`}}" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh -eux | ||
|
||
# Use this file for projects that use php on the command line, but don't involve web development; | ||
# for web development projects, use "php.sh" (the default). | ||
|
||
export DEBIAN_FRONTEND=noninteractive | ||
apt-get -yqq update | ||
# Install Behat dependencies: | ||
apt-get -yqq install \ | ||
curl \ | ||
php-cli \ | ||
php-mbstring \ | ||
php-curl \ | ||
php-xml \ | ||
php-gd \ | ||
> /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters