Skip to content

Conversation

@inlined
Copy link
Member

@inlined inlined commented Jun 8, 2021

This change adds support for firebase --open-sesame golang.

After running this command, firebase init will support Go 1.13
as a langauge for Cloud Functions.

Limitations:

  1. .gitignore is empty
  2. Customers cannot mix Node and Go code (WAI)
  3. There is little validation being done of customer code
  4. The actual deployed function params are hard coded; SDK incoming

@inlined inlined requested a review from hiranya911 June 8, 2021 01:59
@google-cla google-cla bot added the cla: yes Manual indication that this has passed CLA. label Jun 8, 2021
* Unbreak build

* linter changed its mind
@inlined
Copy link
Member Author

inlined commented Jun 8, 2021

❯ firebase init

     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  /Users/inlined/git/go-junkdrawer

? Which Firebase features do you want to set up for this directory? Press Space to select features, then Enter to confirm your choi
ces. Functions: Configure a Cloud Functions directory and its files

=== Project Setup

First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.

i  .firebaserc already has a default project, using inlined-junkdrawer.

=== Functions Setup

A functions directory will be created in your project with sample code
pre-configured. Functions can be deployed with firebase deploy.

? What language would you like to use to write Cloud Functions? Go
? What would you like to name your module? acme.com/functions
go get: added firebase.google.com/go/v4 v4.6.0
✔  Wrote functions/go.mod
✔  Wrote functions/functions.go
✔  Wrote functions/.gitignore

i  Writing configuration info to firebase.json...
i  Writing project information to .firebaserc...

✔  Firebase initialization complete!

❯ firebase deploy

=== Deploying to 'inlined-junkdrawer'...

i  deploying functions
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
✔  functions: required API cloudfunctions.googleapis.com is enabled
✔  functions: required API cloudbuild.googleapis.com is enabled
i  functions: preparing functions directory for uploading...
i  functions: packaged functions (15.93 KB) for uploading
✔  functions: functions folder uploaded successfully
i  functions: creating Go 1.13 function HelloWorld(us-central1)...
✔  functions[HelloWorld(us-central1)]: Successful create operation.
Function URL (HelloWorld(us-central1)): https://us-central1-inlined-junkdrawer.cloudfunctions.net/HelloWorld

✔  Deploy complete!

Project Console: https://console.firebase.google.com/project/inlined-junkdrawer/overview

davidbrenner and others added 5 commits June 8, 2021 07:16
#3457)

The firestore:delete command should notify the user of the current project. This should help users minimize chances of accidental deletions when switching between projects.
When the optional feature parameter is provided in a `firebase init
[feature]` command, this checks that its value is a valid choice before
attempting any other initialization.
@inlined inlined force-pushed the inlined.create-functions branch from 6ef9888 to 2e9e0cf Compare June 8, 2021 17:22
dependabot bot and others added 19 commits June 9, 2021 08:20
Bumps [trim-newlines](https://github.com/sindresorhus/trim-newlines) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/sindresorhus/trim-newlines/releases)
- [Commits](https://github.com/sindresorhus/trim-newlines/commits)

---
updated-dependencies:
- dependency-name: trim-newlines
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [normalize-url](https://github.com/sindresorhus/normalize-url) from 4.5.0 to 4.5.1.
- [Release notes](https://github.com/sindresorhus/normalize-url/releases)
- [Commits](https://github.com/sindresorhus/normalize-url/commits)

---
updated-dependencies:
- dependency-name: normalize-url
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
samtstern and others added 9 commits June 21, 2021 05:39
added note to run `npm install` before `npm link` the first time
This change adds support for `firebase --open-sesame golang`.

After running this command, `firebase init` will support Go 1.13
as a langauge for Cloud Functions.

Limitations:

1. .gitignore is empty
2. Customers cannot mix Node and Go code (WAI)
3. There is little validation being done of customer code
4. The actual deployed function params are hard coded; SDK incoming
@inlined inlined force-pushed the inlined.create-functions branch from 9aa0e60 to 6ea031c Compare June 21, 2021 17:55
inlined added 3 commits June 21, 2021 11:59
* Delete Container Registry images left after Functions deployment

* Simplify caching

* Improve error handling and report next steps to users

* lint fixes

* Fix typo
Previously most code read the desired backend from
`options.config.get("functions.backend")` which was set to the
empty backend correctly. Code that depended on payload.functions.backend
crashed because payload.functions was null when the backend was
empty.

Since optins.config should be firebase.json data, this change
normalizes on payload.functions.backend and ensures that it
is never null while options.config.get('functions') is present
(i.e. when the customer has functions to deploy).
@inlined inlined force-pushed the inlined.create-functions branch from 1b90501 to 6ea031c Compare June 21, 2021 20:08
@inlined inlined merged commit a7b50e3 into launch.runtimes Jul 3, 2021
@bkendall bkendall deleted the inlined.create-functions branch March 18, 2022 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Manual indication that this has passed CLA.

Projects

None yet

Development

Successfully merging this pull request may close these issues.