How to perform Google Add-on automated deployment/publishing? - google-apps-script

My team is trying to apply modern software engineer techniques in developing an editor add-on for Google Spreadsheet.
With clasp, typescript, jest, git, GCP and CircleCI we were able to achieve:
local development with our preferred source code management;
unit testing/tdd on our domain rules;
manage add-on versions by clasp;
observability with Stackdriver on GCP;
with CircleCi, we create a pipeline that executes unit-tests, makes clasp push and versions the add-on with the commit hash as a description.
In addition, through Google Marketplace SDK, the add-on has been distributed privately in our domain, therefore it doesn't need Google approval.
The point is: we're looking for a way to add a step in our pipeline to, programmatically, update and manage our published add-on.
e.g.: after the generation of a new version with clasp, how to put it in the App Configuration on GCP?
gcp app configuration page
In the documentation there are only manual steps.
Thank you all =)

At some time in the future, it may be possible to use the:
G Suite Add-ons Cloud API
to automatically "deploy" an add-on.
https://developers.google.com/gsuite/add-ons/guides/alternate-runtimes-overview
But I'm not sure what a "deployment" includes.
I'm not sure if there is a way to do this through the Google Cloud Deployment Manager:
https://cloud.google.com/sdk/gcloud/reference/deployment-manager
https://cloud.google.com/deployment-manager/docs
I don't see a gcloud command category for the G Suite Marketplace.
The G Suite Marketplace SDK is solely a Web Based UI tool. And even though there is a G Suite Marketplace API, it has no capability to create or update an editor add-on listing.
https://developers.google.com/gsuite/marketplace/reference/rest?hl=en_US
There are aspects of the Cloud Project that the editor add-on is attached to, that can be programmatically managed through gcloud commands, using the G Cloud Projects tool. For example, you can set and update whether a user has permission to do certain things with the Cloud Project. But all of those things are in a different category than publishing a G Suite Marketplace editor add-on.
https://cloud.google.com/sdk/gcloud/reference/projects
The Cloud Project that the G Suite Marketplace SDK is associated with doesn't directly control the G Suite Marketplace SDK.
I would look at the Google Cloud Deployment Manager to see if there is a way to do this. Other than the Google Cloud Deployment Manager, I haven't discovered any other leads that look hopeful.

Related

Status december 2020 - 'The deployment ID is not associated with the current project'

I'm trying to publish a simple Google Add-on.
I have followed each step of this Google Developers page and in the third step: Enable and configure the Google Workspace Marketplace SDK, in About App Configuration you have to enter the Deployment ID, the project script ID, the version and some links.
On clicking save, I get the same Issue over and over again; The deployment ID is not associated with the current project. I've tried this several times over several days and it still doesn't work.
Does anybody have a solution?
Could it be that Google is overloaded?
Thanks, greetings Gabriel.
You need to convert you Apps Script project into a standard GCP project
This you can do by
going on Resources-> Cloud Platform project...
and inserting a GCP project number:
You can find the project number in the Dashboard of your GCP console
IMPORTANT
You need to bind the Apps Script to exactly the same GCP project under which you want to deploy the Add-on with the Marketplace SDK

How to fix the "Your account does not belong to the same domain as this cloud project or app" error?

I'm updating an app on G Suite Marketplace SDK. It used to work by just changing the script version at the "App Configuration" Tab, and click Save.
Now it posted a warning at the top of the page saying:
Your account does not belong to the same domain as this cloud project or app
and the Save button is grey and not clickable.
Error image can be seen here:
What is the issue and where should I go to check and verify the domains?
Terms:
GCP - Google Cloud Platform
Apps Script project - Your Apps Script file
Your Google Cloud Platform (GCP) project that is associated with your Apps Script project is in a default category of "No organization." That's the problem.
If you already have an organization set up in your GCP, then skip down to the "Migrate your Cloud Platform Project" section below.
If you have not created an organization in your Cloud Platform project, then you need to do that. After creating an organization, you must migrate the Cloud Platform project for your add-on in "No organization" to your Organization.
Your organization is your "company."
Your Google Workspace account (formerly G Suite) can only have one Organization provisioned with it. You probably have Cloud Platform projects that were automatically put under the "No organization" category. If you already have an Organization in your Cloud Platform project, then you won't see an option to create another one.
Create an organization in Cloud Platform Project
Migrate your Cloud Platform Project:
Open the Cloud Platform Project for your add-on
Open IAM & Admin
Click Settings
Click the Migrate link
Choose the organization to migrate to
Click the button:
Wait for confirmation that the migration happened
I migrated a Cloud Project for an add-on without any problem. You can also change ownership of a Cloud Project from one Google account to another Google account.
My assumption is, that the Cloud Project isn't affected by migrating it because it's basically running independently from whatever account or organization it's associated with.
The only way to know that for sure is if someone from Google provided an answer, but the only way to get support for Cloud Projects is to buy a support plan, and the least expensive one is $100 dollars a month per user.
Google Cloud Project support plans
Technically, Apps Script is not supported by Google, and there is no Google contact person to get answers from.
With the Google Workspace Marketplace SDK, you must associate an Apps Script project with the Cloud Platform project. If you changed ownership of the Apps Script file that the Google Workspace Marketplace SDK was associated with, then there would likely be a problem.
You'd need to make sure that whoever owned the Cloud Platform Project also owned the Apps Script file. If the Apps Script file was deleted, then that would kill the add-on.
I run into this issue and I share what I did that is a bit different of previous answer.
I have a Gmail account that manage the Apps Script and also have a workspace domain. When the first time I publish the app I move the GCP project created in my Gmail acocunt to the GCP Oragnization of my domain. Previously it never generate problem but today I have the eror message
Your account does not belong to the same domain as this cloud project or app
What I did :
On the workspace domain with the super admin account that have the GCP Organizaional Owner role I added my Gmail account as Oragnization manager
Organization Role Administrator
=> It does not work.
So I finally added my domain account as owner of project and it works.
It seems something change in the Marketplace Workspace SDK management and if a project belong to an organization, now you can no longer modify Marketplace item with a Gmail account.

Stop Apps Script from creating GCP projects

I'm seeing a large number of GCP projects being created by serviceAccount:appsdev-apps-dev-script-auth#system.gserviceaccount.com, following invocation of Apps Scripts.
I'd like to control or block such project creation.
What are the right ways to accomplish that?
That's not possible. Quoting GCP Projects's documentation:
By default GCP projects have an Identity and Access Management (IAM)
policy with one entry, a Google service account that acts as the owner
of the default project. The Google service account is
appsdev-apps-dev-script-auth#system.gserviceaccount.com.
Also:
Every Apps Script project uses the Google Cloud Platform to manage
authorization, Advanced services, and other details. To configure and
manage these settings, every Apps Script project has an associated
Google Cloud Platform project (a GCP project).
You can use a default GCP project or a standard project created by you, but the Apps Script project does need a GCP Project.
Moreover, since April 8, 2019 it's not possible to access the default GCP projects created for Apps Script projects unless they are older.

Not able to install editor add-on for whole domain

I have published a Sheets Editor Add-on on Chrome Web Store and my colleagues on the same G Suite domain can install it just fine, via the Web Store link.
However, the G Suite account admin doesn't have the option to install it for the whole domain. Anyone have a clue on where to start investigating this?
Edit: I have read in other places that it sometimes takes 3-4 days from publishing in Chrome Web Store until it shows up in the Marketplace. However this doesnt seem to be the case for us since we now have waited for about a week.
The app has to be published on the G Suite Marketplace in order to enable a domain-wide installation.
If it is only published on the Chrome Web Store it has to be installed manually by each user.
Choosing where to publish: GSuite Marketplace or Chrome WebStore
If it is published on the G Suite Marketplace it can be installed for the whole domain by admin account following this steps:
Sign in to Google Admin console.
On the dashboard, click on the Apps icon:
Once there, go to 'Marketplace apps'
Add services to your domain
Search your App and choose to install it for the whole domain
And you are done, the app is installed for the whole domain.
Install Marketplace apps
So I have found a way to publish the app even if it's not discoverable in the Marketplace.
Go to https://console.cloud.google.com/
Go to G Suite Marketplace SDK
Under Publish in the left pane, Publish the add-on and get the App URL.
From the app URL, the domain admin can install the add-on for the whole domain.

Google Sheets add-on not visible in Marketplace Apps for site-wide installation

I have followed all the steps here: https://developers.google.com/apps-script/add-ons/domain-wide
And then went through them a million times already.
I can install and use it if I click Test Installation Flow from under Google Apps Marketplace SDK Configuration.
When publishing, the check box for Publish in Google Apps Marketplace is always checked.
Still, when I log in as a domain administrator and go to Marketplace Apps - Add App, I can't find my app in the list.
If you're from Google support, here's the link to my app, maybe you can check something in the backend: https://chrome.google.com/webstore/detail/enabler4sheets/inpioilbljppoobbblcpbpjplkefmkep
Based from the Google Apps Script documentation, The add-on’s name must be the same as the name of the Apps Script project. The checkbox next to Publish in Google Apps Marketplace should be checked only if you are publishing the add-on for domain-wide install and you are not bundling the add-on with an existing Google Apps Marketplace app. See the style guide for more information on the other fields. Select the most recent version of your code and click Create web store draft. This will open a new page for you to configure the add-on for inclusion in the Chrome Web Store.
What I can suggest is to repeat the process based from the document. Please check the Complete application ad publish your add-on: https://developers.google.com/apps-script/add-ons/publish#complete_application_and_publish_your_add-on