-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathTaskfile.yml
More file actions
executable file
·369 lines (309 loc) · 11 KB
/
Taskfile.yml
File metadata and controls
executable file
·369 lines (309 loc) · 11 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
# Task tool documentation:
# 1) Basics: https://taskfile.dev/usage
# 2) Naming conventions: https://taskfile.dev/styleguide
version: '3'
env:
AEM_ENV: '{{.AEM_ENV | default "local"}}'
AEM_INSTANCE_PROCESSING_MODE: auto
AEM_OUTPUT_VALUE: NONE
dotenv:
- '.env' # VCS-ignored, user-specific
- '.env.{{.AEM_ENV}}' # VCS-ignored, env-specific
- '{{.AEM_ENV}}.env' # VCS-tracked, env-specific
tasks:
init:
desc: initialize project
cmds:
- sh aemw project init
setup:
desc: start and provision AEM instances
cmds:
- task: start
- task: provision
- task: check
resetup:
desc: destroy then setup again AEM instances
cmds:
- task: destroy
- task: setup
start:
desc: start AEM instances
aliases: [ up ]
cmd: sh aemw instance launch
stop:
desc: stop AEM instances
aliases: [ down ]
cmd: sh aemw instance stop
restart:
desc: restart AEM instances
cmds:
- task: stop
- task: start
destroy:
desc: destroy AEM instances
prompt: This will permanently delete all configured AEM instances and their data. Continue?
deps: [ stop ]
cmd: sh aemw instance destroy
status:
desc: check status of AEM instances
env:
AEM_OUTPUT_VALUE: ALL
cmd: sh aemw instance status
tail:
desc: tail logs of AEM instances
cmd: tail -f aem/home/var/instance/*/crx-quickstart/logs/{stdout,error}.log
tail:author:
desc: tail logs of AEM author instance
cmd: tail -f aem/home/var/instance/author/crx-quickstart/logs/{stdout,error}.log
tail:publish:
desc: tail logs of AEM publish instance
cmd: tail -f aem/home/var/instance/publish/crx-quickstart/logs/{stdout,error}.log
provision:
desc: provision AEM instances by installing packages and applying configurations
aliases: [ configure ]
cmds:
- task: provision:repl-agent-publish
- task: provision:crx
provision:repl-agent-publish:
desc: configure replication agent on AEM author instance
cmd: 'sh aemw repl agent setup -A --location "author" --name "publish" --input-string "{ enabled: true, transportUri: \"{{.AEM_PUBLISH_HTTP_URL}}/bin/receive?sling:authRequestLogin=1\", transportUser: \"{{.AEM_PUBLISH_USER}}\", transportPassword: \"{{.AEM_PUBLISH_PASSWORD}}\", userId: \"admin\" }"'
provision:crx:
desc: enable CRX/DE on AEM instances
cmd: 'sh aemw osgi config save --pid "org.apache.sling.jcr.davex.impl.servlets.SlingDavExServlet" --input-string "alias: /crx/server"'
check:
deps: [ author:check, publish:check ]
author:check:
desc: check health of AEM author instance
cmds:
- curl -s -u "{{.AEM_AUTHOR_USER}}:{{.AEM_AUTHOR_PASSWORD}}" "{{.AEM_AUTHOR_HTTP_URL}}/libs/granite/core/content/login.html" | grep -q "QUICKSTART_HOMEPAGE"
- curl -s -u "{{.AEM_AUTHOR_USER}}:{{.AEM_AUTHOR_PASSWORD}}" "{{.AEM_AUTHOR_HTTP_URL}}/etc/replication/agents.author/publish.test.html" | grep -q "Replication (TEST) of /content successful"
publish:check:
desc: check health of AEM publish instance
cmd: curl -s -u "{{.AEM_PUBLISH_USER}}:{{.AEM_PUBLISH_PASSWORD}}" "{{.AEM_PUBLISH_HTTP_URL}}/libs/granite/core/content/login.html" | grep -q "QUICKSTART_HOMEPAGE"
build:std:
desc: build AEM package
cmd: sh mvnw clean install $AEM_BUILD_ARGS
build:version:
desc: check build tool versions
cmds:
- echo "JAVA_HOME='${JAVA_HOME}'"
- sh mvnw -version
build:root:
desc: build AEM root project
cmd: sh mvnw clean install -N $AEM_BUILD_ARGS && mkdir -p target && touch target/done.txt
generates: [ target/done.txt ]
sources: [ pom.xml ]
build:core:
desc: build AEM core bundle
dir: core
cmd: sh ../mvnw clean install verify $AEM_BUILD_ARGS
generates: [ target/*.jar ]
sources: [ ../pom.xml, pom.xml, src/**/*, lib/**/*, ../lint/**/* ]
build:frontend:
dir: ui.frontend
desc: build AEM Frontend
cmd: sh ../mvnw clean install $AEM_BUILD_ARGS
generates:
- ../ui.apps/src/main/content/jcr_root/apps/acm/spa/**/*
sources:
- pom.xml
- package.json
- '*.json'
- '*.js'
- src/**/*
build:apps:structure:
dir: ui.apps.structure
desc: build AEM Apps Structure package
cmd: sh ../mvnw clean install $AEM_BUILD_ARGS
generates: [ target/*.ui.apps.structure-*.zip ]
sources: [ pom.xml ]
build:apps:
dir: ui.apps
desc: build AEM Apps package
cmd: sh ../mvnw clean install $AEM_BUILD_ARGS
generates: [ target/*.ui.apps-*.zip ]
sources:
- ../pom.xml
- pom.xml
- src/**/*
- ../core/target/*.jar
build:config:
dir: ui.config
desc: build AEM config package
cmd: sh ../mvnw clean install $AEM_BUILD_ARGS
sources: [ pom.xml, src/**/* ]
generates: [ target/*.ui.config-*.zip ]
build:content:
dir: ui.content
desc: build AEM base content package
cmd: sh ../mvnw clean install $AEM_BUILD_ARGS
sources: [ pom.xml, src/**/* ]
generates: [ target/*.ui.content-*.zip ]
build:all:
dir: all
desc: build AEM all package
cmd: sh ../mvnw clean install $AEM_BUILD_ARGS
sources:
- pom.xml
- src/**/*
- ../ui.apps/target/*.ui.apps-*.zip
- ../ui.content/target/*.ui.content-*.zip
- ../ui.config/target/*.ui.config-*.zip
- ../ui.content.migration/target/*.ui.content.migration-*.zip
- ../ui.content.permissions/target/*.ui.content.permissions-*.zip
generates: [ target/*.all-*.zip ]
build:inc:
desc: build AEM application incrementally (only changed modules are rebuilt)
cmds:
- task: build:root
- task: build:core
- task: build:frontend
- task: build:apps:structure
- task: build:apps
- task: build:config
- task: build:content
- task: build:all
build:clean:
desc: clean built AEM application
cmd: sh mvnw clean
deploy:all:
desc: deploy all AEM package to AEM instances
cmd: sh aemw package deploy --file "all/target/acm.all-*.zip"
deploy:min:
desc: deploy minimal AEM package to AEM instances
cmd: sh aemw package deploy --file "min/target/acm.min-*.zip"
develop:
desc: build & deploy AEM packages to instances
cmds:
- task: develop:all
- task: develop:content:example
develop:all:
desc: build & deploy all AEM package to instances
deps: [ build:inc ]
cmds:
- task: deploy:all
# develop:min:
# desc: build & deploy minimal AEM package to instances
# deps: [ build ]
# cmds:
# #- sh aemw package deploy --url 'https://github.com/orbinson/aem-groovy-console/releases/download/19.0.5/aem-groovy-console-all-19.0.5.zip'
# - task: deploy:min
# - sh aemw package deploy --file 'ui.content/target/acm.ui.content-*.zip'
develop:core:
desc: build & deploy core OSGi bundle to instances
cmds:
- (cd core && sh ../mvnw clean package)
- sh aemw osgi bundle install --file 'core/target/acm.core-*.jar'
develop:content:
desc: build & deploy content AEM package to instances
cmds:
- (cd ui.content && sh ../mvnw clean package)
- sh aemw package deploy --file 'ui.content/target/acm.ui.content-*.zip'
develop:content:example:
desc: build & deploy example content AEM package to instances
cmds:
- (cd ui.content.example && sh ../mvnw clean package)
- sh aemw package deploy --file 'ui.content.example/target/acm.ui.content.example-*.zip'
develop:frontend:
desc: build & deploy frontend to instances
cmds:
- (cd ui.frontend && npm install && npm run build)
- sh aemw content push --dir 'ui.apps/src/main/content/jcr_root/apps/acm/gui/spa/build'
develop:frontend:dev:
desc: build & deploy frontend to instances in development mode
dir: ui.frontend
cmds:
- sh npmw install
- sh npmw run dev
develop:frontend:fix:
desc: format frontend code
dir: ui.frontend
cmds:
- sh npmw run format
- sh npmw run lint
release:
desc: Release a new version
vars:
VERSION: ""
cmds:
- |
set -e
VERSION="{{.CLI_ARGS | default ""}}"
VERSION_TAG="v$VERSION"
VERSION_CURRENT_TAG=$(git describe --tags --abbrev=0 || echo "v0.0.0")
VERSION_CURRENT_TAG="${VERSION_CURRENT_TAG#v}" # remove leading 'v', preserve leading zeros
if [ -z "$VERSION" ]; then
echo "Release version is not specified!"
echo "Last released: ${VERSION_CURRENT_TAG}"
exit 1
fi
GIT_STAT=$(git diff --stat || true)
if [ "$GIT_STAT" != '' ]; then
echo "Unable to release. Uncommitted changes detected!"
exit 1
fi
echo "Releasing $VERSION_TAG"
echo "Bumping version in files"
echo "<TODO>"
#README_FILE="README.MD"
#PROJECT_WRAPPER_SCRIPT="pkg/project/common/aemw"
#
## <https://stackoverflow.com/a/57766728>
#if [ "$(uname)" = "Darwin" ]; then
# sed -i '' 's/AEM_CLI_VERSION:-"[^\"]*"/AEM_CLI_VERSION:-"'"$VERSION"'"/g' "$PROJECT_WRAPPER_SCRIPT"
# # shellcheck disable=SC2016
# sed -i '' 's/aem\@v[^\`]*\`/aem@v'"$VERSION"\`'/g' "$README_FILE"
#else
# sed -i 's/AEM_CLI_VERSION:-"[^\"]*"/AEM_CLI_VERSION:-"'"$VERSION"'"/g' "$PROJECT_WRAPPER_SCRIPT"
# # shellcheck disable=SC2016
# sed -i 's/aem\@v[^\`]*\`/aem@v'"$VERSION"\`'/g' "$README_FILE"
#fi
echo "Pushing version bump"
git commit -a -m "Release $VERSION_TAG" || echo "No changes to commit"
git push || echo "Nothing to push"
echo "Pushing release tag '$VERSION_TAG'"
git tag "$VERSION_TAG"
git push origin "$VERSION_TAG" || echo "Tag already exists or cannot push"
test:project:
desc: Test tool by setting it up and deploying on AEMaaCS
dir: test/project
cmd: |
sh setup.sh
test:e2e:
dir: test/e2e
desc: Test tool using end-to-end tests
cmd: |
set -e
sh nw npm install
sh nw npx playwright {{.CLI_ARGS | default "test"}}
test:e2e:codegen:
dir: test/e2e
desc: Generate end-to-end test code from recording
cmd: |
sh nw npm install
sh nw npx playwright codegen --target=ts {{.AEM_AUTHOR_HTTP_URL}}
test:e2e:report:
dir: test/e2e
desc: Show end-to-end test report
cmd: |
sh nw npx playwright show-report
rde:setup:
desc: setup access to RDE
cmds:
- command -v aio || npm install -g @adobe/aio-cli
- aio plugins:install @adobe/aio-cli-plugin-aem-rde
- aio login
- echo -e "Connecting to RDE..."
- aio aem:rde:setup
rde:deploy:all:
desc: deploy AEM all package to RDE
cmd: |
package=$(find all/target/ -name "acm.all*.zip" -type f | head -n 1)
if [ -z "$package" ]; then
echo "Error: Could not find package starting with 'acm.all' in all/target"
exit 1
fi
package_name=$(basename "$package")
echo "Package name: $package_name"
echo "Installing package on RDE..."
aio aem:rde:install --type "content-package" "all/target/$package_name"