diff --git a/api/http/handler/stacks/create_compose_stack.go b/api/http/handler/stacks/create_compose_stack.go index 26e1c6217..748b3c155 100644 --- a/api/http/handler/stacks/create_compose_stack.go +++ b/api/http/handler/stacks/create_compose_stack.go @@ -137,7 +137,7 @@ func (handler *Handler) createComposeStackFromGitRepository(w http.ResponseWrite EntryPoint: payload.ComposeFilePathInRepository, } - projectPath := handler.FileService.GetStackProjectPath(string(stack.ID)) + projectPath := handler.FileService.GetStackProjectPath(strconv.Itoa(int(stack.ID))) stack.ProjectPath = projectPath gitCloneParams := &cloneRepositoryParameters{ diff --git a/api/http/handler/stacks/create_swarm_stack.go b/api/http/handler/stacks/create_swarm_stack.go index 6fee54221..05084a99d 100644 --- a/api/http/handler/stacks/create_swarm_stack.go +++ b/api/http/handler/stacks/create_swarm_stack.go @@ -151,7 +151,7 @@ func (handler *Handler) createSwarmStackFromGitRepository(w http.ResponseWriter, Env: payload.Env, } - projectPath := handler.FileService.GetStackProjectPath(string(stack.ID)) + projectPath := handler.FileService.GetStackProjectPath(strconv.Itoa(int(stack.ID))) stack.ProjectPath = projectPath gitCloneParams := &cloneRepositoryParameters{ diff --git a/api/portainer.go b/api/portainer.go index 31b9c5203..abb60df79 100644 --- a/api/portainer.go +++ b/api/portainer.go @@ -484,7 +484,7 @@ type ( const ( // APIVersion is the version number of the Portainer API. - APIVersion = "1.18.0" + APIVersion = "1.18.1" // DBVersion is the version number of the Portainer database. DBVersion = 12 // DefaultTemplatesURL represents the default URL for the templates definitions. diff --git a/api/swagger.yaml b/api/swagger.yaml index 086437dc3..1172d1706 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -54,7 +54,7 @@ info: **NOTE**: You can find more information on how to query the Docker API in the [Docker official documentation](https://docs.docker.com/engine/api/v1.30/) as well as in [this Portainer example](https://gist.github.com/deviantony/77026d402366b4b43fa5918d41bc42f8). - version: "1.18.0" + version: "1.18.1" title: "Portainer API" contact: email: "info@portainer.io" @@ -1386,7 +1386,7 @@ paths: in: "path" description: "Stack identifier" required: true - type: "string" + type: "integer" responses: 200: description: "Success" @@ -1431,7 +1431,12 @@ paths: in: "path" description: "Stack identifier" required: true - type: "string" + type: "integer" + - name: "endpointId" + in: "query" + description: "Stacks created before version 1.18.0 might not have an associated endpoint identifier. Use this \ + optional parameter to set the endpoint identifier used by the stack." + type: "integer" - in: "body" name: "body" description: "Stack details" @@ -1478,7 +1483,7 @@ paths: in: "path" description: "Stack identifier" required: true - type: "string" + type: "integer" - name: "external" in: "query" description: "Set to true to delete an external stack. Only external Swarm stacks are supported." @@ -1528,7 +1533,7 @@ paths: in: "path" description: "Stack identifier" required: true - type: "string" + type: "integer" responses: 200: description: "Success" @@ -1556,6 +1561,61 @@ paths: description: "Server error" schema: $ref: "#/definitions/GenericError" + /stacks/{id}/migrate: + post: + tags: + - "stacks" + summary: "Migrate a stack to another endpoint" + description: | + Migrate a stack from an endpoint to another endpoint. It will re-create + the stack inside the target endpoint before removing the original stack. + **Access policy**: restricted + operationId: "StackMigrate" + produces: + - "application/json" + parameters: + - name: "id" + in: "path" + description: "Stack identifier" + required: true + type: "integer" + - name: "endpointId" + in: "query" + description: "Stacks created before version 1.18.0 might not have an associated endpoint identifier. Use this \ + optional parameter to set the endpoint identifier used by the stack." + type: "integer" + - in: "body" + name: "body" + description: "Stack migration details." + schema: + $ref: "#/definitions/StackMigrateRequest" + responses: + 200: + description: "Success" + schema: + $ref: "#/definitions/Stack" + 400: + description: "Invalid request" + schema: + $ref: "#/definitions/GenericError" + examples: + application/json: + err: "Invalid request" + 403: + description: "Unauthorized" + schema: + $ref: "#/definitions/GenericError" + 404: + description: "Stack not found" + schema: + $ref: "#/definitions/GenericError" + examples: + application/json: + err: "Stack not found" + 500: + description: "Server error" + schema: + $ref: "#/definitions/GenericError" /users: get: tags: @@ -2598,7 +2658,7 @@ definitions: description: "Is analytics enabled" Version: type: "string" - example: "1.18.0" + example: "1.18.1" description: "Portainer API version" PublicSettingsInspectResponse: type: "object" @@ -3561,6 +3621,19 @@ definitions: type: "string" example: "nginx:latest" description: "The Docker image associated to the template" + StackMigrateRequest: + type: "object" + required: + - "EndpointID" + properties: + EndpointID: + type: "integer" + example: 2 + description: "Endpoint identifier of the target endpoint where the stack will be relocated" + SwarmID: + type: "string" + example: "jpofkc0i9uo9wtx1zesuk649w" + description: "Swarm cluster identifier, must match the identifier of the cluster where the stack will be relocated" StackCreateRequest: type: "object" required: diff --git a/distribution/portainer.spec b/distribution/portainer.spec index b99fff674..d38ffc694 100644 --- a/distribution/portainer.spec +++ b/distribution/portainer.spec @@ -1,5 +1,5 @@ Name: portainer -Version: 1.18.0 +Version: 1.18.1 Release: 0 License: Zlib Summary: A lightweight docker management UI diff --git a/package.json b/package.json index d536cdccb..5a4becede 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Portainer.io", "name": "portainer", "homepage": "http://portainer.io", - "version": "1.18.0", + "version": "1.18.1", "repository": { "type": "git", "url": "git@github.com:portainer/portainer.git"