-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement QuickSyncPlan for k8s plugin (#5020)
* Implement QuickSyncPlan for k8s plugin Signed-off-by: Shinnosuke Sawada <[email protected]> * Fix build and add TODO comment Signed-off-by: Shinnosuke Sawada <[email protected]> * Use deploysource.NewLocalSourceCloner to clone source code Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]> * Fix localSourceCloner.Clone to checkout target revision Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]> * Format sources Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]> * Remove unused function Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]> * Add licence Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]> * Fix kubernetes application spec nil checks Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]> --------- Signed-off-by: Shinnosuke Sawada <[email protected]> Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]> Signed-off-by: khanhtc1202 <[email protected]>
- Loading branch information
1 parent
0735096
commit 4096b70
Showing
6 changed files
with
141 additions
and
8 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
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,38 @@ | ||
// Copyright 2024 The PipeCD Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package plugin | ||
|
||
import ( | ||
"os/exec" | ||
|
||
"github.com/pipe-cd/pipecd/pkg/app/pipedv1/deploysource" | ||
"github.com/pipe-cd/pipecd/pkg/git" | ||
"github.com/pipe-cd/pipecd/pkg/plugin/api/v1alpha1/platform" | ||
) | ||
|
||
func GetPlanSourceCloner(input *platform.PlanPluginInput) (deploysource.SourceCloner, error) { | ||
gitPath, err := exec.LookPath("git") | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
cloner := deploysource.NewLocalSourceCloner( | ||
git.NewRepo(input.GetSourceRemoteUrl(), gitPath, input.GetSourceRemoteUrl(), input.GetDeployment().GetGitPath().GetRepo().GetBranch(), nil), | ||
"target", | ||
input.GetDeployment().GetGitPath().GetRepo().GetBranch(), | ||
) | ||
|
||
return cloner, nil | ||
} |
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,34 @@ | ||
// Copyright 2024 The PipeCD Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package secrets | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/pipe-cd/pipecd/pkg/app/pipedv1/cmd/piped/service" | ||
) | ||
|
||
type Decrypter struct { | ||
client service.PluginServiceClient | ||
} | ||
|
||
func (d *Decrypter) Decrypt(src string) (string, error) { | ||
r, err := d.client.DecryptSecret(context.TODO(), &service.DecryptSecretRequest{Secret: src}) | ||
if err != nil { | ||
return "", fmt.Errorf("failed to decrypt secret: %w", err) | ||
} | ||
return r.GetDecryptedSecret(), nil | ||
} |