Skip to content

Commit

Permalink
Feature: Bind Workspaces for PipelineRun
Browse files Browse the repository at this point in the history
UI: Add workspaces dropdown with all possible volume sources for PipelineRun
Support volume sources: configmap, secret, pvc, emptydir
Backend: intercept k8s response for configmap, secret or pvc and modify response to contain only non-sensitive data
RBAC: allow to list \ watch those volume sources

Support Optional Workspaces
  • Loading branch information
marniks7 committed Sep 25, 2022
1 parent 86de9b6 commit 74fcc6d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('Create Pipeline Run with Workspace', () => {

cy.contains('pipeline-with-ws-run-').first().click();

cy.get('header[class="tkn--pipeline-run-header"]', { timeout: 6000 })
cy.get('header[class="tkn--pipeline-run-header"]', { timeout: 10000 })
.find('span[class="tkn--status-label"]', { timeout: 15000 })
.should('have.text', 'Succeeded');
});
Expand All @@ -58,7 +58,7 @@ describe('Create Pipeline Run with Workspace', () => {

cy.contains('pipeline-with-ws-pvc-run-').first().click();

cy.get('header[class="tkn--pipeline-run-header"]', { timeout: 6000 })
cy.get('header[class="tkn--pipeline-run-header"]', { timeout: 10000 })
.find('span[class="tkn--status-label"]', { timeout: 15000 })
.should('have.text', 'Succeeded');
});
Expand Down
42 changes: 9 additions & 33 deletions src/containers/CreatePipelineRun/CreatePipelineRun.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,15 @@ function CreatePipelineRun({ intl }) {
true
);
const workspacesSpecMap = keyBy(workspaceSpecs, 'name');
const validWorkspaces =
!workspaces ||
Object.keys(workspacesSpecMap).reduce(
(acc, name) =>
acc &&
(!!workspaces[name] || workspacesSpecMap[name]?.optional === true),
true
);
const workspacesSpecMap = keyBy(workspaceSpecs, 'name');
const validWorkspaces =
!workspaces ||
Object.keys(workspacesSpecMap).reduce(
Expand Down Expand Up @@ -450,17 +459,6 @@ function CreatePipelineRun({ intl }) {
});
}

function handleWorkspacePVCSubPathChange(key, value) {
setState(state => {
const workspace = initWorkspace(key);
workspace['sub-path'] = value;

return {
...state
};
});
}

function handleSubmit(event) {
event.preventDefault();

Expand Down Expand Up @@ -727,28 +725,6 @@ function CreatePipelineRun({ intl }) {
handleWorkspaceChange(workspaceSpec.name, id, kind);
}}
/>
{workspaces[workspaceSpec.name] &&
workspaces[workspaceSpec.name].value &&
workspaces[workspaceSpec.name].kind ===
'PersistentVolumeClaim' ? (
<TextInput
id={`create-pipelinerun--ws-sub-path-${workspaceSpec.name}`}
key={`create-pipelinerun--ws-sub-path-${workspaceSpec.name}`}
labelText="sub-path"
helperText={intl.formatMessage({
id: 'dashboard.createRun.subPathHelperText',
defaultMessage: 'Specify Sub Path (optional)'
})}
value={
(workspaces[workspaceSpec.name] &&
workspaces[workspaceSpec.name]['sub-path']) ||
''
}
onChange={({ target: { value } }) =>
handleWorkspacePVCSubPathChange(workspaceSpec.name, value)
}
/>
) : null}
</>
))}
</FormGroup>
Expand Down
1 change: 0 additions & 1 deletion test/e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ test_dashboard() {
else
docker run --rm --network=host -v $VIDEO_PATH:/home/node/cypress/videos dashboard-e2e || fail_test "Browser E2E tests failed"
fi

# If we get here the tests passed, no need to upload artifacts
rm -rf $VIDEO_PATH
kill -9 $dashboardForwardPID
Expand Down
11 changes: 0 additions & 11 deletions test/resources/envsubst/pipelinerun-with-ws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,6 @@ spec:
- name: optional-ws
configMap:
name: configmap-test
# - name: empDirSubPath-ws
# emptyDir: {}
# subPath: deep
# - name: volumeClaimTemplate-ws
# volumeClaimTemplate:
# spec:
# accessModes:
# - ReadWriteOnce
# resources:
# requests:
# storage: 10Mi
pipelineRef:
name: pipeline-with-ws
serviceAccountName: e2e-tests
15 changes: 0 additions & 15 deletions test/resources/static/Pipeline-with-ws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ spec:
description: Pipeline Workspace Description
- name: optional-unbound-ws
optional: true
# - name: empDirSubPath-ws
# - name: volumeClaimTemplate-ws
tasks:
- name: hello
workspaces:
Expand All @@ -29,10 +27,6 @@ spec:
workspace: optional-ws
- name: optional-unbound-ws
workspace: optional-unbound-ws
# - name: empDirSubPath-ws
# workspace: empDirSubPath-ws
# - name: volumeClaimTemplate-ws
# workspace: volumeClaimTemplate-ws
taskSpec:
workspaces:
- name: configmap-ws
Expand All @@ -43,8 +37,6 @@ spec:
description: Task Workspace Description
- name: optional-unbound-ws
optional: true
# - name: empDirSubPath-ws
# - name: volumeClaimTemplate-ws
steps:
- name: write
image: busybox
Expand Down Expand Up @@ -91,10 +83,3 @@ spec:
exit 1
fi
echo "Hello World!"
# echo "$(workspaces.empDirSubPath-ws.path)"
# actualVCT=$(cat $(workspaces.volumeClaimTemplate-ws.path)/test)
# if [ "$actualVCT" != "volumeClaimTemplate-value" ]; then
# echo "VolumeClaimTemplate. Actual: $actualVCT. Expected: volumeClaimTemplate-value"
# exit 1
# fi
# echo $actualVCT

0 comments on commit 74fcc6d

Please sign in to comment.