-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
133 changed files
with
5,248 additions
and
2,734 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# dependabot.yml | ||
# | ||
# Documentation: | ||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: / | ||
schedule: | ||
interval: monthly | ||
commit-message: | ||
prefix: 'chore(dependabot)' | ||
- package-ecosystem: gomod | ||
directory: / | ||
schedule: | ||
interval: daily | ||
commit-message: | ||
prefix: 'chore(dependabot)' | ||
ignore: | ||
# The platform and SDK are not yet following semver, so we do not want a bump for every | ||
# new commit. We will handle these updates manually while breaking change likelihood is high. | ||
- dependency-name: github.com/opentdf/platform/protocol/go | ||
- dependency-name: github.com/opentdf/platform/sdk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,26 +16,15 @@ jobs: | |
go-version-file: 'go.mod' | ||
cache: false | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc | ||
uses: golangci/golangci-lint-action@9d1e0624a798bb64f6c3cea93db47765312263dc | ||
with: | ||
version: v1.55 | ||
# Optional: golangci-lint command line arguments. | ||
args: --timeout=10m | ||
args: --timeout=10m | ||
unit: | ||
name: unit tests | ||
runs-on: ubuntu-22.04 | ||
env: | ||
GOPRIVATE: github.com/opentdf/platform/* | ||
steps: | ||
- name: Generate a token | ||
id: generate_token | ||
uses: actions/[email protected] | ||
with: | ||
app-id: '416599' | ||
private-key: '${{ secrets.GH_APP_PRIVATE_KEY }}' | ||
owner: ${{ github.repository_owner }} | ||
repositories: 'platform' | ||
- run: git config --global url.https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com/.insteadOf https://github.com/ | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 | ||
with: | ||
|
@@ -46,18 +35,7 @@ jobs: | |
end-to-end: | ||
name: e2e tests | ||
runs-on: ubuntu-22.04 | ||
env: | ||
GOPRIVATE: github.com/opentdf/platform/* | ||
steps: | ||
- name: Generate a token | ||
id: generate_token | ||
uses: actions/[email protected] | ||
with: | ||
app-id: '416599' | ||
private-key: '${{ secrets.GH_APP_PRIVATE_KEY }}' | ||
owner: ${{ github.repository_owner }} | ||
repositories: 'platform' | ||
- run: git config --global url.https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com/.insteadOf https://github.com/ | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Dependabot auto approve and merge | ||
on: pull_request | ||
|
||
# Docs: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#common-dependabot-automations | ||
|
||
permissions: | ||
pull-requests: write | ||
contents: write | ||
|
||
jobs: | ||
dependabot: | ||
runs-on: ubuntu-latest | ||
if: github.actor == 'dependabot[bot]' | ||
steps: | ||
- name: Dependabot metadata | ||
id: metadata | ||
uses: dependabot/fetch-metadata@v2 | ||
with: | ||
github-token: '${{ secrets.GITHUB_TOKEN }}' | ||
- name: Enable auto-merge | ||
run: | | ||
echo "enabling auto merge for dependency bump PR '$PR_URL'" | ||
gh pr merge --auto --squash "$PR_URL" | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
- name: Approve the PR | ||
id: approval-minor-patch | ||
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor' }} | ||
run: | | ||
echo "approving minor or patch bump in PR '$PR_URL'" | ||
gh pr review --approve "$PR_URL" | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
- name: Report on skip of PR approval | ||
if: ${{ steps.approval-minor-patch.conclusion == 'skipped' }} | ||
run: echo "Not approving PR '$PR_URL' because dependency bump is not minor or patch (major, unknown non-SEMVER bump, etc)" | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,8 +23,9 @@ jobs: | |
runs-on: ubuntu-22.04 | ||
env: | ||
GOPRIVATE: github.com/opentdf/platform/* | ||
BIN_NAME: tructl | ||
BIN_NAME: otdfctl | ||
steps: | ||
<<<<<<< HEAD | ||
- name: Is actor in ${{ env.MAINTAINER_TEAM }} | ||
uses: actions/github-script@v7 | ||
with: | ||
|
@@ -53,47 +54,36 @@ jobs: | |
console.log(`Error checking membership: ${error}`); | ||
core.setFailed(`Error checking membership: ${error}`); | ||
} | ||
# - uses: actions/checkout@v3 | ||
# - uses: actions/checkout@v4 | ||
# - uses: actions/setup-go@v5 | ||
# with: | ||
# go-version-file: './go.mod' | ||
# cache: false | ||
# - name: Get next version | ||
# uses: reecetech/version-increment@2023.9.3 | ||
# uses: reecetech/version-increment@2024.4.4 | ||
# id: version | ||
# with: | ||
# release_branch: main | ||
# scheme: semver | ||
# increment: ${{ github.event.inputs.versionBumpType }} | ||
# pep440: false | ||
# - name: print-version | ||
# run: echo Incrementing Version ${{ steps.version.outputs.current-version }} -> ${{ steps.version.outputs.version }} | ||
# # TODO: remove this step when `opentdf/platform` is public | ||
# # special app the virtru eng team created, to grab a token for accessing other org repos, in a secure way | ||
# - name: Generate a token | ||
# id: generate_token | ||
# uses: actions/[email protected] | ||
# with: | ||
# app-id: '416599' | ||
# private-key: '${{ secrets.GH_APP_PRIVATE_KEY }}' | ||
# owner: ${{ github.repository_owner }} | ||
# repositories: 'platform' | ||
# - run: git config --global url.https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com/.insteadOf https://github.com/ | ||
# run: echo Incrementing Version ${{ steps.version.outputs.current-v-version }} -> ${{ steps.version.outputs.v-version }} | ||
# - name: make-targets | ||
# env: | ||
# SEM_VER: ${{ steps.version.outputs.version }} | ||
# SEM_VER: ${{ steps.version.outputs.v-version }} | ||
# run: make build | ||
# - name: smoke-test | ||
# run: go test ./... -short -race -cover | ||
# - name: Compress the builds and generate checksums | ||
# env: | ||
# SEM_VER: ${{ steps.version.outputs.version }} | ||
# SEM_VER: ${{ steps.version.outputs.v-version }} | ||
# run: make zip-builds | ||
# - name: Release | ||
# uses: softprops/action-gh-release@v1 | ||
# uses: softprops/action-gh-release@v2 | ||
# with: | ||
# files: './output/**/*' | ||
# body: 'This is a test release, and will be removed' | ||
# tag_name: ${{ steps.version.outputs.version }} | ||
# repository: opentdf/tructl | ||
# tag_name: ${{ steps.version.outputs.v-version }} | ||
# repository: opentdf/otdfctl | ||
# generate_release_notes: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,19 +9,7 @@ jobs: | |
govulncheck_job: | ||
runs-on: ubuntu-latest | ||
name: Run govulncheck | ||
env: | ||
GOPRIVATE: github.com/opentdf/platform/* | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: Generate a token | ||
id: generate_token | ||
uses: actions/[email protected] | ||
with: | ||
app-id: '416599' | ||
private-key: '${{ secrets.GH_APP_PRIVATE_KEY }}' | ||
owner: ${{ github.repository_owner }} | ||
repositories: 'platform' | ||
- run: git config --global url.https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com/.insteadOf https://github.com/ | ||
- id: govulncheck | ||
uses: golang/govulncheck-action@v1 | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# CODEOWNERS | ||
|
||
* @opentdf/developers | ||
* @opentdf/opentdf-cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package cmd | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
|
||
"github.com/opentdf/otdfctl/pkg/cli" | ||
"github.com/opentdf/otdfctl/pkg/handlers" | ||
"github.com/opentdf/otdfctl/pkg/man" | ||
"github.com/spf13/cobra" | ||
"github.com/zalando/go-keyring" | ||
) | ||
|
||
var clearCachedCredsCmd = man.Docs.GetCommand("auth/clear-cached-credentials", | ||
man.WithRun(auth_clearCreds), | ||
man.WithHiddenFlags("with-client-creds", "with-client-creds-file"), | ||
) | ||
|
||
func auth_clearCreds(cmd *cobra.Command, args []string) { | ||
cachedClientID, err := handlers.GetClientIDFromCache() | ||
if err != nil { | ||
if errors.Is(err, keyring.ErrNotFound) { | ||
fmt.Println("No client-id found in the cache to clear.") | ||
} else { | ||
cli.ExitWithError("Failed to retrieve client id from keyring", err) | ||
} | ||
} | ||
|
||
// clear the client ID and secret from the keyring | ||
err = keyring.Delete(handlers.TOKEN_URL, cachedClientID) | ||
if err != nil { | ||
if errors.Is(err, keyring.ErrNotFound) { | ||
fmt.Println("No client secret found in the cache to clear under client-id: ", cachedClientID) | ||
} else { | ||
cli.ExitWithError("Failed to clear client secret from keyring", err) | ||
} | ||
} | ||
|
||
err = keyring.Delete(handlers.TOKEN_URL, handlers.OTDFCTL_CLIENT_ID_CACHE_KEY) | ||
if err != nil { | ||
if errors.Is(err, keyring.ErrNotFound) { | ||
fmt.Println("No client id found in the cache to clear.") | ||
} else { | ||
cli.ExitWithError("Failed to clear client id from keyring", err) | ||
} | ||
} | ||
|
||
err = keyring.Delete(handlers.TOKEN_URL, handlers.OTDFCTL_OIDC_TOKEN_KEY) | ||
if err != nil { | ||
if errors.Is(err, keyring.ErrNotFound) { | ||
fmt.Println("No token found in the cache to clear.") | ||
} else { | ||
cli.ExitWithError("Failed to clear token from keyring", err) | ||
} | ||
} | ||
|
||
fmt.Println(cli.SuccessMessage("Cached client credentials and token are clear.")) | ||
} |
Oops, something went wrong.