Skip to content

Commit cdd1b38

Browse files
authored
Merge branch 'main' into main_enable_multi_service_bindings
2 parents 5a47226 + bcee664 commit cdd1b38

28 files changed

Lines changed: 1346 additions & 968 deletions

.github/ops-files/use-latest-capi.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88

99
- type: remove
1010
path: /releases/name=capi/sha1?
11+
12+
- type: remove
13+
path: /releases/name=capi/stemcell?

.github/workflows/create-bosh-lite.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ jobs:
124124
cd $env_name/bbl-state
125125
eval "$(bbl print-env --shell-type posix)"
126126
127-
jq -r .bosh.jumpbox_private_key metadata.json > /tmp/${env_name}.priv
128-
129127
bosh upload-release "https://bosh.io/d/github.com/cloudfoundry/capi-release?v=$capi_release_version"
130128
- name: Deploy cf
131129
run: |

.github/workflows/release-build-sign-upload.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ jobs:
864864
path: signed/*
865865

866866
- name: Setup aws to upload installers to CLAW S3 bucket
867-
uses: aws-actions/configure-aws-credentials@v5
867+
uses: aws-actions/configure-aws-credentials@v6
868868
env:
869869
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
870870
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

.github/workflows/release-update-repos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ jobs:
403403
&& pip3 install awscli
404404
405405
- name: Setup aws to upload installers to CLAW S3 bucket
406-
uses: aws-actions/configure-aws-credentials@v5
406+
uses: aws-actions/configure-aws-credentials@v6
407407
env:
408408
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
409409
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

actor/v7action/cloud_controller_client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ type CloudControllerClient interface {
138138
GetAppFeature(appGUID string, featureName string) (resources.ApplicationFeature, ccv3.Warnings, error)
139139
GetStacks(query ...ccv3.Query) ([]resources.Stack, ccv3.Warnings, error)
140140
GetStagingSecurityGroups(spaceGUID string, queries ...ccv3.Query) ([]resources.SecurityGroup, ccv3.Warnings, error)
141+
UpdateStack(stackGUID string, state string, reason string) (resources.Stack, ccv3.Warnings, error)
141142
GetTask(guid string) (resources.Task, ccv3.Warnings, error)
142143
GetUser(userGUID string) (resources.User, ccv3.Warnings, error)
143144
GetUsers(query ...ccv3.Query) ([]resources.User, ccv3.Warnings, error)

actor/v7action/stack.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,12 @@ func (actor Actor) GetStacks(labelSelector string) ([]resources.Stack, Warnings,
4646

4747
return stacks, Warnings(warnings), nil
4848
}
49+
50+
func (actor Actor) UpdateStack(stackGUID string, state string, reason string) (resources.Stack, Warnings, error) {
51+
stack, warnings, err := actor.CloudControllerClient.UpdateStack(stackGUID, state, reason)
52+
if err != nil {
53+
return resources.Stack{}, Warnings(warnings), err
54+
}
55+
56+
return stack, Warnings(warnings), nil
57+
}

actor/v7action/stack_test.go

Lines changed: 106 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ var _ = Describe("Stack", func() {
6969

7070
Context("there are no errors", func() {
7171

72-
When("the stack exists", func() {
72+
When("the stack exists without state", func() {
7373
expectedStack := resources.Stack{
7474
GUID: "some-stack-guid",
7575
Name: "some-stack-name",
@@ -98,6 +98,43 @@ var _ = Describe("Stack", func() {
9898
Expect(stack.GUID).To(Equal(expectedStack.GUID))
9999
Expect(stack.Name).To(Equal(expectedStack.Name))
100100
Expect(stack.Description).To(Equal(expectedStack.Description))
101+
Expect(stack.State).To(Equal(""))
102+
Expect(err).To(BeNil())
103+
Expect(warnings).To(ConsistOf("warning-1", "warning-2"))
104+
})
105+
})
106+
107+
When("the stack exists with state", func() {
108+
expectedStack := resources.Stack{
109+
GUID: "some-stack-guid",
110+
Name: "some-stack-name",
111+
Description: "Some stack desc",
112+
State: "ACTIVE",
113+
}
114+
115+
expectedParams := []ccv3.Query{
116+
{Key: ccv3.NameFilter, Values: []string{"some-stack-name"}},
117+
{Key: ccv3.PerPage, Values: []string{"1"}},
118+
{Key: ccv3.Page, Values: []string{"1"}},
119+
}
120+
121+
BeforeEach(func() {
122+
fakeCloudControllerClient.GetStacksReturns(
123+
[]resources.Stack{expectedStack},
124+
ccv3.Warnings{"warning-1", "warning-2"},
125+
nil,
126+
)
127+
})
128+
129+
It("returns the desired stack with state", func() {
130+
131+
actualParams := fakeCloudControllerClient.GetStacksArgsForCall(0)
132+
Expect(actualParams).To(Equal(expectedParams))
133+
Expect(fakeCloudControllerClient.GetStacksCallCount()).To(Equal(1))
134+
Expect(stack.GUID).To(Equal(expectedStack.GUID))
135+
Expect(stack.Name).To(Equal(expectedStack.Name))
136+
Expect(stack.Description).To(Equal(expectedStack.Description))
137+
Expect(stack.State).To(Equal(resources.StackStateActive))
101138
Expect(err).To(BeNil())
102139
Expect(warnings).To(ConsistOf("warning-1", "warning-2"))
103140
})
@@ -196,4 +233,72 @@ var _ = Describe("Stack", func() {
196233
})
197234
})
198235
})
236+
237+
Describe("UpdateStack", func() {
238+
var (
239+
stackGUID string
240+
state string
241+
reason string
242+
stack resources.Stack
243+
warnings Warnings
244+
executeErr error
245+
)
246+
247+
BeforeEach(func() {
248+
stackGUID = "some-stack-guid"
249+
state = "DEPRECATED"
250+
reason = ""
251+
})
252+
253+
JustBeforeEach(func() {
254+
stack, warnings, executeErr = actor.UpdateStack(stackGUID, state, reason)
255+
})
256+
257+
When("the cloud controller request is successful", func() {
258+
BeforeEach(func() {
259+
fakeCloudControllerClient.UpdateStackReturns(
260+
resources.Stack{
261+
GUID: "some-stack-guid",
262+
Name: "some-stack",
263+
Description: "some description",
264+
State: "DEPRECATED",
265+
},
266+
ccv3.Warnings{"warning-1", "warning-2"},
267+
nil,
268+
)
269+
})
270+
271+
It("returns the updated stack and warnings", func() {
272+
Expect(executeErr).ToNot(HaveOccurred())
273+
Expect(warnings).To(ConsistOf("warning-1", "warning-2"))
274+
Expect(stack).To(Equal(resources.Stack{
275+
GUID: "some-stack-guid",
276+
Name: "some-stack",
277+
Description: "some description",
278+
State: "DEPRECATED",
279+
}))
280+
281+
Expect(fakeCloudControllerClient.UpdateStackCallCount()).To(Equal(1))
282+
actualGUID, actualState, actualReason := fakeCloudControllerClient.UpdateStackArgsForCall(0)
283+
Expect(actualGUID).To(Equal(stackGUID))
284+
Expect(actualState).To(Equal(state))
285+
Expect(actualReason).To(Equal(reason))
286+
})
287+
})
288+
289+
When("the cloud controller request fails", func() {
290+
BeforeEach(func() {
291+
fakeCloudControllerClient.UpdateStackReturns(
292+
resources.Stack{},
293+
ccv3.Warnings{"warning-1"},
294+
errors.New("some-error"),
295+
)
296+
})
297+
298+
It("returns the error and warnings", func() {
299+
Expect(executeErr).To(MatchError("some-error"))
300+
Expect(warnings).To(ConsistOf("warning-1"))
301+
})
302+
})
303+
})
199304
})

0 commit comments

Comments
 (0)