You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/configuration/cell-level.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ In this section, we will explain the various features of the cell-level option a
14
14
15
15
***Let’s dive in!***
16
16
17
-
### Different Types of Commands
17
+
### **Different Types of Commands**
18
18
19
19
Not all commands are equal, and expectations of how execution works can differ! For example, code blocks can be:
20
20
@@ -25,7 +25,7 @@ Not all commands are equal, and expectations of how execution works can differ!
25
25
26
26
However, Runme makes running such commands easy. It has sophisticated features that ensure commands and code are executed inside your Markdown file. In this section, we will explore how to run commands and code in one click and some features that make running commands at the cell level easier with Runme.
27
27
28
-
## How to Run a Cell In One Click
28
+
## **How to Run a Cell In One Click**
29
29
30
30
To run a cell block in your Markdown file:
31
31
@@ -38,11 +38,11 @@ This action will run your command and return an executed output.
38
38
39
39
You can configure how your cell should run using the configuration options. In the next section, we will be explaining how to configure your cell using the different cell-level options in Runme.
40
40
41
-
## Features of the Cell-Level Options
41
+
## **Features of the Cell-Level Options**
42
42
43
43
The cell-level option is designed with unique sub-features which makes it efficiently and gives users the flexibility to modify each cell to their preference. Some of these features include:
44
44
45
-
### 1. Configuration of Cell
45
+
### **Configuration of Cell**
46
46
47
47
Runme provides two distinct ways you can configure your cell.
48
48
@@ -87,7 +87,7 @@ Take a look at more [examples](https://github.com/stateful/vscode-runme/tree/mai
87
87
88
88
</Infobox>
89
89
90
-
### 2. Specify Language in Blocks
90
+
### **Specify Language in Blocks**
91
91
92
92
Runme, just like most Markdown viewers, will work best when a script's language is contained inside fenced code blocks.
93
93
@@ -117,7 +117,7 @@ While this works well in a lot of cases, the accuracy is not perfect.
117
117
118
118
</Infobox>
119
119
120
-
### 3. Handle long-running processes
120
+
### **Handle long-running processes**
121
121
122
122
It is common to use file-watcher-enabled compilers/bundlers (e.g., `npm start dev`, `watchexec`, etc.) in the background during development.
123
123
For any cell containing an instance of these commands, tick the background cell setting. This will prevent execution from permanently blocking the notebook UX.
In most cases, you should set the current working directory at the document level; however, you can also set it per cell.
143
143
@@ -164,7 +164,7 @@ Please note that if both `cwd` is set for doc-level and cell, they don't overw
164
164
165
165
</Infobox>
166
166
167
-
### 5. **Interactive vs non-interactive cells**
167
+
### **Interactive vs non-interactive cells**
168
168
169
169
If a cell's commands do not require any input from a reader it might be a good fit to include the cell's output inside the notebook. This is useful if the resulting output could be useful as input in a downstream cell. This is what `interactive=false` is for, and it defaults to *true*.
170
170
@@ -184,7 +184,7 @@ Please note that the Runme team is currently working on making output in both no
184
184
185
185
</Infobox>
186
186
187
-
### 6. **Set environment variables**
187
+
### **Set environment variables**
188
188
189
189
If a cell has exported variables, the user will be prompted to set these variables. This can be useful to have a parameterized cell while not needing to manually modify the cell.
190
190
@@ -223,7 +223,7 @@ export PROJECT_ID=Enter a valid project ID
223
223
cli make-call --project-id $PROJECT_ID describe
224
224
```
225
225
226
-
### 7. **Terminal visibility post-execution**
226
+
### **Terminal visibility post-execution**
227
227
228
228
A cell's execution terminal is auto-hidden unless it fails. This default behavior can be overwritten if keeping the terminal open is in the interest of the Runme notebook reader. Just untick `closeTerminalOnSuccess` (`false`).
229
229
@@ -236,7 +236,7 @@ A cell's execution terminal is auto-hidden unless it fails. This default behavio
236
236
docker ps | grep runme/demo:latest
237
237
```
238
238
239
-
### 8. **Human-friendly output**
239
+
### **Human-friendly output**
240
240
241
241
Not all cells’ output is plain text. For example, you can have JSON, text, images, etc, all in your Markdown file.
242
242
@@ -246,7 +246,7 @@ Using the `mimeType` specifier, you can specify the expected output type. Runm
246
246
247
247
See in the [reference page](../Reference/mime) for the list of supported MIME types!
248
248
249
-
### 9. **Terminal Row**
249
+
### **Terminal Row**
250
250
251
251
On Runme outputs are saved in lines also known as rows. The number of lines or rows in which an output should be rendered is defined by a setting known as Terminal row.
252
252
Terminal row allows you to set the number of rows with which your output should be displayed under a cell.
@@ -270,7 +270,7 @@ We have provided a list of configuration settings to upgrade your experience usi
270
270
271
271
- Lastly, set the number of rows you wish your output to be rendered in.
272
272
273
-
### 10. **Unnamed vs Named cells**
273
+
### **Unnamed vs Named cells**
274
274
275
275
On Runme cells are unnamed by default. However, you can name a cell directly in your notebook. This will enable you to easily identify the cell using the provided cell name. On the cell you wish to name, simply click on the “Add Name” button on the cell.
276
276
@@ -315,7 +315,7 @@ Take a look at more [examples](https://github.com/stateful/vscode-runme/tree/mai
315
315
316
316
</Infobox>
317
317
318
-
### 11. **Exclude Cell from Run All**
318
+
### **Exclude Cell from Run All**
319
319
320
320
Every VS Code notebook allows users to run all available cells. This can be useful if you define a complete runbook in your Markdown file, allowing developers to click the **Run All** button to get set up and running.
321
321
@@ -331,7 +331,7 @@ However, sometimes certain cells should be excluded from this workflow. You can
331
331
```
332
332
333
333
334
-
### 12. **Run All Cells by Category**
334
+
### **Run All Cells by Category**
335
335
336
336
If you have multiple workflows in a single Markdown file you can categorize them and allow your developers to run all cells by a certain category. To enable that you can add a category as a cell option. A cell can have one or multiple categories that are comma-separated.
As a system administrator, DevOps engineer, or developer, dealing with Bash scripts to automate tasks is a common part of your daily routine. To run Bash scripts conventionally, you need to create a `.sh` file for your scripts and ensure it begins with a shebang line (`#!`) to specify the interpreter.
5
+
Runme makes it easy to run bash scripts directly within your Markdown files. With Runme, you can create, manage, and run scripts to automate repetitive tasks, saving time and effort.
5
6
6
-
All these processes can be made easier with Runme. [Runme](https://runme.dev/) provides a convenient way to run scripts, code, and commands directly within Markdown files without having to worry about environment configurations.
7
+
This is not just limited to bash; [Runme](https://runme.dev/) supports scripting in various languages like PowerShell, Python, and more. This flexibility allows you to tailor automated solutions to your specific requirements.
8
+
9
+
In this guide, we will walk you through running a bash script on Runme.
7
10
8
-
In this guide, we will walk you through executing Bash scripts on Runme.
9
11
10
12
## **Setting Up Your Environment**
11
13
12
-
To get started with Bash scripts in Runme, you need to first install and configure Runme for VS Code. Follow the steps below to perform this task:
14
+
To get started with Bash scripts in Runme, you are required to first install and configure [Runme on your VS Code](https://docs.runme.dev/installation/installrunme) editor. If you do not have Runme on VS Code installed yet, proceed to the Extension tab of your VS Code and search for “**Runme DevOps Notebook**.”
13
15
14
-
- Install VS Code on your local machine
15
-
- Proceed to the extension tab of your VS Code dashboard which is on the left and search for Runme.

18
+
You can configure your code editor to make Runme your [default Markdown viewer](https://docs.runme.dev/installation/installrunme#how-to-set-vs-code-as-your-default-markdown-viewer). This means you `.md` will be displayed as a runbook whenever you open a Markdown.
19
19
20
20
## **Writing Your First Bash Script in Runme**
21
21
22
-
Runme integrates easily with Bash scripts via the [Shebang](https://docs.runme.dev/configuration/shebang) feature to execute them directly within Markdown files. The Shebang feature not only makes executing easier but also ensures complex processes are made simpler.
23
-
In this section, we will provide you with a step-by-step guide to creating a simple bash script within a Markdown file and executing it with Runme.
22
+
Runme integrates easily with Bash scripts via the [Shebang](https://docs.runme.dev/configuration/shebang) feature, which allows you to run any script you choose directly from the Markdown file in your preferred programming language.
23
+
24
+
This section will provide a step-by-step guide to creating a simple bash script within a Markdown file and executing it with Runme.
25
+
26
+
Let’s get started.
24
27
25
28
1. Create a new folder and open it with your VS code. In your VS code, create a new README.md file.
26
29
2. Click on the + Code icon
@@ -29,62 +32,66 @@ In this section, we will provide you with a step-by-step guide to creating a sim
29
32
30
33
3. Enter the script you want to run. For this tutorial, we will be using the simple bash script below.
Runme makes it incredibly easy! Previously, you would have to create a .sh file to execute bash scripts, but with Runme, you do not need to create a new file from scratch. All you need to do is install the Runme extension in VS Code, and you can save yourself the stress of environment issues, as bash scripts run swiftly in Runme regardless of your machine's environment and operating system.
45
54
46
-
Now you have seen how Runme makes this easy. Previously, to execute bash scripts, you would have to create a .sh file, but with Runme, you don’t need to create a new file or any other complex stuff. All you need to do is install the Runme extension in VS Code and save yourself the stress of environment issues as bash scripts run swiftly in Runme regardless of the environment and operating system of your machine.
55
+
Let’s dive into more advanced bash scripting actions.
47
56
48
57
## **Advanced Bash Scripting Techniques in Runme**
49
58
50
-
Bash scripts have several advanced techniques that can also be integrated with Rume for DevOps engineers and SREs. In this section, we will explore some of the advanced features of bash scripting and how they can be integrated with Runme.
59
+
Bash scripts have several advanced techniques that can be integrated with Rume. In this section, we will explore some of the advanced features of bash scripting and how they can be integrated with Runme.
60
+
61
+
***Variable Manipulation**:
62
+
63
+
Variable manipulation involves modifying or extracting parts of a variable’s value to suit your needs without changing the original data. This can be done and executed in your Markdown file without external dependencies.
64
+
65
+
The image below provides an example of how a user can manipulate variables in bash scripts in Runme and the corresponding output the user will get in the terminal.
Variable manipulation, which involves modifying or extracting parts of a variable’s value to suit your needs without changing the original data, can be done and executed in your Markdown file without any external dependencies. The image below gives an example of how a user can perform variable manipulation of Bash scripts in Runme and the corresponding output the user will get in the terminal.
72
+
If you have a series of conditional statements in a Bash script that you would love to execute, Runme makes this easy. All you need to do is create a .md file in your editor, enter your script, and click the Run cell button.
The image below shows how a conditional statement in a Bash script is executed in Runme in VS Code.
58
75
59
-
***Conditional Statements**
60
-
Suppose you have a series of conditional statements in a Bash script that you would love to execute, Runme makes this easy for you. All you need to do is create a READMe.md file in VS Code, enter your script, and click the run cell button. The image below is an example of how a conditional statement in Bash script is executed using Runme in VS Code.
You can use Runme to write several bash scripts that execute commands in Docker. For example, the script below manages a Docker container for an Nginx web server.
79
+
***Integrating Runme with Docker**:
80
+
You can use Runme to write several bash scripts that execute Docker commands. The script below manages a Docker container for an Nginx web server.
Efficiency, reliability, and scalability are three paramount keys to thriving in the site reliability engineering and DevOps space.
71
-
Leveraging Runme's features can provide these three keys and also significantly enhance the management and execution of Bash scripts, thereby simplifying your tasks and workflows. Here's how you can optimize Bash scripts for SRE tasks using Runme's key features:
84
+
### How to optimize Bash scripts using Runme's key features:
72
85
73
-
1. Archiving for Historical Reference and Audit Trails
74
-
Runme has an archiving feature that offers a structured approach to storing outputs generated from executed code. With this feature, you can create historical records and audit trails of previous script executions.
75
-
This feature also comes in handy for troubleshooting and performance analysis purposes. In addition, archived outputs are securely stored in the Runme cloud, which ensures accessibility and data integrity.
76
-
2. Lifecycle Identity for Versioning and Tracking
77
-
Runme’s lifecycle identity for versioning and tracking allows DevOps engineers and SREs to assign unique identifiers and versions to cells. This facilitates easy version control and tracking of script modifications over time.
86
+
-**Lifecycle Identity for Versioning and Tracking**
78
87
79
-
This feature greatly offers ease to users as monitoring of changes, identification of issues, and maintenance of documentation integrity become easier. By adopting lifecycle identity, Bash script execution becomes more manageable and maintainable.
88
+
Runme’s [lifecycle identity](https://docs.runme.dev/configuration/lifecycle-identity) for versioning and tracking enables you to assign unique identifiers and versions to cells. This will ensure easy version control and tracking of the script whenever an update is made.
80
89
81
-
3. Shebang Support for Seamless Integration and Execution
82
-
Runme's Shebang support enables the swift integration and execution of Bash scripts within Runme's environment. With this feature, SREs can specify the desired interpreter version and environment configurations directly within the script. This ensures consistency and compatibility across different environments, making Bash scripts more portable and reusable. Additionally, shebang support simplifies the execution process, allowing SREs to focus on the core tasks without worrying about setup or compatibility issues.
83
-
4. Auto-save feature and separate session outputs
84
-
The auto-save feature provides a uniform approach to task automation by ensuring that the history of the Markdown text and all cell output produced while running your file are preserved without manual intervention from you or your teammates.
90
+
-**Auto-save feature and separate session outputs**
85
91
92
+
The [auto-save](https://docs.runme.dev/configuration/auto-save) feature provides a uniform approach to task automation by ensuring that the history of the Markdown command and all cell output produced while running your file is stored without manual intervention.
86
93
87
-
The auto-save feature incorporates a separate session output method that securely saves when each cell was run, the time it took, and exit codes.
94
+
Runme auto-save incorporates a [separate session](https://docs.runme.dev/configuration/auto-save#session-outputs) output method that securely saves the time each cell was run and its exit codes. It stores this output in an external file for easy reference.
88
95
89
96
<br />
90
97
<Infoboxtype="sidenote"title="Note">
@@ -93,13 +100,13 @@ When working with this feature, you are not to push the session outputs to git o
93
100
94
101
</Infobox>
95
102
96
-
By strategically incorporating these features into Bash scripts, SREs can enhance productivity, reliability, and scalability in managing infrastructure and ensuring service availability. Whether it's troubleshooting incidents, automating routine tasks, or optimizing system performance, Runme empowers SREs to tackle challenges with confidence and efficiency.
103
+
Incorporating these features into your bash scripts simplifies your automation process, reduces scalability in managing infrastructure, and ensures service availability, whether troubleshooting incidents, automating routine tasks, or optimizing system performance.
97
104
98
-
## **Conclusion**
99
-
Using Runme to execute your Bash scripts makes execution time faster and provides more ease for you. In this tutorial, we considered how you can execute your first bash script in Runme, advanced Bash scripts you can execute in Runme, and lastly, features in Runme that make the execution of tasks as an SRE expert, DevOps engineer, or system administrator easier.
100
-
You can take a look at our [tutorial page](https://docs.runme.dev/guide/) to find out more ways you can use Runme to make your task seamless.
101
105
106
+
### Conclusion
102
107
108
+
Using Runme to execute your Bash scripts automates your process, whether it is a development, testing, or deployment task. This enables you to avoid repetitive tasks and environment compatibility issues. In this tutorial, we delved into how you can execute your first Bash script in Runme, advanced Bash scripts you can execute in Runme, and lastly, features in Runme that make the execution of tasks as an SRE expert, DevOps engineer, or system administrator easier.
103
109
104
110
111
+
You can easily integrate Runme with your favourite cloud native tools. Take a look at our [tutorial page](https://docs.runme.dev/guide/) to learn more ways to use Runme to make your tasks seamless.
0 commit comments