Is it possible to auto select different "gcloud" configs for different projects in multiple workspaces / folders ? Gcloud on multiple projects - visual-studio-code

From this question and this article we get that is possible to create multiple configs for the gcloud SDK.
But it seems that you have to manually switch between then, by running:
gcloud config configurations activate <CONFIG_NAME>
But is there a way for each config to be automatically selected whenever I open up a project workspace/folder on VSCode? How can I do this?
I've just tested activating a new config on a different VSCode project. That seems to update it globally. Now, all of my VSCode windows (different projects) are seeing the same activated config.
Isn't it dangerous? I mean, I could be uploading stuff to the cloud on a different project that I'm not aware of. How do people usually handle this? Do I need to run the activate command on every script before deploying something?

Unfortunately, I am not aware of such a possibility, however I have found something interesting that may help you. There is following extension:
GCP Project Switcher
The extension only allows you to change projects, however as I looked into the code it is running gcloud set config project command under the hood. You could raise a request to add the possibility to change the whole configuration to the instead of project only, as it is a very similar approach.

Related

"SFDX: Deploy Source to Org" function missing

Hello I have created a LWC project in VS Code but the "SFDX: Deploy Source to Org" option is missing when I Right-click the default folder under force-app/main.
I have authorized the org and set a default scratch org.
Please help.
For scratch orgs it's more "natural" to push and pull the changes, let SFDX figure out what changed on your system / what changed server-side (new field, new report? new object? good luck spelling it all out in package.xml, life is too short for it). The team behind VSCode sfdx plugin made conscious decision to hide these options.
Try with sfdx force:source:push.
If you need single file there's still source-ish deploy command (will warn you if you're overwriting something changed on server / by another dev and you can force deploy if you want).
https://developer.salesforce.com/tools/vscode/en/user-guide/development-models
https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_develop_any_org.htm
The deploy-retrieve are old school metadata api commands

How do i create a custom devcontainer?

i have been using devcontainers for a while, and i want to extend some of them.
For instance, i want to install all the linting tools etc for various languages, and use a more personalised container as a starting point (compared to the Microsoft hosted ones).
I also like to host the containers on my own dockerhub, so i do not need to build all this stuff every time. There could also be the use case of using devcontainers for something other than the standard libraries.
I know i can just manually change the docker image reference, but i also like to integrate my changes into the plugin, so i can have my own repository show up as well, to get a native feeling.
I could not find any information on creating my own dev containers, only on extending existing ones. Is any of this i mention officially supported?
Edit: To sum all this up in one question; Can i add devcontainers from my own repo, without merging them into https://github.com/microsoft/vscode-dev-containers ?
If you are using VSCode as the text editor you can install the remote extension pack which allows you to add a template for a devcontainer to your project.
If you aren't using VSCode you can use the templated version as the basis for your own. I created a template repository with the files needed for Python project which you can refer to as well

Apama 10.3: Add pysys nature to projects

I am working with Apama 10.3, in Software AG Designer. I have a project that I'd like to add the Pysys nature to my project, but the usual attempts (right-click on project name, project > properties, etc.) don't help. I couldn't find anything in the documentation either.
How can I work with Pysys in Designer, please? I'd like to be able to build my tests via the IDE, for consistency and convenience.
Currently eclipse/Designer doesn't have a PySys nature, but what you can do is add a generic eclipse "Python" nature – which you can do using "PyDev".
And then to launch pysys from eclipse you’ll need to add a launch configuration. There are various options but the most convenient for this purpose is the “external tool” eclipse feature.
You need to invoke pysys.py with the right environment for locating python and also Apama if you want to use it with the Apama extensions. If you’re using PySys with Apama 10.3.1+ this is easy as you can use the new capability of the apama_env.bat script to execute a command e.g. ${apama_home}\bin\apama_env pysys run –n 0 –purge. If you’re on an earlier version I’m afraid you probably need to create a trivial .bat script of your own that first runs apama_env and then pysys %*
You'll want to set the working directory in the eclipse launch config go ${project_loc}/tests so it runs all tests. Or alternatively, ${selected_resource_loc}, to invoke a specific test subtree. You could create separate launch configs for both use cases.

How can you launch VSCode with multiple extensionDevelopmentPath sources?

I'm trying to test local changes of omnisharp-vscode in conjunction with my own local extension. I can't for the life of me figure out how to boot the VSCode experimental instance with more than 1 extension.
I've tried:
Providing multiple extensionDevelopmentPath arguments when booting
vscode
Running omnisharp-vscode and then opening and running my other extension in the experimental instance.
None of the above have worked for me.
The easiest solution would probably be to simply move one (or both) extensions into your .vscode/extensions directory. This might require you to remove the marketplace installs of those extensions if present. Even though "development installations" of extensions like this are not officially supported yet, they work just fine regardless.

"No project ID could be determined from the Cloud SDK configuration" when running psqworker

When I was going through the Google Cloud tutorial: https://cloud.google.com/python/getting-started/using-pub-sub#running_the_app_on_your_local_machine
I got the following error:
google.auth._default No project ID could be determined from the Cloud SDK configuration. Consider running gcloud config set project or setting the GOOGLE_CLOUD_PROJECT environment variable
I did 'gcloud config set project [my project name]' with no success.
What's the problem?
Update: I've deployed app engines previously without any problem. The problem only happens when I run the psqworker for this Pub/Sub function. I know my project ID and used it before.
The first thing I would try would be:
gcloud info
This will tell you the account and project that gcloud is currently set to.
You may also find the available projects for your account with the following gcloud command:
gcloud projects list
Locate the project ID and project number
There are two ways to identify your project: the project number and project ID.
The project number is automatically assigned when you create a project.
The project ID is a unique identifier for a project. When you first create a project, you can accept the default generated project ID or create your own. A project ID cannot be changed after the project is created, so if you are creating a new project, be sure to choose an ID that you'll be comfortable using for the lifetime of the project.
Note: You should be aware that some resource identifiers (such as project IDs) might be retained beyond the life of your project. For
this reason, avoid storing sensitive information in resource
identifiers.
To locate your project ID and project number:
Go to the Cloud Platform Console
From the projects list, select the name of your project.
On the left, click Dashboard. The project name and ID are displayed in the Dashboard.
TL;DR
Use virtualenv -p C:/Python27/python.exe name-of-env instead of virtualenv -p C:/Python36/python.exe name-of-env in the tutorial
I ran into a similar issue. Here are the steps I went through and why. Hope it helps!
First I tried to specify the id with the command gcloud config set project name-of-your-project
This resulted in the error
ERROR: Python 3 and later is not compatible with by the Google Cloud SDK. Please use a Python 2.7.x version.
If you have a compatible Python interpreter installed, you can use it by setting
the CLOUDSDK_PYTHON environment variable to point to it.
I thought this error was weird because the tutorial tells you to use python3 but it doesn't work. So I created a virtualenv with python2.7 like so
virtualenv -p C:/Python27/python.exe name-of-env (I have python 2 and 3 so its easier to specify the whole path to the .exe file)
Then follow the rest of the tutorial with
name-of-env\scripts\activate
pip install -r requirements.txt
Don't know why you have to use python3 when it doesn't even work.