Skip to content

Commit

Permalink
Add execution functions to dotnet actions
Browse files Browse the repository at this point in the history
Introduced the execution functions, Execute(), for both addToSln and addToProject actions in the cmd/worker/actions/dotnet files. These functions ensure the actions are carried out by initiating a Docker container with the necessary configuration and capture any errors during the process.
  • Loading branch information
PiotrFerenc committed Apr 21, 2024
1 parent 9d61f13 commit 22d8728
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/worker/actions/dotnet/add-nuget.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ func (a addToProject) GetCategoryName() string {
return "docker"
}

// Execute executes the addToProject action by starting a Docker container with the specified image name, environment variables,
// volume bindings, and context. It sets the container ID in the process Parameters map under the containerId property.
//
// Parameters:
//
// process: The process on which to execute the addToProject action.
//
// Returns:
//
// types.Process: The modified process after execution.
// error: An error if the addToProject action failed to execute.
func (a addToProject) Execute(process types.Process) (types.Process, error) {
ctx := context.Background()

Expand Down
12 changes: 12 additions & 0 deletions cmd/worker/actions/dotnet/add-to-sln.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ func (a addToSln) GetCategoryName() string {
return "dotnet"
}

// Execute executes the addToSln action by starting a Docker container with the specified image name,
// environment variables, volume bindings, and context. It also sets the container ID in the process
// object for later use.
//
// Parameters:
//
// process: The process object containing the necessary properties and parameters.
//
// Returns:
//
// types.Process: The updated process object after executing the action.
// error: An error if the action fails to execute.
func (a addToSln) Execute(process types.Process) (types.Process, error) {
ctx := context.Background()
projectPath, err := a.projectPath.GetStringFrom(&process)
Expand Down

0 comments on commit 22d8728

Please sign in to comment.