Skip to content

Commit

Permalink
fix(enterprise): add project id to config dump
Browse files Browse the repository at this point in the history
This fixes a recent regression where project IDs would not be included
in the output of the `get config` command unless logged in.
  • Loading branch information
thsig authored and edvald committed Jul 30, 2020
1 parent 33d8275 commit c587de9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions garden-service/src/garden.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export interface GardenEnterpriseContext {
export interface GardenParams {
artifactsPath: string
buildDir: BuildDir
projectId: string | null
enterpriseContext: GardenEnterpriseContext | null
dotIgnoreFiles: string[]
environmentName: string
Expand Down Expand Up @@ -163,7 +164,8 @@ export class Garden {
private readonly taskGraph: TaskGraph
private watcher: Watcher
private asyncLock: any
public enterpriseContext: GardenEnterpriseContext | null
public readonly enterpriseContext: GardenEnterpriseContext | null
public readonly projectId: string | null
public sessionId: string | null
public readonly configStore: ConfigStore
public readonly globalConfigStore: GlobalConfigStore
Expand Down Expand Up @@ -200,6 +202,7 @@ export class Garden {
constructor(params: GardenParams) {
this.buildDir = params.buildDir
this.enterpriseContext = params.enterpriseContext
this.projectId = params.projectId
this.sessionId = params.sessionId
this.environmentName = params.environmentName
this.environmentConfigs = params.environmentConfigs
Expand Down Expand Up @@ -339,6 +342,7 @@ export class Garden {
const garden = new this({
artifactsPath,
sessionId,
projectId: projectId || null,
enterpriseContext,
projectRoot,
projectName,
Expand Down Expand Up @@ -1178,7 +1182,7 @@ export class Garden {
workflowConfigs: sortBy(workflowConfigs, "name"),
projectName: this.projectName,
projectRoot: this.projectRoot,
projectId: this.enterpriseContext ? this.enterpriseContext.projectId : undefined,
projectId: this.projectId || undefined,
}
}

Expand Down
5 changes: 3 additions & 2 deletions garden-service/test/unit/src/commands/get/get-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("GetConfigCommand", () => {
expect(res.result?.moduleConfigs).to.deep.equal(expectedModuleConfigs)
})

it("should include the project name and all environment names", async () => {
it("should include the project name, id and all environment names", async () => {
const garden = await makeTestGardenA()
const log = garden.log
const command = new GetConfigCommand()
Expand All @@ -53,8 +53,9 @@ describe("GetConfigCommand", () => {
})
).result

expect(pick(result, ["projectName", "allEnvironmentNames"])).to.eql({
expect(pick(result, ["projectName", "projectId", "allEnvironmentNames"])).to.eql({
projectName: "test-project-a",
projectId: "test-project-id",
allEnvironmentNames: ["local", "other"],
})
})
Expand Down

0 comments on commit c587de9

Please sign in to comment.