-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
134 lines (97 loc) · 4.95 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
ci: clean deps lint test-jenkins-aws-gen
stage:
mkdir -p stage/user-config/ stage/jenkins-plugins/
clean:
rm -rf logs/ stage/
release-major:
rtk release --release-increment-type major
release-minor:
rtk release --release-increment-type minor
release-patch:
rtk release --release-increment-type patch
release: release-minor
publish:
gh release create $(version) --title $(version) --notes "" || echo "Release $(version) has been created on GitHub"
gh release upload $(version) stage/aem-opencloud-manager-$(version).tar.gz
################################################################################
# Dependencies resolution targets.
# For deps-test-local target, the local dependencies must be available on the
# same directory level where aem-opencloud-manager is at. The idea is that you
# can test AEM OpenCloud Manager while also developing those dependencies locally.
################################################################################
# resolve dependencies from remote artifact registries
deps:
pip install -r requirements.txt
# resolve test dependencies from remote artifact registries
deps-test: stage
rm -rf stage/aem-helloworld-config/ stage/user-config/*
cd stage && git clone https://github.com/shinesolutions/aem-helloworld-config
cp -R stage/aem-helloworld-config/aem-opencloud-manager/* stage/user-config/
# resolve test dependencies from local directories
deps-test-local: stage
rm -rf stage/aem-helloworld-config/ stage/user-config/*
cp -R ../aem-helloworld-config/aem-opencloud-manager/* stage/user-config/
################################################################################
# Code styling check and validation targets:
# - lint Ansible playbooks
################################################################################
lint:
# ansible-lint provisioners/ansible/playbooks/*.yaml
################################################################################
# Provision Jenkins with plugins and pipelines.
# Generate pipelines and provision them to a Jenkins instance.
################################################################################
jenkins-init: stage
./scripts/run-playbook.sh jenkins-init "$(config_path)"
jenkins-aws: jenkins-aws-gen jenkins-aws-provision
jenkins-aws-gen: stage
./scripts/run-playbook.sh jenkins-aws-gen "$(config_path)"
jenkins-aws-provision:
./scripts/run-playbook.sh jenkins-aws-provision "$(config_path)"
################################################################################
# Provision AWS resources
# Create below prerequisite resources inorder to run OpenCloud
# - Artefact s3 buckets
# - Bucket policy
# - Instance profile and roles
################################################################################
jenkins-aws-resources:
./scripts/run-playbook.sh jenkins-aws-user-resources "$(config_path)" "$(stack_prefix)"
################################################################################
# Integration test targets.
################################################################################
test-integration: clean deps deps-test
./test/integration/test-examples.sh "$(cicd_type)" "$(platform_type)"
test-integration-local: clean deps deps-test-local
./test/integration/test-examples.sh "$(cicd_type)" "$(platform_type)"
# only tests jenkins-aws pipelines generation
# this is used for Travis CI testing which doesn't have access to any public
# facing Jenkins instance
test-jenkins-aws-gen: deps deps-test
make jenkins-aws-gen config_path=stage/user-config/sandpit/
test-jenkins-pipelines: test-jenkins-pipelines-installation test-jenkins-pipelines-machine-images test-jenkins-pipelines-manage-environments test-jenkins-pipelines-migration test-jenkins-pipelines-operational-tasks test-jenkins-pipelines-testing
test-jenkins-pipelines-installation:
$(call test_jenkins_pipeline,'installation')
test-jenkins-pipelines-machine-images:
$(call test_jenkins_pipeline,'machine-images')
test-jenkins-pipelines-manage-environments:
$(call test_jenkins_pipeline,'manage-environments')
test-jenkins-pipelines-migration:
$(call test_jenkins_pipeline,'migration')
test-jenkins-pipelines-operational-tasks:
$(call test_jenkins_pipeline,'operational-tasks')
test-jenkins-pipelines-testing:
$(call test_jenkins_pipeline,'testing')
define test_jenkins_pipeline
test_category=$(1) ./scripts/run-playbook.sh jenkins-pipelines-run "$(config_path)"
endef
################################################################################
# Temporary utility targets
################################################################################
DOCKER_IMAGE := aem-opencloud/jenkins-master:latest
CONTAINER_NAME := jenkins
docker-run: clean docker-build
docker run -p 8080:8080 --name "${CONTAINER_NAME}" "${DOCKER_IMAGE}"
docker-build:
docker build . -t "${DOCKER_IMAGE}"
.PHONY: ci stage clean deps deps-test deps-test-local lint jenkins-aws jenkins-aws-gen jenkins-aws-provision docker-run docker-build release release-major release-minor release-patch publish