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

feat(push-to-gcs): allow setting 'predefinedAcl' on objects when uploading #193

Merged
merged 7 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
25 changes: 17 additions & 8 deletions actions/push-to-gcs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ jobs:
path: file.txt
environment: "dev" # Can be dev/prod (defaults to dev)

# Upload a single file and apply a predefined ACL. See `predefinedAcl` for options.
- uses: grafana/shared-workflows/actions/push-to-gcs@main
with:
bucket: ${{ steps.login-to-gcs.outputs.bucket }}
path: file.txt
predefinedAcl: projectPrivate
environment: "dev
twu marked this conversation as resolved.
Show resolved Hide resolved

# Here are 3 equivalent statements to upload a single file and its parent directory to the bucket root
- uses: grafana/shared-workflows/actions/push-to-gcs@main
with:
Expand Down Expand Up @@ -98,14 +106,15 @@ jobs:

## Inputs

| Name | Type | Description |
| ------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `bucket` | String | (Required) Name of bucket to upload to. Can be gathered from `login-to-gcs` action. |
| `path` | String | (Required) The path to a file or folder inside the action's filesystem that should be uploaded to the bucket. You can specify either the absolute path or the relative path from the action. |
| `bucket_path` | String | Bucket path where objects will be uploaded. Default is the bucket root. |
| `environment` | String | Environment for pushing artifacts (can be either dev or prod). |
| `glob` | String | Glob pattern. |
| `parent` | String | Whether parent dir should be included in GCS destination. Dirs included in the `glob` statement are unaffected by this setting. |
| Name | Type | Description |
| --------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `bucket` | String | (Required) Name of bucket to upload to. Can be gathered from `login-to-gcs` action. |
| `path` | String | (Required) The path to a file or folder inside the action's filesystem that should be uploaded to the bucket. You can specify either the absolute path or the relative path from the action. |
| `bucket_path` | String | Bucket path where objects will be uploaded. Default is the bucket root. |
| `environment` | String | Environment for pushing artifacts (can be either dev or prod). |
| `glob` | String | Glob pattern. |
| `parent` | String | Whether parent dir should be included in GCS destination. Dirs included in the `glob` statement are unaffected by this setting. |
| `predefinedAcl` | String | Predefined ACL applied to the uploaded objects. Default is `projectPrivate`. See [Google Documentation](https://googleapis.dev/nodejs/storage/latest/global.html#UploadOptions) for a list of available options. |
twu marked this conversation as resolved.
Show resolved Hide resolved

## Outputs

Expand Down
6 changes: 6 additions & 0 deletions actions/push-to-gcs/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ inputs:
Whether parent dir should be included in GCS destination.
Dirs included in the `glob` statement are unaffected by this setting.
default: "true"
predefinedAcl:
description: |
Apply a predefined set of access controls to the file(s).
Default is projectPrivate (See https://googleapis.dev/nodejs/storage/latest/global.html#UploadOptions)
default: projectPrivate

outputs:
uploaded:
Expand Down Expand Up @@ -82,4 +87,5 @@ runs:
glob: ${{ inputs.glob }}
destination: ${{ steps.construct-path.outputs.destination }} # bucket name plus folder prefix (if applicable)
parent: ${{ inputs.parent }}
predefinedAcl: ${{ inputs.predefinedAcl }}
process_gcloudignore: false