-
Notifications
You must be signed in to change notification settings - Fork 52
/
Makefile
94 lines (73 loc) · 3.54 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
SHELL := /usr/bin/env bash
.DEFAULT_GOAL := help
.PHONY: clean requirements plugins build logs e2e show run upgrade
help:
@echo ''
@echo 'Makefile for '
@echo ' make help show this information'
@echo ' make clean shutdown running container and delete image and clean workspace'
@echo ' make clean.container shutdown running container and delete image'
@echo ' make clean.ws delete all groovy/gradle artifacts in the workspace'
@echo ' make build build a dockerfile for testing the jenkins configuration'
@echo ' make run run the dockerfile and kickoff jenkins'
@echo ' make run.container run the dockerfile without starting the jenkins .war'
@echo ' make run.jenkins run the jenkins .war on the container'
@echo ' make logs tail the logs for the Jenkins container'
@echo ' make shell shell into the runnning Jenkkins container for debugging'
@echo ' make healthcheck run healthcheck script to test if Jenkins has successfully booted'
@echo ' make quality run codenarc on groovy source and tests'
@echo ' make requirements install requirements for acceptance tests'
@echo ' make plugins install specified Jenkins plugins and their dependencies'
@echo ' make show show the versions of downloaded plugins'
@echo ' make e2e run python acceptance tests against a provisioned docker container'
clean: clean.container clean.ws
stop.container:
docker kill $(CONTAINER_NAME) || true
docker rm $(CONTAINER_NAME) || true
clean.container: stop.container
docker rmi $(CONTAINER_NAME) || true
clean.ws:
./gradlew clean
./gradlew -b plugins.gradle clean
build:
docker build -t $(IMAGE_NAME) --no-cache\
--build-arg=CONFIG_PATH=$(CONFIG_PATH) \
--build-arg=JENKINS_VERSION=$(JENKINS_VERSION) \
--build-arg=JENKINS_WAR_SOURCE=$(JENKINS_WAR_SOURCE) \
--target=$(TEST_SHARD) .
run: run.container run.jenkins
run.container: stop.container
docker run --name $(CONTAINER_NAME) -p 127.0.0.1:8080:8080 -p 127.0.0.1:2222:22 -d $(IMAGE_NAME)
run.jenkins:
docker exec -d -u jenkins ${CONTAINER_NAME} /usr/bin/java -jar /usr/share/jenkins/jenkins.war --httpPort=8080 --logfile=/var/log/jenkins/jenkins.log
logs:
docker exec $(CONTAINER_NAME) tail -f /var/log/jenkins/jenkins.log
shell:
docker exec -it $(CONTAINER_NAME) /bin/bash
healthcheck:
./healthcheck.sh
quality:
./gradlew codenarcMain codenarcTest
requirements:
./gradlew libs
pip install -r requirements/ci.txt
get-password:
docker exec ${CONTAINER_NAME} cat /var/lib/jenkins/secrets/initialAdminPassword
# Define PIP_COMPILE_OPTS=-v to get more information during make upgrade.
PIP_COMPILE = pip-compile --rebuild --upgrade $(PIP_COMPILE_OPTS)
upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
pip install -qr requirements/pip-tools.txt
# Make sure to compile files after any other files they include!
$(PIP_COMPILE) -o requirements/pip-tools.txt requirements/pip-tools.in
$(PIP_COMPILE) -o requirements/test.txt requirements/test.in
$(PIP_COMPILE) -o requirements/ci.txt requirements/ci.in
$(PIP_COMPILE) -o requirements/dev.txt requirements/dev.in
plugins:
./gradlew -b plugins.gradle plugins
e2e:
tox
show:
./gradlew -b plugins.gradle show
show.container:
docker exec -w /var/lib/jenkins/git/jenkins-configuration -e PLUGIN_OUTPUT_DIR=/var/lib/jenkins/plugins ${CONTAINER_NAME} ./gradlew -b plugins.gradle show