-
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.
Merge branch 'main' of github.com:opentdf/otdfctl into 341-bug-when-c…
…ommands-expected-to-output-json-should-not-print-using-profile-profile-name
- Loading branch information
Showing
12 changed files
with
353 additions
and
47 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 |
---|---|---|
|
@@ -51,6 +51,8 @@ jobs: | |
end-to-end: | ||
name: e2e tests | ||
runs-on: ubuntu-22.04 | ||
env: | ||
BATS_LIB_PATH: /usr/lib | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
- name: Check out platform | ||
|
@@ -98,10 +100,13 @@ jobs: | |
|
||
- name: build the CLI | ||
run: go build . | ||
- name: build the CLI in test mode | ||
run: make build-test | ||
- name: set up the config | ||
run: cp otdfctl-example.yaml otdfctl.yaml | ||
- name: Setup Bats and bats libs | ||
uses: bats-core/[email protected] | ||
- run: tests/encrypt-decrypt.bats | ||
- run: tests/kas-grants.bats | ||
- run: tests/profile.bats | ||
- run: tests/kas-registry.bats |
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 |
---|---|---|
|
@@ -17,6 +17,9 @@ jobs: | |
- uses: actions/checkout@v3 | ||
- uses: matheus23/[email protected] | ||
with: | ||
files-to-check: '**/*.md' | ||
files-to-exclude: 'CHANGELOG.md' | ||
files-to-check: | | ||
**/*.md | ||
files-to-exclude: | | ||
CHANGELOG.md | ||
adr/**/*.md | ||
words-to-ignore-file: './.github/spellcheck.ignore' |
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
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,44 @@ | ||
--- | ||
status: accepted | ||
date: 2024-08-29 | ||
decision: Use ADRs in the `adr` directory of the repo to document architectural decisions | ||
author: '@jakedoublev' | ||
deciders: ['@ryanulit', '@jrschumacher'] | ||
--- | ||
|
||
# Use a ADR storage format that make diffs easier to read | ||
|
||
## Context and Problem Statement | ||
|
||
We've been using Github Issues to document ADR decisions, but it's hard to read the diffs when changes are made. We need a better way to store and manage ADRs. ADRs sometimes get updated and it's hard to track the changes and decision using the edit history dropdown or the comments section. | ||
|
||
## Decision Drivers | ||
|
||
- **Low barrier of entry**: A primary goal of our ADR process is to ensure decisions are captured. | ||
- **Ease of management**: Make it easy to manage the ADRs. | ||
- **Ensure appropriate tracking and review**: Make it easy to track and review the changes in the ADRs. | ||
|
||
## Considered Options | ||
|
||
1. Use Github Issues | ||
2. Use Github Discussions | ||
3. Use a shared ADR repository | ||
4. Use an `adr` directory in the repo | ||
|
||
## Decision Outcome | ||
|
||
It was decided to use an `adr` directory in the repo to store ADRs. This approach provides a low barrier of entry for developers to document decisions and ensures that the decisions are tracked and reviewed appropriately. | ||
|
||
Additionally, this change does not impact other teams or repositories, and it is easy to manage and maintain. We can experiment with this decision and if it works promote it to other repositories. | ||
|
||
### Consequences | ||
|
||
- **Positive**: | ||
- Low barrier of entry for developers to document decisions. | ||
- Easy to manage and maintain. | ||
- Ensures appropriate tracking and review of decisions via git history and code review. | ||
- **Negative**: | ||
- Requires developers to be aware of the ADR process and where to find the ADRs. | ||
- May require additional tooling to manage and maintain the ADRs. | ||
- May require additional training for developers to understand the ADR process and how to use it effectively. | ||
|
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
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
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,74 @@ | ||
package profiles | ||
|
||
import ( | ||
"bytes" | ||
"encoding/json" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/opentdf/otdfctl/pkg/config" | ||
"github.com/zalando/go-keyring" | ||
) | ||
|
||
const testModeMsg = ` | ||
******************** | ||
RUNNING IN TEST MODE | ||
test config: %s | ||
******************** | ||
` | ||
|
||
var ( | ||
testProfile *Profile | ||
testCfg = os.Getenv("OTDFCTL_TEST_PROFILE") | ||
) | ||
|
||
type testConfig struct { | ||
// global config is used to get the store in a bad state | ||
GlobalConfig config.Config `json:"globalConfig,omitempty"` | ||
|
||
// set the default profile | ||
DefaultProfile string `json:"defaultProfile,omitempty"` | ||
|
||
// profiles to add | ||
Profiles []ProfileConfig `json:"profiles,omitempty"` | ||
} | ||
|
||
func init() { | ||
// If running in test mode, use the mock keyring | ||
if config.TestMode == "true" { | ||
fmt.Printf(testModeMsg, testCfg) | ||
|
||
keyring.MockInit() | ||
|
||
// configure the keyring based on the test config | ||
// unmarsal the test config | ||
if testCfg != "" { | ||
var err error | ||
var cfg testConfig | ||
if err := json.NewDecoder(bytes.NewReader([]byte(testCfg))).Decode(&cfg); err != nil { | ||
panic(err) | ||
} | ||
|
||
testProfile, err = New() | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
for _, p := range cfg.Profiles { | ||
err := testProfile.AddProfile(p.Name, p.Endpoint, p.TlsNoVerify, cfg.DefaultProfile == p.Name) | ||
if err != nil { | ||
panic(err) | ||
} | ||
} | ||
|
||
// set default | ||
if cfg.DefaultProfile != "" { | ||
if err := testProfile.SetDefaultProfile(cfg.DefaultProfile); err != nil { | ||
panic(err) | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.