Clone and edit the component repositories

First, we'll clone the component module, change to a new feature branch, and perform edits on the files in the repository. We'll ensure that we use a Git branch during development, so that we can send our code to the upstream Git repository without impacting the original code. We'll end this step with a new snapshot of code on a separate branch of an existing module, so that we can test this code in isolation. This set of steps is the general workflow for the following:

  1. Making a copy of the upstream repository for an individual module (git clone/pull)
  2. Creating a branch of the module, separate from the Master (git checkout)
  3. Making any and all edits to the code (IDE of choice)
  4. Creating a snapshot of the current state of the code (git add and commit)
  5. Sending the snapshot back to the upstream repository (git push)

In action, the code is as follows:

# Clone the remote git repository for the module. You can skip this step if the
# repository is already present on your local system
git clone [email protected]:puppet/module.git

# If the repository is already local on the system, we'll just want to update our
# local master branch
git pull origin master

# Check out a new environment based on the existing master branch, which is the
# default branch of a git repository, and the branch we should start on on a clone.
git checkout -b new_feature

# We'll edit some files to add new features

# Adding new paramters to init
vim manifests/init.pp - Adding new parameters to init
# Adding a new feature to config
vim manifests/config.pp
# Ensuring the new feature is represented in the deployed template
vim templates/file.epp

# Add all edited files to git staging, assuming you're at the base of the repository
git add .

# Add an atomic commit, not only describing what the commit is, but why it was done
git commit -m 'Added new code to support feature requested by client'

# Push this code back to the origin repository as the new branch
git push origin new_feature

Our edits are now in the upstream repository, in a new_feature branch. The master branch will continue to serve as a reference point for further development for others, and for testing in a staging environment. So that we can begin to test this code, we'll create a new Puppet environment, designed specifically for testing and iteration over this code set.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.27.244