Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'Extract Task spec' CodeAction #546

Merged
merged 3 commits into from
Apr 8, 2021
Merged

Add 'Extract Task spec' CodeAction #546

merged 3 commits into from
Apr 8, 2021

Conversation

evidolob
Copy link
Collaborator

@evidolob evidolob commented Apr 6, 2021

Fix: #511

Demo:

Screen.Recording.2021-04-06.at.16.17.16.mov

Signed-off-by: Yevhen Vydolob <yvydolob@redhat.com>
@evidolob evidolob self-assigned this Apr 6, 2021
@codecov-io
Copy link

codecov-io commented Apr 6, 2021

Codecov Report

Merging #546 (fcd7c71) into master (ecac5da) will increase coverage by 0.41%.
The diff coverage is 86.84%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #546      +/-   ##
==========================================
+ Coverage   68.22%   68.64%   +0.41%     
==========================================
  Files          97       97              
  Lines        5785     5874      +89     
  Branches     1019     1032      +13     
==========================================
+ Hits         3947     4032      +85     
- Misses       1838     1842       +4     
Impacted Files Coverage Δ
src/util/tekton-vfs.ts 86.40% <10.00%> (-8.22%) ⬇️
src/yaml-support/tkn-code-actions.ts 93.45% <93.81%> (+2.05%) ⬆️
src/model/pipeline/pipeline-model.ts 79.87% <100.00%> (+0.63%) ⬆️
src/model/pipeline/task-model.ts 64.28% <100.00%> (+28.28%) ⬆️
src/tkn.ts 74.57% <0.00%> (+0.07%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ecac5da...fcd7c71. Read the comment docs.

Signed-off-by: Yevhen Vydolob <yvydolob@redhat.com>
src/yaml-support/tkn-code-actions.ts Outdated Show resolved Hide resolved
const virtDoc = this.getDocForExtractedTask(name, type, action.taskSpecText);

const saveError = await tektonVfsProvider.saveTektonDocument(virtDoc);
if (saveError) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got error here error converting YAML to JSON: yaml: line 4: did not find expected key

virtDoc =

apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: new-task
  {}

spec:
  resources:
  inputs:
    - name: pipeline-git
      type: git
  outputs:
    - name: pipeline-git
      type: git
steps:
  - args:
      - '-c'
      - |
        ls -al $(resources.inputs.pipeline-git.path)
    command:
      - bash
    image: ubuntu
    name: list
    resources: {} 

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it should work

src/yaml-support/tkn-code-actions.ts Outdated Show resolved Hide resolved
Signed-off-by: Yevhen Vydolob <yvydolob@redhat.com>
@evidolob evidolob merged commit e838a14 into master Apr 8, 2021
@evidolob evidolob deleted the extract-task-spec branch April 8, 2021 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor inline Task to referenced Task or ClusterTask
4 participants