Skip to content

Commit 7398b52

Browse files
fix: sends environment query params when get the deploy status (#214)
1 parent 687215c commit 7398b52

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- `extensions get` command
1313

14+
### Fixed
15+
16+
- deploy status now sends the environment query params
17+
1418
## [0.13.0] - 2024-06-26
1519

1620
### Added

internal/cmd/deploy/deploy.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func run(ctx context.Context, environmentName string, options *clioptions.CLIOpt
8484
}
8585
fmt.Printf("Deploying project %s in the environment '%s'\n", projectID, environmentName)
8686

87-
status, err := waitStatus(ctx, client, projectID, resp.ID)
87+
status, err := waitStatus(ctx, client, projectID, resp.ID, environmentName)
8888
if err != nil {
8989
return fmt.Errorf("error retrieving the pipeline status: %w", err)
9090
}
@@ -136,13 +136,14 @@ func triggerPipeline(ctx context.Context, client *client.APIClient, environmentN
136136
// Declared here to override it during tests
137137
var sleepDuration = (1 * time.Second) + (500 * time.Millisecond)
138138

139-
func waitStatus(ctx context.Context, client *client.APIClient, projectID string, deployID int) (string, error) {
139+
func waitStatus(ctx context.Context, client *client.APIClient, projectID string, deployID int, environmentName string) (string, error) {
140140
var outStatus *resources.PipelineStatus
141141
for {
142142
time.Sleep(sleepDuration)
143143
resp, err := client.
144144
Get().
145145
APIPath(fmt.Sprintf(pipelineStatusEndpointTemplate, projectID, deployID)).
146+
SetParam("environment", environmentName).
146147
Do(ctx)
147148

148149
if err != nil {

internal/cmd/deploy/deploy_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func testServer(t *testing.T) *httptest.Server {
8080

8181
require.NoError(t, err)
8282
w.Write(data)
83-
case r.Method == http.MethodGet && r.URL.Path == fmt.Sprintf(pipelineStatusEndpointTemplate, "correct", 1):
83+
case r.Method == http.MethodGet && r.URL.Path == fmt.Sprintf(pipelineStatusEndpointTemplate, "correct", 1) && r.URL.Query().Get("environment") == "environmentName":
8484
data, err := resources.EncodeResourceToJSON(&resources.PipelineStatus{
8585
ID: 1,
8686
Status: "succeeded",

0 commit comments

Comments
 (0)