1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 20:35:25 +02:00

fix(libstack): compose project working directory [BE-11751] (#600)

This commit is contained in:
Devon Steenberg 2025-04-04 09:07:35 +13:00 committed by GitHub
parent f6f07f4690
commit 1b8fbbe7d7
2 changed files with 6 additions and 6 deletions

View file

@ -312,10 +312,6 @@ func createProject(ctx context.Context, configFilepaths []string, options libsta
workingDir = filepath.Dir(configFilepaths[0]) workingDir = filepath.Dir(configFilepaths[0])
} }
if options.WorkingDir != "" {
workingDir = options.WorkingDir
}
if options.ProjectDir != "" { if options.ProjectDir != "" {
// When relative paths are used in the compose file, the project directory is used as the base path // When relative paths are used in the compose file, the project directory is used as the base path
workingDir = options.ProjectDir workingDir = options.ProjectDir

View file

@ -991,10 +991,12 @@ func Test_createProject(t *testing.T) {
}, },
configFilepaths: []string{dir + "/docker-compose.yml"}, configFilepaths: []string{dir + "/docker-compose.yml"},
options: libstack.Options{ options: libstack.Options{
// Note that this is the execution working directory not the compose project working directory
// and so it has no affect on the created projects working directory
WorkingDir: "/something-totally-different", WorkingDir: "/something-totally-different",
ProjectName: projectName, ProjectName: projectName,
}, },
expectedProject: expectedSimpleComposeProject("/something-totally-different", nil), expectedProject: expectedSimpleComposeProject("", nil),
}, },
{ {
name: "Relative Working Directory", name: "Relative Working Directory",
@ -1003,10 +1005,12 @@ func Test_createProject(t *testing.T) {
}, },
configFilepaths: []string{dir + "/docker-compose.yml"}, configFilepaths: []string{dir + "/docker-compose.yml"},
options: libstack.Options{ options: libstack.Options{
// Note that this is the execution working directory not the compose project working directory
// and so it has no affect on the created projects working directory
WorkingDir: "something-totally-different", WorkingDir: "something-totally-different",
ProjectName: projectName, ProjectName: projectName,
}, },
expectedProject: expectedSimpleComposeProject("something-totally-different", nil), expectedProject: expectedSimpleComposeProject("", nil),
}, },
{ {
name: "Absolute Project Directory", name: "Absolute Project Directory",