Skip to content
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

Integration with CI pipeline and Jenkins #524

Closed
darul75 opened this issue Feb 7, 2019 · 9 comments
Closed

Integration with CI pipeline and Jenkins #524

darul75 opened this issue Feb 7, 2019 · 9 comments

Comments

@darul75
Copy link

darul75 commented Feb 7, 2019

Please search existing issues before creating a new one.

DON'T DELETE THIS! FILL THESE SECTIONS OUT!

Expected Behavior

Being able to push using clasp on each Jenkins build.

Actual Behavior

There is no easy way to publish from a Jenkins CI infra, even by using clasp login --creds
Our build system generates new versions and we would need to get an association between this version and the clasp versions.

Steps to Reproduce the Problem

  1. Our project builder process prepare the project files.
  2. Locally we use clasp push command to update content of our app script project
  3. In jenkins there is no easy way to run the push command
  4. Storing the .clasprc.json at the project folder level is not enough or is considered as a bad practice as it would need to be committed into git.
  5. Do you see other options?

Specifications

  • Node version (node -v): v10.14.1
  • Version (clasp -v): 2.0.1
  • OS (Mac/Linux/Windows): Linux
@erickoledadevrel
Copy link
Contributor

What changes to clasp would allow this to work for you? Perhaps be more specific about how clasp fails today and what a better option would look like?

@alx-andru
Copy link

We're saving the .clasprc.json file with the credentials of a generic user that ownes the script files in a secure storage of our build system. The actual build downloads the file into the root directory.
During the release we simply call clasp push && clasp deploy

@darul75
Copy link
Author

darul75 commented Feb 19, 2019

Hello,

Thank you both for giving some thought, @alx-andru's solution looks good, but there is something I don't really like.

Why do we need to put the clasp credentials file into the user home directory, is there no other way?

We could have different projects using clasp and the same jenkins environment and that could cause problems.

Why can we not just put it in the project folder by copying it as you describe at build time.

@grant
Copy link
Contributor

grant commented Mar 28, 2019

@darul75 The original issue seems solved by logging in with a generic Google account.

The request described of using non-$HOME directory credentials for push is a feature request. We currently only use custom credentials (getLocalScript) for clasp run, although we could consider using custom credentials if that's in demand.

If you have multiple G Suite accounts/credentials in the same Jenkins environments, then I could see why you'd want custom credentials. But it seems like an edge-case.

@darul75
Copy link
Author

darul75 commented Apr 2, 2019

Storing files of credentials in home directories on all the build agents is the less desirable backup plan.

An alternative would be great so we don't need to store anything at the $HOME level.

@grant
Copy link
Contributor

grant commented Apr 2, 2019

Let us know what your solution is then besides $HOME.

Putting credentials in a local directory is bad since you'll likely put them in source control, which would be very bad.

@ptrkstr
Copy link

ptrkstr commented Jul 1, 2020

Is there any update on this? This would be very useful.

@flavianh
Copy link

In case you missed it, a good samarithan created this repo to show how to set up a continuous deployment with clasp: https://github.com/ericanastas/deploy-google-app-script-action#gcp-service-accounts

@sqrrrl
Copy link
Member

sqrrrl commented Jan 8, 2025

Consolidating in #962

@sqrrrl sqrrrl closed this as completed Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants