Skip to content

Commit

Permalink
Fix pull without workflows (#631)
Browse files Browse the repository at this point in the history
 deploy: allow pull for projects with no workflows
  • Loading branch information
josephjclark authored Mar 19, 2024
1 parent 220afbd commit fc4d5bf
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 3 deletions.
8 changes: 8 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @openfn/cli

## 1.1.2

### Patch Changes

- Updated dependencies [6d52ddf]
- @openfn/deploy@0.4.4

## 1.1.1

### Patch Changes
Expand All @@ -9,6 +16,7 @@
- @openfn/compiler@0.0.41
- @openfn/deploy@0.4.3
- @openfn/runtime@1.0.1

## 1.1.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/cli",
"version": "1.1.1",
"version": "1.1.2",
"description": "CLI devtools for the openfn toolchain.",
"engines": {
"node": ">=18",
Expand Down
6 changes: 6 additions & 0 deletions packages/deploy/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @openfn/deploy

## 0.4.4

### Patch Changes

- 6d52ddf: Fix an issue pulling a project with no workflows

## 0.4.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/deploy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/deploy",
"version": "0.4.3",
"version": "0.4.4",
"description": "Deploy projects to Lightning instances",
"type": "module",
"exports": {
Expand Down
7 changes: 6 additions & 1 deletion packages/deploy/src/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ export function parseAndValidate(input: string): {
}

function validateWorkflows(workflows: any) {
if (isMap(workflows)) {
if (typeof workflows === 'undefined') {
// allow workflows to be unspecified, but ensure there is an empty
// map to avoid errors downstream
doc.setIn(['workflows'], {})
}
else if (isMap(workflows)) {
for (const workflow of workflows.items) {
if (isPair(workflow)) {
pushUniqueKey(workflow, (workflow as any).key.value);
Expand Down
16 changes: 16 additions & 0 deletions packages/deploy/test/validator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,19 @@ workflows:
].condition_expression === 'true'
);
});


test('allow empty workflows', (t) => {
let doc = `
name: project-name
`;

let result = parseAndValidate(doc);

t.is(result.errors.length, 0)

t.deepEqual(result.doc, {
name: 'project-name',
workflows: {}
})
});

0 comments on commit fc4d5bf

Please sign in to comment.