Need help in setup of CI/CD for Google App Script? - google-apps-script

We are building an addon using Google App Script and want to publish it to Google Workspace MarketPlace. We are managed to publish versioned deployment using the Manage Deployment feature of App Script.
We are looking to configure CI/CD for App Script addon (whenever changes committed to a git branch, a new deployment id should be created and respective code should be published on Google Workspace MarketPlace).
We didn't find any workaround to configure CI/CD for App Script. Our preference is Azure for CI/CD.

You can use a combination of the
Apps Script API
Where you can manage deployments and versions.
Workspace Marketplace API
Where you can control your app listing.
You may not be able to do absolutely everything but that will be your best place to start.
I am not familiar with Azure but you can look into git actions to run some API request to the above APIs whenever you make a commit to the main branch.

Related

How to use google app script addon by app script manifest or local environment?

I am new to google app script. I don't know how to deploy the Google add-on. I have tried some setups for deployment but have not been able to do the deployment. so, I have some questions below.?
Can we use the google app script add-on without deploying on google marketplace? or
how to use google add-on local environment?.
or
Can we use the google add-on just by passing appscript.json? as we do in excel? In the excel add-in we just pass the manifest file and we put the dist folder on the local server so anyone can use that add-in.
Can anyone guide me about this.
I suggest you read https://developers.google.com/apps-script/add-ons/ and https://developers.google.com/workspace/marketplace
To deploy an add-on (i.e. create a version of the script that can be used by an app in the Google Workspace Marketplace) see https://developers.google.com/apps-script/concepts/deployments
To test an add-on (install it without having to publish it in the Google Workspace Marketplace)
See https://developers.google.com/apps-script/add-ons/how-tos/testing-editor-addons.
To publish an app in the Google Workspace Marketplace see https://developers.google.com/apps-script/add-ons/how-tos/publish-add-on-overview and https://developers.google.com/workspace/marketplace/how-to-publish.
Sheets and other Google Workspace products are on the cloud, so you can't copy a file somewhere to install and add-on. If you have are a Google Workspace customer you can publish a private app in the Marketplace. Then the admin can install the app for its users.

Google Apps Script: "Error 401: deleted_client The OAuth client was deleted" All of a sudden?

I currently use a Google App Scripts on Google Sheets for my budgeting spreadsheet. Essentially, the way I have it set up is:
Buy item
Input expense onto Google form (which feeds into a spreadsheet)
Use Apps scripts to convert timestamp into yyyy-MM-dd
I've been using this process for 4 years but all of a sudden, today it stopped working by giving me this error below.
Error 401: deleted_client The OAuth client was deleted
Here's my app script:
Here's my trigger:
At some point your Apps Script project's attached Google Cloud Platform (GCP) project (which manages the Oauth client) was likely deleted. You could confirm this by going to the Apps Script project editor, click the gear on the left for Project Settings, then click the Project Number link in the Google Cloud Platform (GCP) Project section. If it loads the GCP console (using the correct Google account) but gives you an error instead of bringing you to the project, then it probably doesn't exist anymore.
First, check if it's been deleted within the past 30 days and could be recovered:
In the GCP console, go to the Manage resources page (project picker → three dots button → select your organization → Manage resources).
Below the list of organizations, folders, and projects, click Resources pending deletion.
If you see the project there, check the box then click Restore. In the dialog that appears, confirm that you want to restore the project.
Go back to the Apps Script project editor and run one of your functions, and it should allow you to authorize the project again instead of giving you the 401 error.
If the project does not appear in the Resources pending deletion list because it'd been deleted over 30 days ago:
Copy all of your Apps Script projects' files to your local machine. If there are many files, consider using the clasp CLI tool, which would allow you to clone the entire project locally with one clasp pull command.
[IMPORTANT] Confirm that all of the files have been stored locally (and backed up, if desired), because the Apps Script project will be deleted permanently.
Make note of any services which are enabled in the Services section of the Apps Script project editor sidebar.
Delete the Apps Script project by going to the Apps Script project's Overview page, then click the trash can labeled Delete project forever.
In your Google Sheets doc, go to Extensions → Apps Script again and it will create a new Apps Script project (with attached GCP project).
Save the default Code.gs file
Re-create the projects' files. If you'd used clasp pull in the first step, then you can use clasp push to push the files from your local machine back to the project. In this case, go to the Apps Script project's Project Settings page and copy the Script ID. Then update the scriptId in the local .clasp.json file, save it, then clasp push.
If there were Services enabled in the previous project, enable them again in the Services section of the editor sidebar.
Run one of your functions and it should allow you to authorize the project again instead of giving you the 401 error.

Error message "You must configure the G Suite Marketplace SDK to publish an add-on." when SDK is correctly configured

I have published tens of add-ons but now suddenly when doing everything the same way I get the error message "You must configure the G Suite Marketplace SDK to publish an add-on." when I try to publish an add-on using the "Deploy as Docs add-on" menu item. I have configured the "G Suite Marketplace SDK". BTW, the error dialog presenting the error message is linking to the console project correctly but the link replaces the current browser document, it would be better if it would open a new tab.
The message in the dialog is not an error message. They have changed the way you start the publish process. The dialog would make more sense to me if it would say:
We have changed the publish process:
Go to your console project
Enable the G Suite Marketplace SDK library
Configure the Marketplace SDK with the Config tab
Publish the add-on using the Publish tab
If you want to make a feature request to Google about the Apps Script code editor, then you'll need to use the Google Issue Tracker
Make Feature Request
Answer:
Google is currently migrating add-ons from the Chrome Web Store to the G Suite Marketplace, so now need to be published there rather than the legacy marketplace.
Further Information:
In order to publish an Apps Script project as an addon, as specified in your message, the G Suite Marketplace SDK must be configured. You can find an article detailing the migration process here.
You will need to enable the G Suite Marketplace SDK in your Google Cloud Platform (GCP) project. You can follow the information on the Getting Started page for Google Cloud.
References:
All add-ons now in the G Suite Marketplace
Publish to the G Suite Marketplace
Getting Started with Google Cloud

How to trigger Openshift deployment when a repository changes?

I'm trying to configure continuous deployment with Openshift. I have sample React.js application which I want to deploy automatically when the new commit appears in the repository.
I created "application" and "build" and in Openshift, the build is deploying the web app to a new pod well (I used standard Node.js builder template). But it doesn't do it automatically when the code is updated in repo. How can I make Openshift build to observe the repository?
Short answer is: webhooks.
Openshift exposes so called webhooks. Source code repository (for example Bitbucket) can notify Openshift's build (using a web interface) when event like a push to the repository happens.
In build settings we have triggers section. We can configure new trigger with a specific secret. The triggers are visible in the configuration section of the build in read only mode then. They are the https addresses basically.
After creation of the trigger we can configure the repository to notify Openshift using webhook.

Missing Cloud Platform Project ID due to "Apps-script managed project"

I have an Apps Script project that I am developing and pushing updates to via Clasp, and I want to setup clasp stackdriver logging in the terminal. In order to do that, I need the Project ID of the script, which I can not find.
When inside the script editor I navigate to Resource -> Cloud Platform project.. I am just greeted with the following message where the ID should be: "This script has an Apps Script–managed Cloud Platform project."
In order to use stackdriver like you want to, you need to switch to a cloud project that you created at console.cloud.google.com. Once you have a project, use the same dialog at Resource -> Cloud Platform project.. to switch to it.