mirror of
https://github.com/tektoncd/catalog.git
synced 2024-11-25 06:17:50 +00:00
1.1 KiB
1.1 KiB
Write a file to a workspace
This task can be used to write a file onto the output workspace. Use parameter expansion to insert variable content into the written file. It can also set specific permissions on the file.
Install the Task
kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/write-file/0.1/write-file.yaml
Parameters
- path: Relative path to create within the workspace. Directories will be created as necessary.
- mode: chmod-style mode string to apply to the file. Note that mode will not be applied to created directories.
- contents: Contents of the file to create. Note that octal numbers need quoting in YAML.
Usage
This example task generates a random password from the pipeline run's unique id.
- name: output-credentials
taskRef:
name: write-file
kind: Task
workspaces:
- name: output
workspace: shared-workspace
params:
- name: path
value: ./config/login.ini
- name: mode
value: "0400"
- name: contents
value: |
[credentials]
user = ze-user
password = $(context.pipelineRun.uid)