-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
287 lines (248 loc) · 12.2 KB
/
Taskfile.yml
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
---
version: '3'
includes:
ansible: ./.config/taskfiles/ansible/Taskfile.yml
ansible:ansibler: ./.config/taskfiles/ansible/Taskfile-ansibler.yml
ansible:playbook: ./.config/taskfiles/ansible/Taskfile-playbook.yml
ansible:populate: ./.config/taskfiles/ansible/Taskfile-populate.yml
ansible:test: ./.config/taskfiles/ansible/Taskfile-test.yml
boilerplate: ./.config/taskfiles/boilerplate/Taskfile.yml
ci: ./.config/taskfiles/ci/Taskfile.yml
ci:github: ./.config/taskfiles/ci/Taskfile-github.yml
common: ./.config/taskfiles/common/Taskfile.yml
common:code: ./.config/taskfiles/common/Taskfile-code.yml
common:update: ./.config/taskfiles/common/Taskfile-update.yml
docker: ./.config/taskfiles/docker/Taskfile.yml
docker:build: ./.config/taskfiles/docker/Taskfile-build.yml
docker:test: ./.config/taskfiles/docker/Taskfile-test.yml
docker:update: ./.config/taskfiles/docker/Taskfile-update.yml
fix: ./.config/taskfiles/fix/Taskfile.yml
git: ./.config/taskfiles/git/Taskfile.yml
git:github: ./.config/taskfiles/git/Taskfile-github.yml
git:gitlab: ./.config/taskfiles/git/Taskfile-gitlab.yml
git:hook: ./.config/taskfiles/git/Taskfile-hook.yml
go: ./.config/taskfiles/go/Taskfile.yml
go:test: ./.config/taskfiles/go/Taskfile-test.yml
image: ./.config/taskfiles/image/Taskfile.yml
install: ./.config/taskfiles/install/Taskfile.yml
install:go: ./.config/taskfiles/install/Taskfile-go.yml
install:npm: ./.config/taskfiles/install/Taskfile-npm.yml
install:python: ./.config/taskfiles/install/Taskfile-python.yml
install:software: ./.config/taskfiles/install/Taskfile-software.yml
lint: ./.config/taskfiles/lint/Taskfile.yml
lint:esprint: ./.config/taskfiles/lint/Taskfile-esprint.yml
lint:markdown: ./.config/taskfiles/lint/Taskfile-markdown.yml
lint:prose: ./.config/taskfiles/lint/Taskfile-prose.yml
nest: ./.config/taskfiles/nest/Taskfile.yml
npm: ./.config/taskfiles/npm/Taskfile.yml
npm:cov: ./.config/taskfiles/npm/Taskfile-cov.yml
npm:doc: ./.config/taskfiles/npm/Taskfile-doc.yml
packer: ./.config/taskfiles/packer/Taskfile.yml
packer:build: ./.config/taskfiles/packer/Taskfile-build.yml
packer:update: ./.config/taskfiles/packer/Taskfile-update.yml
publish: ./.config/taskfiles/publish/Taskfile.yml
publish:android: ./.config/taskfiles/publish/Taskfile-android.yml
publish:brew: ./.config/taskfiles/publish/Taskfile-brew.yml
publish:chrome: ./.config/taskfiles/publish/Taskfile-chrome.yml
publish:firefox: ./.config/taskfiles/publish/Taskfile-firefox.yml
publish:ios: ./.config/taskfiles/publish/Taskfile-ios.yml
publish:menubar: ./.config/taskfiles/publish/Taskfile-menubar.yml
publish:opera: ./.config/taskfiles/publish/Taskfile-opera.yml
python: ./.config/taskfiles/python/Taskfile.yml
python:test: ./.config/taskfiles/python/Taskfile-test.yml
security: ./.config/taskfiles/security/Taskfile.yml
symlink: ./.config/taskfiles/symlink/Taskfile.yml
upstream: ./.config/taskfiles/upstream/Taskfile.yml
upstream:common: ./.config/taskfiles/upstream/Taskfile-common.yml
upstream:commondocs: ./.config/taskfiles/upstream/Taskfile-commondocs.yml
upstream:docs: ./.config/taskfiles/upstream/Taskfile-docs.yml
upstream:project: ./.config/taskfiles/upstream/Taskfile-project.yml
upstream:shared: ./.config/taskfiles/upstream/Taskfile-shared.yml
vscode: ./.config/taskfiles/vscode/Taskfile.yml
web: ./.config/taskfiles/web/Taskfile.yml
web:ionic: ./.config/taskfiles/web/Taskfile-ionic.yml
web:nx: ./.config/taskfiles/web/Taskfile-nx.yml
web:profile: ./.config/taskfiles/web/Taskfile-profile.yml
output: interleaved
vars:
DOCKERHUB_PROFILE: megabytelabs
GALAXY_NAMESPACE: professormanhattan
GITHUB_ORG: ProfessorManhattan
GITHUB_USER: ProfessorManhattan
IGNORE_FOLDERS: -path './.autodoc/*' -o -path './.cache/*' -o -path './.common*' -o -path './.config/*' -o -path './.git/*'
-o -path './.github/*' -o -path './.gitlab/*' -o -path './.husky/*' -o -path './.modules/*' -o -path './.npm/*'
-o -path './.pnpm-store/*' -o -path './.shared/*' -o -path './.task/*' -o -path './.venv/*' -o -path './.vscode/*'
-o -path './build/*' -o -path './dist/*' -o -path './node_modules/*' -o -path './roles/*' -o -name pnpm-lock.yaml
-o -name package-lock.json -o -name poetry.lock -o -name '.variables.json'
INIT_SCRIPT: https://gitlab.com/megabyte-labs/common/shared/-/raw/master/common/.gitlab/ci/scripts/update-init.sh
LOG_FIX:
sh: chmod +x .config/log && echo "heyhey"
NPM_KEEP_UPDATED: '@washingtondc/* eslint-config-strict-mode sleekfast'
NPM_PROGRAM: npm
NPM_PROGRAM_LOCAL: pnpm
NPX_HANDLE: 'pnpx '
NPX_PACKAGE: pnpx
PYTHON_HANDLE:
sh: if [ -z "$GITLAB_CI" ] || [[ "$OPTIMIZED_IMAGE" == 'false' ]]; then echo 'poetry run '; fi
REPOSITORY_SUBTYPE: playbook
REPOSITORY_TYPE: ansible
TIMEZONE: America/New_York
tasks:
donothing: 'true'
environment:
interactive: true
desc: Symlink to an environment in the `environments/` folder
summary: |
# Symlink an environment's contents to the root
This method is convienience method for symlinking all of the folders in
`environments/prod/`, for instance. You can pass the environment as a CLI
argument or you can use an interactive prompt.
**Example opening a prompt:**
`task environment`
**Example using CLI argument:**
`task environment -- prod`
cmds:
- task: ansible:playbook:environment
group:exec:
desc: Execute group commands on any group (including repositories in sub-groups)
summary: |
# Run commands on multiple repositories in parallel
This command requires that the `GITLAB_TOKEN` environment variable be set. With the
token defined, you can use this task to run scripts on repositories that fall under
any given group or sub-group. By default, it runs the script(s) on all the
repositories in the specified group and sub-groups.
You can use this task to perform adhoc bulk changes to large numbers of
repositories that are hosted on GitLab.
**Example usage:**
`task group:exec -- group/subgroup ---- 'bash <(curl https://myscript.com)'
In the example above, the bash command will be run in the root of each repository.
cmds:
- task: git:gitlab:group:exec
init:
desc: Ensures project is initialized with upstream files and migrates pre-existing projects
summary: |
# Initialize the project and run the full update sequence
This command will mostly not be needed for pre-existing projects. This task begins
by calling a script that:
1. Migrates legacy projects
2. Fixes common errors
3. Ensures the project is initialized
4. Prompts for missing metadata
5. Runs the `start` task
If you are facing difficulties, you can try running this task to reset the project,
perform common fixes, and run the whole start up routine.
cmds:
- git init
- |
if [ -n "$GITLAB_CI" ]; then
if [ -n "$UPDATE_INIT_SCRIPT" ]; then curl -s "$UPDATE_INIT_SCRIPT" | bash; fi
else
bash <(curl -s {{.INIT_SCRIPT}})
fi
playbook:
desc: Run the playbook
summary: |
# Run the playbook
This task will prompt you for the environment and inventory you would like to
run the `main.yml` playbook with. It will:
1. Symlink all roles in the `roles/` folder to `~/.ansible/roles`
2. Run `task environment` (which prompts and symlinks the appropriate environment)
3. Prompt for which inventory to use
4. Run `ansible-playbook -i inventories/your_choice --ask-vault-pass main.yml`
**Example usage:**
`task playbook`
**Example bypassing prompts, using the `inventories/inventory.yml` file:**
`task playbook -- inventory.yml`
cmds:
- task: ansible:playbook:run
preload:
deps:
- install:brewfile
desc: Set up your workstation in advance by installing commonly used programs
summary: |
# Speed up future development by preloading common system applications
Just about every development task requires some sort of globally installed
application. TypeScript requires Node.js to be installed. Ansible requires
a handful of CLIs (and Python). This task will check for missing applications
and install them globally. If you do not run this task, the routines will
assume you want to keep the footprint small and use disposable virtual
environments whenever possible (i.e. `{{.NPX_PACKAGE}}` in the case of Node.js,
`poetry` in the case of Python, etc.).
## Reboot Requirements
Some software that is installed, like VirtualBox and Docker, require reboots so
it is recommended that you reboot after running this task.
## Passwordless Installation
This installation method and all the methods we use will only prompt for a sudo
password when absolutely necessary. If you already have common development tools
it is possible that you will not even have to enter a sudo password. This is
accomplished by installing to `$HOME/.local/bin` whenever a traditionally system
level binary is installed. However, if you are missing something like git, then
chances are you will be asked for a sudo password. In this case, we recommend
you adopt the Megabyte Labs philosophy and inspect the code before running it.
cmds:
- |
task install:modules:global &
task install:pipx:global &
wait
.config/log success 'Successfully preloaded commonly used system applications'
.config/log info 'Some software that requires a reboot may have been installed - rebooting would be prudent'
prepare:
desc: Prepares the project for the normal start command
summary: |
# Prepare the project
This task ensures the project has all the required metadata. If a project
is missing required metadata then this task will interactively prompt the user
for the missing data. It also performs miscellaneous tasks that are sometimes
required by the `start` task.
cmds:
- task: boilerplate:check:package
- task: boilerplate:clean
scripts:
interactive: true
deps:
- install:npm:ntl
desc: Run and view descriptions for `npm scripts` via an interactive dialog
summary: |
# Interactively select scripts defined in package.json
Our projects use `run` (a fork of task) to handle most of the task running.
However, in some projects there may be scripts defined in package.json. This
task is a convienience method that will present a list of scripts alongside
their descriptions that you can interactively launch.
cmds:
- NTL_RUNNER={{.NPM_PROGRAM}} {{.NPX_HANDLE}}ntl
services:
desc: Update elements of the repository that require API access
summary: |
# Update elements of the repository that require API access
This task will ensure that the git repositories and other services related to the
project are updated with the proper configurations. It requires that certain
API keys be set. Generally, only project owners will use this task.
cmds:
- task: common:update:services
start:
desc: Set up the project and refresh it with the latest changes
summary: |
# Start the project
This task will scaffold the project with the latest upstream changes
and ensure your development environment has all the dependencies installed.
This command should be used whenever the files that are automatically generated
need to be updated. It also serves as an entry point for new developers who
are getting started with the project.
**Example usage:**
`task start`
cmds:
- task: upstream:project
test:
interactive: true
desc: Open an interactive dialog to select and run a Molecule test
summary: |
# Test Ansible plays
This task wraps all the supported test methods for Ansible plays into a
convienient multi-question prompt system that supports:
1. Docker tests
2. Headless VirtualBox tests
3. VirtualBox Desktop tests which are not automatically destroyed
4. Running the play locally
5. Running the play over SSH on a remote target
cmds:
- task: ansible:test:prompt