Skip to content

Commit 2eed910

Browse files
Merge branch 'master' into dependabot/go_modules/github.com/aws/aws-sdk-go-v2/service/ecs-1.90.3
2 parents 7303b7b + e965eab commit 2eed910

57 files changed

Lines changed: 587 additions & 398 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build_tool.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- name: Determine version
4646
run: echo "PIPECD_VERSION=$(git describe --tags --always --abbrev=7 --match 'v[0-9]*.*')" >> $GITHUB_ENV
4747

48-
- uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
48+
- uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
4949

5050
- name: Build ${{ matrix.image }} image (${{ matrix.platform.arch }})
5151
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0

.github/workflows/publish_image_chart.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,18 @@ jobs:
6767
- name: Set up QEMU
6868
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
6969
- name: Set up Docker Buildx
70-
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
70+
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
7171

7272
# Login to push container images.
7373
- name: Log in to GHCR
74-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
74+
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
7575
with:
7676
registry: ${{ env.GHCR }}
7777
username: ${{ github.actor }}
7878
password: ${{ secrets.GITHUB_TOKEN }}
7979

8080
- name: Log in to GCR
81-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
81+
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
8282
with:
8383
registry: ${{ env.GCR }}
8484
username: _json_key

.github/workflows/publish_pipedv1_exp.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,18 @@ jobs:
7272
fetch-depth: 0
7373

7474
- name: Set up Docker Buildx
75-
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
75+
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
7676

7777
# Login to push container images.
7878
- name: Log in to GHCR
79-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
79+
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
8080
with:
8181
registry: ${{ env.GHCR }}
8282
username: ${{ github.actor }}
8383
password: ${{ secrets.GITHUB_TOKEN }}
8484

8585
- name: Log in to GCR
86-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
86+
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
8787
with:
8888
registry: ${{ env.GCR }}
8989
username: _json_key
@@ -141,18 +141,18 @@ jobs:
141141
merge-multiple: true
142142

143143
- name: Set up Docker Buildx
144-
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
144+
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
145145

146146
# Login to push manifest.
147147
- name: Log in to GHCR
148-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
148+
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
149149
with:
150150
registry: ${{ env.GHCR }}
151151
username: ${{ github.actor }}
152152
password: ${{ secrets.GITHUB_TOKEN }}
153153

154154
- name: Log in to GCR
155-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
155+
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
156156
with:
157157
registry: ${{ env.GCR }}
158158
username: _json_key

.github/workflows/publish_site.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
4343
# Building and pushing container images.
4444
- name: Log in to the container registry
45-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
45+
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
4646
with:
4747
registry: ${{ env.GHCR }}
4848
username: ${{ github.actor }}

.github/workflows/publish_tool.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ jobs:
3434

3535
- uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
3636

37-
- uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
37+
- uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
3838

3939
# Login to push container images.
4040
- name: Log in to the container registry
41-
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
41+
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
4242
with:
4343
registry: ${{ env.GHCR }}
4444
username: ${{ github.actor }}
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
---
2+
title: "Config types and an empty implementation"
3+
linkTitle: "Config types and an empty implementation"
4+
weight: 3
5+
description: >
6+
Define the plugin's configuration types and a compiling, empty DeploymentPlugin.
7+
---
8+
9+
In this chapter you define the configuration types the plugin uses and add an empty implementation of the DeploymentPlugin interface. The methods do nothing yet, but the project compiles and the plugin starts, which gives you a foundation to fill in one method at a time.
10+
11+
## Define the configuration types
12+
13+
Recall the three type parameters of a `DeploymentPlugin`: `Config`, `DeployTargetConfig`, and `ApplicationConfigSpec`. The file plugin needs only one of them.
14+
15+
- It has no plugin-wide configuration, so it uses `sdk.ConfigNone`, the SDK's type for an empty configuration, in place of a `Config` type.
16+
- It has no deploy targets, so its `DeployTargetConfig` is an empty struct.
17+
- It deploys to a directory that is chosen per application, so its application configuration holds a single `Path` field.
18+
19+
Create `plugin.go` with the configuration types:
20+
21+
```go
22+
package main
23+
24+
import (
25+
"context"
26+
27+
sdk "github.com/pipe-cd/piped-plugin-sdk-go"
28+
)
29+
30+
type (
31+
// deployTargetConfig is empty because the file plugin has no deploy targets.
32+
deployTargetConfig struct{}
33+
34+
// applicationConfig holds the per-application settings. The file plugin
35+
// deploys to a directory chosen per application, so it defines Path.
36+
applicationConfig struct {
37+
// Path is the directory the application deploys to.
38+
Path string `json:"path"`
39+
}
40+
)
41+
```
42+
43+
Both `context` and `sdk` are used by the implementation you add next.
44+
45+
## Add an empty implementation
46+
47+
Define a `plugin` type and give it a method for every method in the DeploymentPlugin interface. Each method calls `panic` for now. This lets you confirm that the method set and the signatures are correct before writing any real logic.
48+
49+
Add the following to `plugin.go`:
50+
51+
```go
52+
// plugin provides the DeploymentPlugin implementation for the file plugin.
53+
type plugin struct{}
54+
55+
// Verify at compile time that plugin implements sdk.DeploymentPlugin.
56+
// A missing method or a wrong signature fails the build here.
57+
var _ sdk.DeploymentPlugin[sdk.ConfigNone, deployTargetConfig, applicationConfig] = (*plugin)(nil)
58+
59+
func (p *plugin) FetchDefinedStages() []string {
60+
panic("unimplemented")
61+
}
62+
63+
func (p *plugin) DetermineVersions(ctx context.Context, _ *sdk.ConfigNone, input *sdk.DetermineVersionsInput[applicationConfig]) (*sdk.DetermineVersionsResponse, error) {
64+
panic("unimplemented")
65+
}
66+
67+
func (p *plugin) DetermineStrategy(ctx context.Context, _ *sdk.ConfigNone, input *sdk.DetermineStrategyInput[applicationConfig]) (*sdk.DetermineStrategyResponse, error) {
68+
panic("unimplemented")
69+
}
70+
71+
func (p *plugin) BuildPipelineSyncStages(ctx context.Context, _ *sdk.ConfigNone, input *sdk.BuildPipelineSyncStagesInput) (*sdk.BuildPipelineSyncStagesResponse, error) {
72+
panic("unimplemented")
73+
}
74+
75+
func (p *plugin) BuildQuickSyncStages(ctx context.Context, _ *sdk.ConfigNone, input *sdk.BuildQuickSyncStagesInput) (*sdk.BuildQuickSyncStagesResponse, error) {
76+
panic("unimplemented")
77+
}
78+
79+
func (p *plugin) ExecuteStage(ctx context.Context, _ *sdk.ConfigNone, dts []*sdk.DeployTarget[deployTargetConfig], input *sdk.ExecuteStageInput[applicationConfig]) (*sdk.ExecuteStageResponse, error) {
80+
panic("unimplemented")
81+
}
82+
```
83+
84+
The `var _ sdk.DeploymentPlugin[...] = (*plugin)(nil)` line is a compile-time check. If a method is missing or its signature is wrong, the build fails on this line rather than somewhere less obvious.
85+
86+
## Register the plugin
87+
88+
Now that a plugin type exists, register it so `piped` can load it. Create `main.go`:
89+
90+
```go
91+
package main
92+
93+
import (
94+
"log"
95+
96+
sdk "github.com/pipe-cd/piped-plugin-sdk-go"
97+
)
98+
99+
func main() {
100+
p, err := sdk.NewPlugin(
101+
"0.0.1",
102+
sdk.WithDeploymentPlugin(&plugin{}),
103+
)
104+
if err != nil {
105+
log.Fatalln(err)
106+
}
107+
108+
if err := p.Run(); err != nil {
109+
log.Fatalln(err)
110+
}
111+
}
112+
```
113+
114+
`sdk.NewPlugin` creates the plugin server, `sdk.WithDeploymentPlugin` registers your implementation, and `p.Run()` starts the server. The first argument, `"0.0.1"`, is the plugin's own version.
115+
116+
Build the project to confirm everything fits together:
117+
118+
```bash
119+
go build ./...
120+
```
121+
122+
The project now compiles and the plugin starts, though every stage still panics. In the next chapter you replace the first `panic` with a real implementation of `FetchDefinedStages`.

docs/layouts/partials/navbar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
{{ end }}
3232
</ul>
3333
</div>
34-
<div class="navbar-nav d-none d-lg-block">{{ partial "search-input.html" . }}</div>
34+
<div class="navbar-nav mt-2 mt-md-0">{{ partial "search-input.html" . }}</div>
3535
</nav>

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ require (
1919
github.com/aws/aws-sdk-go-v2/service/s3 v1.107.0
2020
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.33.2
2121
github.com/aws/aws-sdk-go-v2/service/ssm v1.54.3
22-
github.com/coreos/go-oidc/v3 v3.18.0
22+
github.com/coreos/go-oidc/v3 v3.20.0
2323
github.com/creasty/defaults v1.6.0
2424
github.com/envoyproxy/go-control-plane/envoy v1.37.0
2525
github.com/envoyproxy/protoc-gen-validate v1.3.3
@@ -59,15 +59,15 @@ require (
5959
golang.org/x/mod v0.35.0
6060
golang.org/x/net v0.54.0
6161
golang.org/x/oauth2 v0.36.0
62-
golang.org/x/sync v0.20.0
62+
golang.org/x/sync v0.22.0
6363
google.golang.org/api v0.169.0
6464
google.golang.org/grpc v1.82.1
6565
google.golang.org/protobuf v1.36.11
6666
istio.io/api v0.0.0-20200710191538-00b73d23c685
6767
k8s.io/api v0.24.3
6868
k8s.io/apimachinery v0.24.3
6969
k8s.io/client-go v0.24.3
70-
oras.land/oras-go/v2 v2.5.0
70+
oras.land/oras-go/v2 v2.6.2
7171
sigs.k8s.io/controller-runtime v0.12.3
7272
sigs.k8s.io/yaml v1.5.0
7373
)

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A
203203
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
204204
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
205205
github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc=
206-
github.com/coreos/go-oidc/v3 v3.18.0 h1:V9orjXynvu5wiC9SemFTWnG4F45v403aIcjWo0d41+A=
207-
github.com/coreos/go-oidc/v3 v3.18.0/go.mod h1:DYCf24+ncYi+XkIH97GY1+dqoRlbaSI26KVTCI9SrY4=
206+
github.com/coreos/go-oidc/v3 v3.20.0 h1:EtE0WIBHk03N+DqGkY4+UONzzZHk7amKt6IyNd7OsZE=
207+
github.com/coreos/go-oidc/v3 v3.20.0/go.mod h1:DYCf24+ncYi+XkIH97GY1+dqoRlbaSI26KVTCI9SrY4=
208208
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
209209
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
210210
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
@@ -993,8 +993,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
993993
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
994994
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
995995
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
996-
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
997-
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
996+
golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
997+
golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
998998
golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
999999
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
10001000
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -1377,8 +1377,8 @@ k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42/go.mod h1:Z/45zLw8lUo4wdi
13771377
k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
13781378
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 h1:HNSDgDCrr/6Ly3WEGKZftiE7IY19Vz2GdbOCyI4qqhc=
13791379
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
1380-
oras.land/oras-go/v2 v2.5.0 h1:o8Me9kLY74Vp5uw07QXPiitjsw7qNXi8Twd+19Zf02c=
1381-
oras.land/oras-go/v2 v2.5.0/go.mod h1:z4eisnLP530vwIOUOJeBIj0aGI0L1C3d53atvCBqZHg=
1380+
oras.land/oras-go/v2 v2.6.2 h1:N04RXngAp1LJKTG6ifz3xHPipasEkWr+hFmInja5YKo=
1381+
oras.land/oras-go/v2 v2.6.2/go.mod h1:PlTtg4JTDJkDe8yVHpM2wz7/YDc00GVas+i4jAW2TZ4=
13821382
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
13831383
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
13841384
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=

pkg/app/piped/driftdetector/cloudrun/detector.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type secretDecrypter interface {
4747
}
4848

4949
type reporter interface {
50-
ReportApplicationSyncState(ctx context.Context, appID string, state model.ApplicationSyncState) error
50+
ReportApplicationSyncState(ctx context.Context, appID string, state *model.ApplicationSyncState) error
5151
}
5252

5353
type Detector interface {
@@ -312,9 +312,9 @@ func (d *detector) loadApplicationConfiguration(repoPath string, app *model.Appl
312312
return cfg, nil
313313
}
314314

315-
func makeSyncState(r *provider.DiffResult, commit string) model.ApplicationSyncState {
315+
func makeSyncState(r *provider.DiffResult, commit string) *model.ApplicationSyncState {
316316
if r.NoChange() {
317-
return model.ApplicationSyncState{
317+
return &model.ApplicationSyncState{
318318
Status: model.ApplicationSyncStatus_SYNCED,
319319
Timestamp: time.Now().Unix(),
320320
}
@@ -337,7 +337,7 @@ func makeSyncState(r *provider.DiffResult, commit string) model.ApplicationSyncS
337337
})
338338
b.WriteString(details)
339339

340-
return model.ApplicationSyncState{
340+
return &model.ApplicationSyncState{
341341
Status: model.ApplicationSyncStatus_OUT_OF_SYNC,
342342
ShortReason: shortReason,
343343
Reason: b.String(),

0 commit comments

Comments
 (0)