Skip to content

Commit

Permalink
fix(core): use correct dep action type in stackGraph event
Browse files Browse the repository at this point in the history
  • Loading branch information
thsig committed Oct 20, 2023
1 parent 5cf2ee6 commit cc5e511
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
16 changes: 15 additions & 1 deletion core/src/graph/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -700,9 +700,23 @@ function dependenciesFromActionConfig(
const deps: ActionDependency[] = config.dependencies.map((d) => {
try {
const { kind, name } = parseActionReference(d)
const depKey = actionReferenceToString(d)
const depConfig = configsByKey[depKey]
if (!depConfig) {
throw new ConfigurationError({
message: `${description} references depdendency ${depKey}, but no such action could be found`,
})
}
// FIXME @eysi: We're setting the "parent" config type as the dep type which is not correct
// and we need to the dep type.
return { kind, name, type: config.type, explicit: true, needsExecutedOutputs: false, needsStaticOutputs: false }
return {
kind,
name,
type: depConfig.type,
explicit: true,
needsExecutedOutputs: false,
needsStaticOutputs: false,
}
} catch (error) {
throw new ValidationError({
message: `Invalid dependency specified: ${error}`,
Expand Down
5 changes: 5 additions & 0 deletions core/test/unit/src/actions/action-configs-to-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ describe("actionConfigsToGraph", () => {
explicit: true,
kind: "Build",
name: "foo",
type: "test",
needsExecutedOutputs: false,
needsStaticOutputs: false,
},
Expand Down Expand Up @@ -288,6 +289,7 @@ describe("actionConfigsToGraph", () => {
{
explicit: true,
kind: "Build",
type: "test",
name: "foo",
needsExecutedOutputs: false,
needsStaticOutputs: false,
Expand Down Expand Up @@ -337,6 +339,7 @@ describe("actionConfigsToGraph", () => {
{
explicit: false,
kind: "Build",
type: "test",
name: "foo",
fullRef: ["actions", "build", "foo", "version"],
needsExecutedOutputs: false,
Expand Down Expand Up @@ -387,6 +390,7 @@ describe("actionConfigsToGraph", () => {
{
explicit: false,
kind: "Build",
type: "test",
name: "foo",
fullRef: ["actions", "build", "foo", "outputs", "bar"],
needsExecutedOutputs: true,
Expand Down Expand Up @@ -437,6 +441,7 @@ describe("actionConfigsToGraph", () => {
{
explicit: false,
kind: "Build",
type: "container",
name: "foo",
fullRef: ["actions", "build", "foo", "outputs", "deploymentImageName"],
needsExecutedOutputs: false,
Expand Down
19 changes: 19 additions & 0 deletions core/test/unit/src/config-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1477,84 +1477,98 @@ describe("ConfigGraph (module-based configs)", () => {
expect(rendered.nodes).to.include.deep.members([
{
kind: "Build",
type: "test",
name: "module-a",
key: "module-a",
disabled: false,
},
{
kind: "Build",
type: "test",
name: "module-b",
key: "module-b",
disabled: false,
},
{
kind: "Build",
type: "test",
name: "module-c",
key: "module-c",
disabled: false,
},
{
kind: "Test",
type: "test",
name: "module-c-unit",
key: "module-c-unit",
disabled: false,
},
{
kind: "Test",
type: "test",
name: "module-c-integ",
key: "module-c-integ",
disabled: false,
},
{
kind: "Run",
type: "test",
name: "task-c",
key: "task-c",
disabled: false,
},
{
kind: "Deploy",
type: "test",
name: "service-c",
key: "service-c",
disabled: false,
},
{
kind: "Test",
type: "test",
name: "module-a-unit",
key: "module-a-unit",
disabled: false,
},
{
kind: "Test",
type: "test",
name: "module-a-integration",
key: "module-a-integration",
disabled: false,
},
{
kind: "Run",
type: "test",
name: "task-a",
key: "task-a",
disabled: false,
},
{
kind: "Test",
type: "test",
name: "module-b-unit",
key: "module-b-unit",
disabled: false,
},
{
kind: "Run",
type: "test",
name: "task-b",
key: "task-b",
disabled: false,
},
{
kind: "Deploy",
type: "test",
name: "service-a",
key: "service-a",
disabled: false,
},
{
kind: "Deploy",
type: "test",
name: "service-b",
key: "service-b",
disabled: false,
Expand All @@ -1571,6 +1585,7 @@ describe("ConfigGraphNode", () => {
const res = node.render()
expect(res).to.eql({
kind: "Build",
type: "container",
name: "module-a",
key: "module-a",
disabled: false,
Expand All @@ -1582,6 +1597,7 @@ describe("ConfigGraphNode", () => {
const res = node.render()
expect(res).to.eql({
kind: "Deploy",
type: "container",
name: "service-a",
key: "service-a",
disabled: false,
Expand All @@ -1593,6 +1609,7 @@ describe("ConfigGraphNode", () => {
const res = node.render()
expect(res).to.eql({
kind: "Run",
type: "container",
name: "task-a",
key: "task-a",
disabled: false,
Expand All @@ -1604,6 +1621,7 @@ describe("ConfigGraphNode", () => {
const res = node.render()
expect(res).to.eql({
kind: "Test",
type: "container",
name: "module-a.test-a",
key: "module-a.test-a",
disabled: false,
Expand All @@ -1615,6 +1633,7 @@ describe("ConfigGraphNode", () => {
const res = node.render()
expect(res).to.eql({
kind: "Test",
type: "container",
name: "module-a.test-a",
key: "module-a.test-a",
disabled: true,
Expand Down
3 changes: 3 additions & 0 deletions core/test/unit/src/garden.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4301,6 +4301,7 @@ describe("Garden", () => {
{
explicit: true,
kind: "Build",
type: "foo",
name: "foo",
needsExecutedOutputs: false,
needsStaticOutputs: false,
Expand Down Expand Up @@ -4363,6 +4364,7 @@ describe("Garden", () => {
{
explicit: true,
kind: "Build",
type: "test",
name: "foo",
needsExecutedOutputs: false,
needsStaticOutputs: false,
Expand Down Expand Up @@ -4492,6 +4494,7 @@ describe("Garden", () => {
{
explicit: true,
kind: "Build",
type: "foo",
name: "foo",
needsExecutedOutputs: false,
needsStaticOutputs: false,
Expand Down

0 comments on commit cc5e511

Please sign in to comment.