fix(compose): avoid the need to pass the file to remove the stack BE-11057 (#12065)

Co-authored-by: andres-portainer <andres-portainer@users.noreply.github.com>
Co-authored-by: Yajith Dayarathna <yajith.dayarathna@portainer.io>
pull/12092/head
andres-portainer 2024-08-09 10:22:31 -03:00 committed by GitHub
parent 8d14535fd5
commit 009eec9475
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 28 additions and 12 deletions

View File

@ -28,15 +28,22 @@ jobs:
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- name: 'checkout the current branch'
uses: actions/checkout@v4.1.1
with:
ref: ${{ github.event.inputs.branch }}
- name: 'set up node.js'
uses: actions/setup-node@v4.0.1
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
- run: yarn --frozen-lockfile
- name: Run tests
run: make test-client ARGS="--maxWorkers=2 --minWorkers=1"
test-server:
strategy:
matrix:
@ -49,15 +56,21 @@ jobs:
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- name: 'checkout the current branch'
uses: actions/checkout@v4.1.1
with:
ref: ${{ github.event.inputs.branch }}
- name: 'set up golang'
uses: actions/setup-go@v5.0.0
with:
go-version: ${{ env.GO_VERSION }}
- name: Install docker-compose
run: |
sudo apt-get update
sudo apt-get install docker-compose
- name: 'install dependencies'
run: make test-deps PLATFORM=linux ARCH=amd64
- name: Run tests
- name: 'update $PATH'
run: echo "$(pwd)/dist" >> $GITHUB_PATH
- name: 'run tests'
run: make test-server

View File

@ -64,6 +64,9 @@ clean: ## Remove all build and download artifacts
.PHONY: test test-client test-server
test: test-server test-client ## Run all tests
test-deps: init-dist
./build/download_docker_compose_binary.sh $(PLATFORM) $(ARCH) $(shell jq -r '.dockerCompose' < "./binary-version.json")
test-client: ## Run client tests
yarn test $(ARGS)

View File

@ -57,7 +57,7 @@ func (wrapper *PluginWrapper) Deploy(ctx context.Context, filePaths []string, op
// Down stop and remove containers
func (wrapper *PluginWrapper) Remove(ctx context.Context, projectName string, filePaths []string, options libstack.Options) error {
output, err := wrapper.command(newDownCommand(projectName, filePaths), options)
output, err := wrapper.command(newDownCommand(projectName), options)
if len(output) != 0 {
if err != nil {
return err
@ -217,8 +217,8 @@ func newUpCommand(filePaths []string, options upOptions) composeCommand {
return newCommand(args, filePaths)
}
func newDownCommand(projectName string, filePaths []string) composeCommand {
cmd := newCommand([]string{"down", "--remove-orphans"}, filePaths)
func newDownCommand(projectName string) composeCommand {
cmd := newCommand([]string{"down", "--remove-orphans"}, nil)
cmd.WithProjectName(projectName)
return cmd