-
Notifications
You must be signed in to change notification settings - Fork 6
feat: add changeset tx type #189
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
980d8ac
feat: add changeset ty type
anirudhwarrier 860ef4d
feat: add changeset for linkowner
anirudhwarrier f874cfa
gomod fix
anirudhwarrier 66884b8
feat: add changeset for workflows ops
anirudhwarrier fc0af95
refactor
anirudhwarrier b1c0dc4
skip mcms if config not found
anirudhwarrier 7e780dd
update deps
anirudhwarrier b05c2a8
add changeset for secrets commands
anirudhwarrier ee5a065
refactor
anirudhwarrier a854bc8
Merge branch 'main' into DEVSVCS-3154/add-changeset-txtype
anirudhwarrier 0c33e03
Merge branch 'main' into DEVSVCS-3154/add-changeset-txtype
anirudhwarrier 809fcf9
Merge branch 'main' into DEVSVCS-3154/add-changeset-txtype
anirudhwarrier 2472591
fix merged code in secrets delete
anirudhwarrier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,11 +17,14 @@ import ( | |
| "github.com/ethereum/go-ethereum/core/types" | ||
| "github.com/ethereum/go-ethereum/crypto" | ||
| "github.com/rs/zerolog" | ||
| "sigs.k8s.io/yaml" | ||
|
|
||
| "github.com/smartcontractkit/chainlink-testing-framework/seth" | ||
|
|
||
| "github.com/smartcontractkit/cre-cli/internal/constants" | ||
| "github.com/smartcontractkit/cre-cli/internal/logger" | ||
| "github.com/smartcontractkit/cre-cli/internal/settings" | ||
| inttypes "github.com/smartcontractkit/cre-cli/internal/types" | ||
| ) | ||
|
|
||
| func ValidateEventSignature(l *zerolog.Logger, tx *seth.DecodedTransaction, e abi.Event) (bool, int) { | ||
|
|
@@ -214,3 +217,47 @@ func GetBuildCmd(inputFile string, outputFile string, rootFolder string) *exec.C | |
|
|
||
| return buildCmd | ||
| } | ||
|
|
||
| func WriteChangesetFile(fileName string, changesetFile *inttypes.ChangesetFile, settings *settings.Settings) error { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When you choose the same changeset filename twice it duplicates the contents instead of replace. Is this intended? |
||
| fullFilePath := filepath.Join( | ||
| filepath.Clean(settings.CLDSettings.CLDPath), | ||
| "domains", | ||
| settings.CLDSettings.Domain, | ||
| settings.CLDSettings.Environment, | ||
| "durable_pipelines", | ||
| "inputs", | ||
| fileName, | ||
| ) | ||
|
|
||
| // if file exists, read it and append the new changesets | ||
| if _, err := os.Stat(fullFilePath); err == nil { | ||
| existingYamlData, err := os.ReadFile(fullFilePath) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to read existing changeset yaml file: %w", err) | ||
| } | ||
|
|
||
| var existingChangesetFile inttypes.ChangesetFile | ||
| if err := yaml.Unmarshal(existingYamlData, &existingChangesetFile); err != nil { | ||
| return fmt.Errorf("failed to unmarshal existing changeset yaml: %w", err) | ||
| } | ||
|
|
||
| // Append new changesets to the existing ones | ||
| existingChangesetFile.Changesets = append(existingChangesetFile.Changesets, changesetFile.Changesets...) | ||
| changesetFile = &existingChangesetFile | ||
| } | ||
|
|
||
| yamlData, err := yaml.Marshal(&changesetFile) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to marshal changeset to yaml: %w", err) | ||
| } | ||
|
|
||
| if err := os.WriteFile(fullFilePath, yamlData, 0600); err != nil { | ||
| return fmt.Errorf("failed to write changeset yaml file: %w", err) | ||
| } | ||
|
|
||
| fmt.Println("") | ||
| fmt.Println("Changeset YAML file generated!") | ||
| fmt.Printf("File: %s\n", fullFilePath) | ||
| fmt.Println("") | ||
| return nil | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: When you run both flags - e.g.
cre workflow deploy tf-wf-3 --changeset --unsignedresults in --unsigned behaviour only and no --changeset or feedback message. This is not a blocker but could create confusion.