Contributing

Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.

Contributions to this project are released to the public under the MIT license.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project, you agree to abide by its terms.

Contents

Submitting a pull request

  1. Fork and clone the repository.
  2. Create a new branch: git checkout -b my-branch-name.
  3. Make your changes, ensuring that they include steps to install, validate post-install, and update the software report (please see Adding a new tool to an image for details).
  4. Test your changes by creating an image and deploying a VM.
  5. Push to your fork and submit a pull request.

Here are a few things you can do that will increase the likelihood of your pull request being accepted:

Adding a new tool to an image

General rules

Windows

Ubuntu

macOS

The macOS source lives in this repository and is available for everyone. However, the macOS image-generation CI doesn't support external contributions yet, so we are not able to accept pull requests for now. We are in the process of preparing the macOS CI to accept contributions. Until then, we appreciate your patience and ask that you continue to make tool requests by filing issues.

Code style guide

The principles of clean code apply to all languages. The main points are:

File structure

Bash scripts

Naming convention for bash scripts

Bash script structure

Each script should start with the following shebang:

#!/bin/bash -e

TODO: do we need to set pipefail?

This will make the script exit if any command fails.

After the shebang, add a header with the following format:

################################################################################
##  File:  <filename>
##  Desc:  <short description of what the script does>
################################################################################

Then import helpers that are used in the script.

For Linux:

source $HELPER_SCRIPTS/os.sh
source $HELPER_SCRIPTS/install.sh
source $HELPER_SCRIPTS/etc-environment.sh

For macOS:

source ~/utils/utils.sh

[!NOTE] You don't need to import all helpers, only the ones that are used in the script.

After that, add the script code.

Indentations and line breaks in bash scripts

Other recommendations for bash scripts

PowerShell scripts

Naming convention for PowerShell scripts

PowerShell script structure

Each script should start with the following header:

################################################################################
##  File:  <filename>
##  Desc:  <short description of what the script does>
################################################################################

Then declare functions that are used in the script.

TODO: do we need to set the error action preference and progress preference?

$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"

For Linux and macOS, import helpers that are used in the script:

For Linux:

Import-Module "$env:HELPER_SCRIPTS/Tests.Helpers.psm1" -DisableNameChecking

For macOS:

Import-Module "$env:HOME/image-generation/helpers/Common.Helpers.psm1"
Import-Module "$env:HOME/image-generation/helpers/Xcode.Helpers.psm1" -DisableNameChecking

[!NOTE] You don't need to import all helpers, only the ones that are used in the script.

After that, add the script code.

Indentations and line breaks in PowerShell scripts

Other recommendations for PowerShell scripts

Resources