Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .github/resources/integ-service-account.json.gpg
Binary file not shown.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ jobs:
strategy:
fail-fast: false
matrix:
go: ['1.23', '1.24']
go: ['1.24', '1.25']

steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v5
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: ${{ matrix.go }}

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ jobs:

steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: ${{ github.event.client_payload.ref || github.ref }}

- name: Set up Go
uses: actions/setup-go@v5
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: '1.23'
go-version: '1.24'

- name: Install golint
run: go install golang.org/x/lint/golint@latest
Expand All @@ -53,7 +53,7 @@ jobs:

- name: Send email on failure
if: failure()
uses: firebase/firebase-admin-node/.github/actions/send-email@master
uses: firebase/firebase-admin-node/.github/actions/send-email@2e2b36a84ba28679bcb7aecdacabfec0bded2d48 # Admin Node SDK v13.6.0
with:
api-key: ${{ secrets.OSS_BOT_MAILGUN_KEY }}
domain: ${{ secrets.OSS_BOT_MAILGUN_DOMAIN }}
Expand All @@ -68,7 +68,7 @@ jobs:

- name: Send email on cancelled
if: cancelled()
uses: firebase/firebase-admin-node/.github/actions/send-email@master
uses: firebase/firebase-admin-node/.github/actions/send-email@2e2b36a84ba28679bcb7aecdacabfec0bded2d48 # Admin Node SDK v13.6.0
with:
api-key: ${{ secrets.OSS_BOT_MAILGUN_KEY }}
domain: ${{ secrets.OSS_BOT_MAILGUN_DOMAIN }}
Expand Down
75 changes: 33 additions & 42 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,43 @@
name: Release Candidate

on:
# Only run the workflow when a PR is updated or when a developer explicitly requests
# a build by sending a 'firebase_build' event.
# Run the workflow when:
# 1. A PR is created or updated (staging checks).
# 2. A commit is pushed to dev (release publication).
# 3. A developer explicitly requests a build via 'firebase_build' event.
pull_request:
types: [opened, synchronize, closed]
types: [opened, synchronize]

push:
branches:
- dev
paths:
- 'firebase.go'

repository_dispatch:
types:
- firebase_build

jobs:
stage_release:
# To publish a release, merge the release PR with the label 'release:publish'.
# To publish a release, merge a PR with the title prefix '[chore] Release ' to dev
# and ensure the squashed commit message also has the prefix.
# To stage a release without publishing it, send a 'firebase_build' event or apply
# the 'release:stage' label to a PR.
if: github.event.action == 'firebase_build' ||
contains(github.event.pull_request.labels.*.name, 'release:stage') ||
(github.event.pull_request.merged &&
contains(github.event.pull_request.labels.*.name, 'release:publish'))
(github.event_name == 'push' && startsWith(github.event.head_commit.message, '[chore] Release '))

runs-on: ubuntu-latest

# When manually triggering the build, the requester can specify a target branch or a tag
# via the 'ref' client parameter.
steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ github.event.client_payload.ref || github.ref }}
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Set up Go
uses: actions/setup-go@v5
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: '1.23'
go-version: '1.24'

- name: Install golint
run: go install golang.org/x/lint/golint@latest
Expand All @@ -65,23 +69,22 @@ jobs:
publish_release:
needs: stage_release

# Check whether the release should be published. We publish only when the trigger PR is
# 1. merged
# Check whether the release should be published. We publish only when the trigger is
# 1. a push (merge)
# 2. to the dev branch
# 3. with the label 'release:publish', and
# 4. the title prefix '[chore] Release '.
if: github.event.pull_request.merged &&
# 3. and the commit message has the title prefix '[chore] Release '.
if: github.event_name == 'push' &&
github.ref == 'refs/heads/dev' &&
contains(github.event.pull_request.labels.*.name, 'release:publish') &&
startsWith(github.event.pull_request.title, '[chore] Release ')
startsWith(github.event.head_commit.message, '[chore] Release ')

runs-on: ubuntu-latest
environment: Release
permissions:
contents: write

steps:
- name: Checkout source for publish
uses: actions/checkout@v4
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false

Expand All @@ -91,11 +94,11 @@ jobs:

# We authorize this step with an access token that has write access to the master branch.
- name: Merge to master
uses: actions/github-script@v7
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
with:
github-token: ${{ secrets.FIREBASE_GITHUB_TOKEN }}
script: |
github.rest.repos.merge({
await github.rest.repos.merge({
owner: context.repo.owner,
repo: context.repo.repo,
base: 'master',
Expand All @@ -106,22 +109,10 @@ jobs:
- name: Create release tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create ${{ steps.preflight.outputs.version }}
--title "Firebase Admin Go SDK ${{ steps.preflight.outputs.version }}"
--notes '${{ steps.preflight.outputs.changelog }}'
--target "master"

# Post to Twitter if explicitly opted-in by adding the label 'release:tweet'.
- name: Post to Twitter
if: success() &&
contains(github.event.pull_request.labels.*.name, 'release:tweet')
uses: firebase/firebase-admin-node/.github/actions/send-tweet@master
with:
status: >
${{ steps.preflight.outputs.version }} of @Firebase Admin Go SDK is available.
https://github.com/firebase/firebase-admin-go/releases/tag/${{ steps.preflight.outputs.version }}
consumer-key: ${{ secrets.FIREBASE_TWITTER_CONSUMER_KEY }}
consumer-secret: ${{ secrets.FIREBASE_TWITTER_CONSUMER_SECRET }}
access-token: ${{ secrets.FIREBASE_TWITTER_ACCESS_TOKEN }}
access-token-secret: ${{ secrets.FIREBASE_TWITTER_ACCESS_TOKEN_SECRET }}
continue-on-error: true
RELEASE_VER: ${{ steps.preflight.outputs.version }}
RELEASE_BODY: ${{ steps.preflight.outputs.changelog }}
run: |
gh release create "$RELEASE_VER" \
--title "Firebase Admin Go SDK $RELEASE_VER" \
--notes "$RELEASE_BODY" \
--target "master"
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ The Firebase Admin Go SDK enables server-side (backend) applications to interact

- **DO:** Use the centralized HTTP client in `internal/http_client.go` for all network calls.
- **DO:** Pass `context.Context` as the first argument to all functions that perform I/O or other blocking operations.
- **DO:** Run `go fmt` after implementing a change and fix any linting errors.
- **DON'T:** Expose types or functions from the `internal/` directory in the public API.
- **DON'T:** Introduce new third-party dependencies without a strong, documented justification and team consensus.

Expand Down
8 changes: 6 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,12 @@ Set up your Firebase project as follows:

2. Enable Firestore:
1. Go to the Firebase Console, and select **Firestore Database** from the **Build** menu.
2. Click on the **Create database** button. You can choose to set up Firestore either in
the production mode or in the test mode.
2. Click on the **Create database** button and create a default database. You can choose
to set up Firestore either in the production mode or in the test mode.
> **Note:** Integration tests are run against both the default database and an additional
database named "testing-database".
3. After the default database is created, click the **Add database** button to create a
second database named "testing-database".


3. Enable Realtime Database:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ requests, code review feedback, and also pull requests.
## Supported Go Versions

The Admin Go SDK is compatible with the two most-recent major Go releases.
We currently support Go v1.23 and 1.24.
We currently support Go v1.24 and 1.25.
[Continuous integration](https://github.com/firebase/firebase-admin-go/actions) system
tests the code on Go v1.23 and v1.24.
tests the code on Go v1.24 and v1.25.

## Documentation

Expand Down
29 changes: 29 additions & 0 deletions auth/tenant_mgt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,35 @@ func TestTenantGetUser(t *testing.T) {
}
}

func TestTenantQueryUsers(t *testing.T) {
resp := `{
"usersInfo": [],
"recordsCount": "0"
}`
s := echoServer([]byte(resp), t)
defer s.Close()

tenantClient, err := s.Client.TenantManager.AuthForTenant("test-tenant")
if err != nil {
t.Fatalf("Failed to create tenant client: %v", err)
}

returnUserInfo := true
query := &QueryUsersRequest{
ReturnUserInfo: &returnUserInfo,
}

_, err = tenantClient.QueryUsers(context.Background(), query)
if err != nil {
t.Fatalf("QueryUsers() with tenant client = %v", err)
}

wantPath := "/projects/mock-project-id/tenants/test-tenant/accounts:query"
if s.Req[0].RequestURI != wantPath {
t.Errorf("QueryUsers() URL = %q; want = %q", s.Req[0].RequestURI, wantPath)
}
}

func TestTenantGetUserByEmail(t *testing.T) {
s := echoServer(testGetUserResponse, t)
defer s.Close()
Expand Down
Loading