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: add config package & optimize dir package #90

Merged
merged 3 commits into from
Aug 2, 2022

Conversation

JeyJeyGao
Copy link
Contributor

@JeyJeyGao JeyJeyGao commented Jul 22, 2022

config package
Config package includes the necessary configuration information for notation-go library. Previously, it is in notation project. It is time to migrate the config package to notation-go.

  1. migrate config package from notation to notation-go
  2. split out the signingkeys information from config.json to be a signingkeys.json file (according to directory spec)
  3. migrate config/util.go from notation to notation-go
  4. add reusable Load() & Save() function to manage different configuration file

dir package

  1. optimize dir/path.go API
  2. make the file/directory name as a constant in dir/path.go

@JeyJeyGao JeyJeyGao force-pushed the feature/directory_structure branch 3 times, most recently from c1110c4 to 921fa2a Compare July 22, 2022 08:16
JeyJeyGao added a commit to JeyJeyGao/notation-go that referenced this pull request Jul 22, 2022
config package

migrate config package from notation to notation-go
split out the signingkeys information from config.json to be a signingkeys.json file
migrate config/util.go from notation to notation-go
add reusable Load() & Save() function to manage different configuration file

dir package

optimize dir/path.go API
make the file/directory name as a constent in dir/path.go

Signed-off-by: Junjie Gao <43160897+JeyJeyGao@users.noreply.github.com>
@JeyJeyGao JeyJeyGao force-pushed the feature/directory_structure branch from 921fa2a to 7cfcf89 Compare July 22, 2022 08:31
config/config.go Outdated Show resolved Hide resolved
config/keys.go Outdated Show resolved Hide resolved
config/keys.go Outdated Show resolved Hide resolved
dir/path.go Outdated Show resolved Hide resolved
config/base.go Show resolved Hide resolved
config/base.go Outdated Show resolved Hide resolved
@northtyphoon
Copy link

northtyphoon commented Jul 22, 2022

typo in pr description: constent => constant

@JeyJeyGao JeyJeyGao force-pushed the feature/directory_structure branch 2 times, most recently from ca98605 to 21f63ea Compare July 25, 2022 05:37
config/base.go Outdated Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved
config/base.go Outdated Show resolved Hide resolved
config/base.go Outdated Show resolved Hide resolved
config/base.go Outdated Show resolved Hide resolved
@JeyJeyGao JeyJeyGao force-pushed the feature/directory_structure branch 7 times, most recently from eb92e12 to 48fd391 Compare July 26, 2022 07:43
@patrickzheng200
Copy link
Contributor

LGTM

dir/path.go Outdated Show resolved Hide resolved
@binbin-li
Copy link
Contributor

lgtm

@JeyJeyGao JeyJeyGao force-pushed the feature/directory_structure branch 2 times, most recently from cfedfc5 to 822a12b Compare July 27, 2022 03:43
config package

migrate config package from notation to notation-go
split out the signingkeys information from config.json to be a signingkeys.json file
migrate config/util.go from notation to notation-go
add reusable Load() & Save() function to manage different configuration file

dir package

optimize dir/path.go API
make the file/directory name as a constent in dir/path.go

Signed-off-by: Junjie Gao <43160897+JeyJeyGao@users.noreply.github.com>
@JeyJeyGao JeyJeyGao force-pushed the feature/directory_structure branch from 822a12b to 5d99707 Compare July 28, 2022 08:35
@codecov-commenter
Copy link

codecov-commenter commented Jul 28, 2022

Codecov Report

Merging #90 (08d6a49) into main (aaca74d) will increase coverage by 1.89%.
The diff coverage is 86.27%.

@@            Coverage Diff             @@
##             main      #90      +/-   ##
==========================================
+ Coverage   66.21%   68.10%   +1.89%     
==========================================
  Files          32       35       +3     
  Lines        1835     1919      +84     
==========================================
+ Hits         1215     1307      +92     
+ Misses        501      490      -11     
- Partials      119      122       +3     
Impacted Files Coverage Δ
config/base.go 73.91% <73.91%> (ø)
config/keys.go 80.00% <80.00%> (ø)
config/config.go 82.35% <82.35%> (ø)
dir/path.go 95.83% <95.00%> (+54.16%) ⬆️
dir/base.go 90.90% <100.00%> (+0.52%) ⬆️
dir/fs.go 84.84% <100.00%> (+12.97%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@JeyJeyGao JeyJeyGao force-pushed the feature/directory_structure branch 2 times, most recently from ebe0adf to d8e4a67 Compare July 28, 2022 08:49
@dtzar dtzar modified the milestones: future, alpha-3 Jul 28, 2022
config/base.go Outdated Show resolved Hide resolved
config/base.go Outdated Show resolved Hide resolved
dir/path.go Show resolved Hide resolved
dir/path.go Outdated Show resolved Hide resolved
@JeyJeyGao JeyJeyGao force-pushed the feature/directory_structure branch from d8e4a67 to 61104be Compare July 29, 2022 03:29
Signed-off-by: Junjie Gao <43160897+JeyJeyGao@users.noreply.github.com>
@JeyJeyGao JeyJeyGao force-pushed the feature/directory_structure branch 2 times, most recently from c6389c1 to 730bd31 Compare July 29, 2022 07:17
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

config/base.go Outdated Show resolved Hide resolved
config/config.go Show resolved Hide resolved
plugin/plugin.go Outdated Show resolved Hide resolved
@yizha1 yizha1 requested a review from rgnote August 2, 2022 00:28
@JeyJeyGao JeyJeyGao force-pushed the feature/directory_structure branch 2 times, most recently from 0e805cb to 9711344 Compare August 2, 2022 00:57
@binbin-li
Copy link
Contributor

lgtm

Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shizhMSFT shizhMSFT merged commit ba141e1 into notaryproject:main Aug 2, 2022
"github.com/opencontainers/go-digest"
)

const (
// CertificateExtension defines the extension of the certificate files
CertificateExtension = ".crt"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

certificates can be in .pem, .cer, .der as well. If this is meant to be used for local certificates which are created using Notation, then we should rename this to LocalCertificateExtension

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LocalCertificateExtension is better. I will rename it.

ConfigFile = "config.json"

// KeyExtension defines the extension of the key files
KeyExtension = ".key"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LocalKeyExtension

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

dir/path.go Show resolved Hide resolved
func checkError(err error) {
// if path does not exist, the path can be used to create file
if err != nil && !errors.Is(err, fs.ErrNotExist) {
panic(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to panic here? Returning errors seems to be a better option for Go libraries per https://stackoverflow.com/a/35413011

priteshbandi pushed a commit to priteshbandi/notation-go that referenced this pull request Aug 9, 2022
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Pritesh Bandi <pritesb@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

8 participants