Skip to content

Latest commit

 

History

History
177 lines (137 loc) · 6.71 KB

CONTRIBUTING.md

File metadata and controls

177 lines (137 loc) · 6.71 KB

Contributing to the Online DevOps Dojo training

We ❤️ Pull Requests for fixing or adding content. Thanks for your contribution!

For small changes, you can simply use the "Edit" button to update the Markdown file or any of the dialog, and start the pull request process easily. You can use the preview tab in GitHub to make sure that it is properly formatted before committing. Once the pull request is placed, review the results of the pipeline and correct any mistake that is reported.

If you plan to contribute often or have a larger change to make, it is best to setup an environment for contribution. This is what the rest of this page is about.

Development Environment Setup

This guide provides steps to setup a dedicated environment for DevOps Dojo development. It includes Git and Katacoda related instructions.

Prerequisites

Before you get started make sure to perform the one time setup:

Development Process

Steps below illustrate how to work on a new DevOps Dojo feature. See Katacoda and branches section for more details why the development is done directly on fork's master.

  1. Fetch latest changes from main repository:

    git fetch upstream
  2. Reset your fork's master branch to match exactly upstream master:

    git checkout master
    git reset --hard upstream/master
    git push --force

    IMPORTANT: Do it only once, when you start working on new feature as the above commands will overwrite completely your master content.

  3. Hack, hack, hack, and commit your changes to Git:

    # hack, hack, hack
    git add ...
    git commit ...
    git push
  1. Your changes should be visible in Katacoda at h​ttps://katacoda.com/<your_katacoda_user>

  2. To continue development of your feature:

    # hack, hack, hack
    git add ...
    git commit ...
    git push
  3. Open a new Pull Request to the main repository using your master branch

Katacoda and Branches

Katacoda only works with master branch. Therefore you will use your fork's master branch to preview your work in Katacoda. To make the Pull Requests and merges easier, at the beginning of each feature development we will reset your master to match exactly the master of the main repository.

If you have reasons to not reset your fork's master branch, you can use feature branches, and then merge their content to your master and create Pull Requests out of the feature branch:

git fetch upstream
git checkout -b feature-X upstream/master
# hack, hack, hack
git add ...
git commit ...
git checkout master
git merge feature-X
git push
# changes now visible in Katacoda
git checkout feature-X
git push -u origin feature-X
# you can now open a Pull Request to the main repository using feature-X branch
# finally once all done - delete the branch
git branch -d feature-X
git push --delete feature-X

GitHub Repository Clone

DevOps Dojo development is managed with one repository:

To prepare your dedicated GitHub repository:

  1. Fork in GitHub https://github.com/dxc-technology/online-devops-dojo

  2. Clone your forked repository (e.g., h​ttps://github.com/jdoe1000/online-devops-dojo ) to your workstation.

  3. Set your remotes as follows:

    cd online-devops-dojo
    git remote add upstream git@github.com:dxc-technology/online-devops-dojo.git
    git remote set-url upstream --push DISABLED

    Running git remote -v should give something similar to:

    origin  git@github.com:jdoe1000/online-devops-dojo.git (fetch)
    origin  git@github.com:jdoe1000/online-devops-dojo.git (push)
    upstream        git@github.com:dxc-technology/online-devops-dojo.git (fetch)
    upstream        DISABLED (push)
    

    The use of upstream --push DISABLED is just a practice preventing those with write access to the main repository from accidentally pushing changes there.

Katacoda Setup

https://katacoda.com is lab environment used by Online DevOps Dojo that allows students to have dedicated environments for their class right in the browser.

  1. Sign up for new account on https://katacoda.com
  2. If that is your first visit, go to Claim Your Profile page and provide your username and name. Make sure to SAVE and then abort GitHub configuration as it does not allow to configure a non-public repository.
  3. Go to Your Profile page and then click on Settings icon in the middle of the page
  4. Set Private Git Repository to Yes
  5. Set Git Scenario Repository to the address of your fork (e.g., h​ttps://github.com/jdoe1000/online-devops-dojo )
  6. Make sure to click on SAVE button
  7. Do not close this window as we will need the values from Git Deploy Key and Git Webhook Secret

GitHub Webhook Setup

We now need to configure GitHub repository hook so that Katacoda is notified each time you push updates to your repository.

  1. Open new browser window and go to your fork's URL (e.g., h​ttps://github.com/jdoe1000/online-devops-dojo )
  2. Open the repository Settings page tab and then Deploy keys (left navigation)
  3. Click on Add deploy key button and use the following information to set it up:
    • Title: katacoda.com
    • Key: paste the Git Deploy Key value from your Katacoda settings page
    • Allow write access: leave unchecked
  4. Click on Add deploy key button
  5. Click on Webhooks (left navigation)
  6. Click on Add webhook button and use the following information to set it up:
  7. Click on Add webhook button to create it

If all the setup is done correctly you should be able to access your Katacoda environment at:

h​ttps://katacoda.com/<your_katacoda_user>