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
parent
8d14535fd5
commit
009eec9475
|
@ -28,15 +28,22 @@ jobs:
|
||||||
if: github.event.pull_request.draft == false
|
if: github.event.pull_request.draft == false
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: 'checkout the current branch'
|
||||||
- uses: actions/setup-node@v2
|
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:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
|
|
||||||
- run: yarn --frozen-lockfile
|
- run: yarn --frozen-lockfile
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: make test-client ARGS="--maxWorkers=2 --minWorkers=1"
|
run: make test-client ARGS="--maxWorkers=2 --minWorkers=1"
|
||||||
|
|
||||||
test-server:
|
test-server:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -49,15 +56,21 @@ jobs:
|
||||||
if: github.event.pull_request.draft == false
|
if: github.event.pull_request.draft == false
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: 'checkout the current branch'
|
||||||
- uses: actions/setup-go@v3
|
uses: actions/checkout@v4.1.1
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.inputs.branch }}
|
||||||
|
|
||||||
|
- name: 'set up golang'
|
||||||
|
uses: actions/setup-go@v5.0.0
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
|
||||||
- name: Install docker-compose
|
- name: 'install dependencies'
|
||||||
run: |
|
run: make test-deps PLATFORM=linux ARCH=amd64
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install docker-compose
|
|
||||||
|
|
||||||
- name: Run tests
|
- name: 'update $PATH'
|
||||||
|
run: echo "$(pwd)/dist" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
- name: 'run tests'
|
||||||
run: make test-server
|
run: make test-server
|
||||||
|
|
3
Makefile
3
Makefile
|
@ -64,6 +64,9 @@ clean: ## Remove all build and download artifacts
|
||||||
.PHONY: test test-client test-server
|
.PHONY: test test-client test-server
|
||||||
test: test-server test-client ## Run all tests
|
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
|
test-client: ## Run client tests
|
||||||
yarn test $(ARGS)
|
yarn test $(ARGS)
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ func (wrapper *PluginWrapper) Deploy(ctx context.Context, filePaths []string, op
|
||||||
|
|
||||||
// Down stop and remove containers
|
// Down stop and remove containers
|
||||||
func (wrapper *PluginWrapper) Remove(ctx context.Context, projectName string, filePaths []string, options libstack.Options) error {
|
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 len(output) != 0 {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -217,8 +217,8 @@ func newUpCommand(filePaths []string, options upOptions) composeCommand {
|
||||||
return newCommand(args, filePaths)
|
return newCommand(args, filePaths)
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDownCommand(projectName string, filePaths []string) composeCommand {
|
func newDownCommand(projectName string) composeCommand {
|
||||||
cmd := newCommand([]string{"down", "--remove-orphans"}, filePaths)
|
cmd := newCommand([]string{"down", "--remove-orphans"}, nil)
|
||||||
cmd.WithProjectName(projectName)
|
cmd.WithProjectName(projectName)
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
|
|
Loading…
Reference in New Issue