-
Notifications
You must be signed in to change notification settings - Fork 147
Support postDebugTask property #1557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Makes sense since we have Another problem I'm thinking is about the naming. Maybe we should call it |
No problem with the naming but I don't know why the naming preLaunchTask (launch) and then postDebugTask (debug) in the launch attributes. In my case, In a multi-root workspaces configuration, for just one workspace folder, I'm running a docker-compose up (for ignite and postgres start) for tests that needs database access. I'd like to automatically call a docker-compose down task to tear down the databases just after the tests for that workspace folder has ended. NOTE: It's also a pitty that I need to define the corresponding empty tasks in other workspaces for the extension complaining for non existing task on those workspaces (as the java.test.config referencing the preLaunchTask is defined at devcontainer.json level), but this is a different issue. |
I'm confused as well. 😂 Thanks for the information. |
@rubensa, I just released a pre-release |
Thanks @jdneo |
@jdneo I tried it and works like a charm 👍 |
Good to know, thank you for the update! 😁 |
@jdneo Doing some more test I found some weird behavior... For some settings looks like it works ok but for other it can't find the corresponding postDebugTask. I have a I have other |
Do you have a sample to reproduce the issue? Is it caused by scope mismatch? (User/Workspace/Workspace Folder) |
@jdneo some more investigations... I changed the order that the tasks are defined in tasks.json the one that was working is not working anymore an the one that was not working is working now 😨. For now I'm using both settings.json and tasks.json defined at .vscode folder level in a VSCode workspace. |
This is the settings.json I'm using {
"java.test.config": [
{
"name": "test-local",
"vmArgs": [
"-Dspring.profiles.active=test-local"
],
"envFile": "${workspaceFolder:data-api}/.devcontainer/.env.local",
"preLaunchTask": "Setup test-local",
"postDebugTask": "Teardown test-local"
},
{
"name": "test-snowflake",
"vmArgs": [
"-Dspring.profiles.active=test-snowflake"
],
"envFile": "${workspaceFolder:data-api}/.devcontainer/.env.local",
"preLaunchTask": "Setup test-snowflake",
"postDebugTask": "Teardown test-snowflake"
}
]
} and this is the tasks.json {
"version": "2.0.0",
"tasks": [
{
"label": "Setup test-local",
"type": "docker-compose",
"dockerCompose": {
"projectName": "data-api",
"up": {
"detached": true
},
"files": [
"../.devcontainer/docker-compose-test.yml"
]
}
},
{
"label": "Teardown test-local",
"type": "docker-compose",
"dockerCompose": {
"projectName": "data-api",
"down": {},
"files": [
"../.devcontainer/docker-compose-test.yml"
]
}
},
{
"label": "Setup test-snowflake",
"type": "docker-compose",
"dockerCompose": {
"projectName": "data-api",
"up": {
"detached": true,
"services": [
"ignite-db"
]
},
"files": [
"../.devcontainer/docker-compose-test.yml"
]
}
},
{
"label": "Teardown test-snowflake",
"type": "docker-compose",
"dockerCompose": {
"projectName": "data-api",
"down": {},
"files": [
"../.devcontainer/docker-compose-test.yml"
]
}
}
]
} |
Have you defined |
Nope, as, If I define that, I can't select which config should be used for the execution (see: #1556). |
Hmm, what the extension does is simply put the configured |
Yes, both pre-launch tasks are working. The problem is only with post-debug tasks. |
Interesting. What if replacing the current post debug tasks to some very simple ones, like:
|
It works with that!! I'm really confused now... Looks like a bug in the |
Maybe?? 🤔 |
Very curious... If I have one using the type shell and other using the type docker-compose, both works without problem. If I have both of type shell they work too. But if I have both of type docker-compose, only the last one is found. |
If you can reproduce it using normal launch configuration with |
I managed to guess that the problem only happens if the docker-compose task definitions are equal (only changes the label). If I modify, for example, the down content (adding a removeOrphans option in one of them, but not in the other), both tasks are recognized without problem. Again I'm very confused and surprised here... Should this be some kind of "optimization" in the vscode-docker extension (as the same with type shell works) that is not working right? 😕 |
Provide support for postLaunchTask (like postDebugTask for launch configurations) property to launch a task at the end of testing.
This attribute should be set to the name of a task specified in tasks.json (in the workspace's .vscode folder).
NOTE: This would be the companion to preLaunchTask.
The text was updated successfully, but these errors were encountered: