Skip to content

Commit 4149bca

Browse files
authored
Merge pull request #337 from stateful/T-iteration3
T iteration3
2 parents d9d24fd + cf643c6 commit 4149bca

18 files changed

+68
-228
lines changed

docs/configuration/cell-level.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ In this section, we will explain the various features of the cell-level option a
1414

1515
***Let’s dive in!***
1616

17-
### Different Types of Commands
17+
### **Different Types of Commands**
1818

1919
Not all commands are equal, and expectations of how execution works can differ! For example, code blocks can be:
2020

@@ -25,7 +25,7 @@ Not all commands are equal, and expectations of how execution works can differ!
2525

2626
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.
2727

28-
## How to Run a Cell In One Click
28+
## **How to Run a Cell In One Click**
2929

3030
To run a cell block in your Markdown file:
3131

@@ -38,11 +38,11 @@ This action will run your command and return an executed output.
3838

3939
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.
4040

41-
## Features of the Cell-Level Options
41+
## **Features of the Cell-Level Options**
4242

4343
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:
4444

45-
### 1. Configuration of Cell
45+
### **Configuration of Cell**
4646

4747
Runme provides two distinct ways you can configure your cell.
4848

@@ -87,7 +87,7 @@ Take a look at more [examples](https://github.com/stateful/vscode-runme/tree/mai
8787
8888
</Infobox>
8989
90-
### 2. Specify Language in Blocks
90+
### **Specify Language in Blocks**
9191
9292
Runme, just like most Markdown viewers, will work best when a script's language is contained inside fenced code blocks.
9393
@@ -117,7 +117,7 @@ While this works well in a lot of cases, the accuracy is not perfect.
117117
118118
</Infobox>
119119
120-
### 3. Handle long-running processes
120+
### **Handle long-running processes**
121121
122122
It is common to use file-watcher-enabled compilers/bundlers (e.g., `npm start dev``watchexec`, etc.) in the background during development.
123123
For any cell containing an instance of these commands, tick the background cell setting. This will prevent execution from permanently blocking the notebook UX.
@@ -137,7 +137,7 @@ npm run watch
137137
138138
![background](../../static/img/configuration-page/background-task.png)
139139
140-
### 4. **Cell's current working directory**
140+
### **Cell's current working directory**
141141
142142
In most cases, you should set the current working directory at the document level; however, you can also set it per cell.
143143
@@ -164,7 +164,7 @@ Please note that if both `cwd` is set for doc-level and cell, they don't overw
164164
165165
</Infobox>
166166
167-
### 5. **Interactive vs non-interactive cells**
167+
### **Interactive vs non-interactive cells**
168168
169169
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*.
170170
@@ -184,7 +184,7 @@ Please note that the Runme team is currently working on making output in both no
184184
185185
</Infobox>
186186
187-
### 6. **Set environment variables**
187+
### **Set environment variables**
188188
189189
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.
190190
@@ -223,7 +223,7 @@ export PROJECT_ID=Enter a valid project ID
223223
cli make-call --project-id $PROJECT_ID describe
224224
```
225225
226-
### 7. **Terminal visibility post-execution**
226+
### **Terminal visibility post-execution**
227227
228228
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`).
229229
@@ -236,7 +236,7 @@ A cell's execution terminal is auto-hidden unless it fails. This default behavio
236236
docker ps | grep runme/demo:latest
237237
```
238238
239-
### 8. **Human-friendly output**
239+
### **Human-friendly output**
240240
241241
Not all cells’ output is plain text. For example, you can have JSON, text, images, etc, all in your Markdown file.
242242
@@ -246,7 +246,7 @@ Using the `mimeType` specifier, you can specify the expected output type. Runm
246246
247247
See in the [reference page](../Reference/mime) for the list of supported MIME types!
248248
249-
### 9. **Terminal Row**
249+
### **Terminal Row**
250250
251251
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.
252252
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
270270
271271
- Lastly, set the number of rows you wish your output to be rendered in.
272272
273-
### 10. **Unnamed vs Named cells**
273+
### **Unnamed vs Named cells**
274274
275275
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.
276276
@@ -315,7 +315,7 @@ Take a look at more [examples](https://github.com/stateful/vscode-runme/tree/mai
315315
316316
</Infobox>
317317
318-
### 11. **Exclude Cell from Run All**
318+
### **Exclude Cell from Run All**
319319
320320
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.
321321
@@ -331,7 +331,7 @@ However, sometimes certain cells should be excluded from this workflow. You can
331331
```
332332
333333
334-
### 12. **Run All Cells by Category**
334+
### **Run All Cells by Category**
335335
336336
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.
337337

docs/guide/bashscripting.md

Lines changed: 53 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
# Running Bash Scripts in Runme
22

3+
Looking to automate your workflow?
34

4-
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.
56

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.
710

8-
In this guide, we will walk you through executing Bash scripts on Runme.
911

1012
## **Setting Up Your Environment**
1113

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**.”
1315

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.
16-
- Now click install
16+
![install runme](../../static/img/guide-page/runme-notebooks.png)
1717

18-
![installation of runme](../../static/img/guide-page/runme-notebook.png)
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.
1919

2020
## **Writing Your First Bash Script in Runme**
2121

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.
2427

2528
1. Create a new folder and open it with your VS code. In your VS code, create a new README.md file.
2629
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
2932

3033
3. Enter the script you want to run. For this tutorial, we will be using the simple bash script below.
3134

32-
![scripting-exam](../../static/img/guide-page/scripting-output.png)
35+
![scripting-outputs](../../static/img/guide-page/scripting-outputs.png)
3336

34-
4. Click on Select Cell Language Mode and search for Shell script.
37+
4. Click on the programming language at the button of the cell. This will display a list of supported languages. .
3538

36-
![cell language](../../static/img/guide-page/laguagemode.png)
3739

38-
5. Now click on the Run button beside your script to execute it.
40+
![cell language](../../static/img/guide-page/language-mode.png)
41+
42+
5. Search for Shell script.
43+
44+
6. Now click on the Run button beside your script to execute it.
3945

4046
![run codeblock](../../static/img/guide-page/executionpromt.png)
4147

42-
You have successfully executed your first bash script with Runme
48+
After an execution time of 2.3 seconds, you will get a similar output:
49+
50+
![run-code](../../static/img/guide-page/runme-users.png)
51+
You have successfully executed your first bash script with Runme!🎉
4352

44-
![run-code](../../static/img/guide-page/runme-user.png)
53+
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.
4554

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.
4756

4857
## **Advanced Bash Scripting Techniques in Runme**
4958

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.
66+
67+
68+
![example](../../static/img/guide-page/var-maniuplation.png)
5169

52-
Shall we?
70+
* **Conditional Statements**:
5371

54-
* **Variable Manipulation**
55-
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.
5673

57-
![example](../../static/img/guide-page/variable-manipulation.png)
74+
The image below shows how a conditional statement in a Bash script is executed in Runme in VS Code.
5875

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.
6176

62-
![if-statement](../../static/img/guide-page/if-statement.png)
77+
![if-statement](../../static/img/guide-page/ifstatement.png)
6378

64-
* **Integrating Runme with Docker**
65-
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.
6681

67-
![bash-docker](../../static/img/guide-page/bash-docker.png)
82+
![bash-docker](../../static/img/guide-page/docker-bash.png)
6883

69-
* **Strategies for leveraging Runme’s features**
70-
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:
7285

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**
7887

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.
8089

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**
8591

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.
8693

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.
8895

8996
<br />
9097
<Infobox type="sidenote" title="Note">
@@ -93,13 +100,13 @@ When working with this feature, you are not to push the session outputs to git o
93100

94101
</Infobox>
95102

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.
97104

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.
101105

106+
### Conclusion
102107

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.
103109

104110

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.
105112

0 commit comments

Comments
 (0)