Opensuse Images No Longer Visible in Default Compute Instance - gcloud

All,
Opensuse Images are not listed as Active in GCloud but are showing up in the gloud commands in my project.... the Opensuse project is not mine... can I link to someone else's
[Gcloud shell output

My apologies I found a suitable answer:
Is it possible in google cloud web client to create an instance from image in different project?
The Command syntax is from the Gloud Shell is:
gcloud compute instances create production-instance-from-staging-image --image staging-image-1 --image-project staging-project
For Opensuse you have to link to their staging project which is opensuse-project which includes the images. The exact command is attached.....
enter image description here

The Original Question is how to build Gcloud Instances on OpenSUSE with the Console. It used to be a default option in each project.
To achieve this you have to do two things:
1) Find the Opensuse Projects which are in fact documented in Google's online support but requires a gloud command to find the specific images.
The command is :
gloud compute images list --project opensuse-cloud --no-standard-images
2) You have to specifically provision to your project from the opensuse-cloud project
gcloud compute instances create your-instancename --image image-namefrom#1 --image-project opensuse-cloud

Related

Multithread Pytest

I wanted to create a test in PyTest where it will parallelly open two Chrome and Firefox browser and test two test cases one by one with valid and invalid sets of inputs. How should I achieve it?
Thanks for your advanced help.
You can achieve this using following methods
Selenium Grid and docker.
Download docker and pull the image for Selenium Hub and Image for Chrome and Image for Firefox. Start the containers and you are good to go.
You can follow the instruction from this page.
https://github.com/SeleniumHQ/docker-selenium
If you do not want to use docker then, you can download selenium grid jar file for hub and nodes in your local machine and manually trigger them using the command prompt. following link can be useful they have explained it very nicely
https://www.guru99.com/introduction-to-selenium-grid.html
https://www.selenium.dev/documentation/en/grid/grid_4/setting_up_your_own_grid/

Container image shows configuration vulnerability with openssh server package

One of my images in registry shows this configuration issue:
Security Practice
SSH server package, openssh-server of version (none):7.4p1-21.el7, found.
How to Resolve
checking if ssh server is installed
But I am not sure what exactly does this mean? We do install 7.4p1-21.el7 version. Does this suggest ot upgrade? The resolution is not very clear.
The reason you are seeing this issue in the report is because it is not a good practice to install SSH in containers.
However, if you do require SSH you can create an exemption for this check so that this issue will no longer be flagged against the image in the report.
You can either do this with the IBM Cloud Container Registry(cr) command line with the command
ibmcloud cr exemption-add --help
or through the UI by clicking on the action menu (three vertical dots) next to the configuration issue --> Create exemption.
For more information on setting exemption policy, check the documentation here

GCR Cloud Run says "Image [name] not found"

I'm trying to take my first baby steps with podman (instead of Docker) and Google Cloud Run. I've managed to build an image with a gcr.io tag and push it to Google. I then create a new service, and I can select the image in the "Select Image URL" pop-up dialog. But then the service fails to start, saying "Image [full name] not found".
I can't find anything on Google's support pages, or anywhere else. I can pull the image, I can push new versions, and they appear on the pop-up dialog. But the service still reports that they can't be found.
What am I doing wrong?
Edit in answer to DazWilkin's questions below:
Can you run the podman-created container locally using Docker?
I can't run Docker locally because it is not compatible with Fedora 31 (hence podman). But I can run it locally using podman run
Can you deploy a Docker-created container in Cloud Run?
As above: F31. However podman is supposed to be a drop-in replacement.
Is the container registry in the same project as Cloud Run?
Yes. I did have a problem with that, but I got a permissions message rather than "not found".
Have you tried deploying via gcloud rather than the console?
Yes.
$ podman push eu.gcr.io/my-project/hs-hello-world
Getting image source signatures
Copying blob c7f3d2e0289b done
Copying blob def7032cea8e done
Copying config f1c2e2615f done
Writing manifest to image destination
Storing signatures
$ gcloud run deploy --image eu.gcr.io/my-project/hs-hello-world --platform managed
Service name (hs-hello-world):
Deploying container to Cloud Run service [hs-hello-world] in project [my-project] region [europe-west1]
X Deploying... Image 'eu.gcr.io/my-project/hs-hello-world' not found.
X Creating Revision... Image 'eu.gcr.io/my-project/hs-hello-world' not found.
. Routing traffic...
Deployment failed
ERROR: (gcloud.run.deploy) Image 'eu.gcr.io/my-project/hs-hello-world' not found.
When I used a Google-built container it worked fine.
Update: 5 March 2020
In the end I just carried on with the Google build service, and it works fine. My initial wish for local builds was in large part because a build on Google was taking over half an hour (lots of Haskell libraries to import), but now I've figured out how to use staged builds and multi-processor VMs to avoid this. I appreciate the efforts of those who have tried to help, but right now it's not broke so I'm not going to try to fix it.
I had the same issue: it seems Cloud Run is picky about the kind of manifest it can pull.
By building my images with --format docker and pushing them with --remove-signatures (inspired by this issue), podman will create and push docker-style manifests to the Container Registry and everything ran smoothly!
Too bad I spent a lot of time thinking it was a lack of permissions problem
I had the same error. My issue was that I was using the docker/setup-buildx-action in a GitHub action. When this was removed, Cloud Run was happy with the resulting manifest / container image.
Thanks to #André-Breda for providing the direction.
I've been having the same issue today. I'm using buildah to create the new image. I realized that the image I used successfully yesterday was built as root. So I built the new one as root and pushed it successfully.
Wish I knew why. The images built as my username ran fine locally with rootless podman.

Google Cloud Platform - Specifying Project Name

I am trying to follow Google's instructions on deploying a Cloud Function from the command line. I cloned their sample project, but when I used gcloud functions deploy to deploy it, it complained that it failed to find attribute [project]. I had to provide that manually.
Where in their docs to they talk about setting the project attribute? I must've missed it, and it seems pretty important ...
This answer is in addition to #Kolban.
You can modify your gcloud settings at any time. Here are some common ones:
gcloud config set core/project my-project-id
gcloud config set compute/region us-central1
To list your projects:
gcloud projects list
To see your current settings:
gcloud config list
To see your authorization settings:
gcloud auth list
Then there are settings for individual services such as Cloud Run:
gcloud config set run/region us-central1
To get help to see the vast number of settings available:
gcloud config --help
All of this is documented. Just put a command into Google and a document link will appear. For example put this string into Google: "gcloud compute instances create". The first link takes you to the command documentation.
When you install the Google Cloud SDK (which provides the gcloud command), you have the opportunity to create one or more configurations (including the default). Think of these as "profiles" for your interaction with GCP. A configuration includes:
Your identity
Your default project
Your default region/zone
See the following article:
Initializing Cloud SDK
It sounds like you either didn't run gcloud init or didn't identify a project you wanted to use when you did run it. When you subsequently run gcloud commands and don't specify a project, then the current configuration project will be used. If you didn't set one, then that would explain the error encountered.

"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.