Skip to content

Latest commit

 

History

History
115 lines (87 loc) · 3.53 KB

LOCAL_DEVELOPMENT.md

File metadata and controls

115 lines (87 loc) · 3.53 KB

Local Development

Pre-Requisites

The following dependencies must be installed. Please refer to your operating system, how to install them.

Note: For Windows 10, we recommend enabling Windows Subsystem for Linux (WSL) and installing Linux distribution of your choice, for example, here are the instructions on how to install Ubuntu.

  • Python >=3.8 and pip
  • VirtualEnv
  • Go
  • Ruby >=2.6 and gem
  • cfn-nag

Here is an example how to install pre-requisites on macOS/Linux using Homebrew.

# install python3
brew install python

# install VirtualEnv
pip3 install virtualenv

# install go
brew install go

# install ruby, gem and cfn-nag
brew install ruby brew-gem
brew gem install cfn-nag

Build local development environment

Once you have installed pre-requisites, run commands below:

Step 1 - Clone the repository (Required)

In the first step, you will clone the repository.

  1. Clone the repository:
    $ git clone https://github.com/aws-samples/cfn101-workshop.git

Step 2 - make init (Required)

In the second step, you will use make to create a virtual environment.

  1. Initialize the local environment
    make init
  2. Activate VirtualEnv environment.
    source venv/bin/activate
  3. Run pre-commit tests for the first time to check the installation.
    make test

Run the local development utility (AWS employees only)

Follow the instructions for Local Development at Workshop Studio documentation.

Once you download binaries, and run preview server, the preview will be available at http://localhost:8080

Testing(Automated and Manual)

The repository has a GitHub actions set up which will run cfn-lint and cfn-nag tests on pull requests.

Furthermore, pre-commit configuration file is provided to format the code and content. See below various tests you can run locally when developing the labs.

  • make test - will run pre-commit tests. Useful to run before committing changes.
  • make lint - will run cfn-lint test against CloudFormation templates in /code/solutions directory.
  • make nag - will run cfn-nag test against CloudFormation templates in /code/solutions directory.

Versioning and releasing (Repo admin only)

The bump2version tool is used to take care of versioning including tagging a new versions.

When ready to publish new release follow the steps below:

# checkout and update main branch
git checkout main && git pull

# checkout feature branch
git checkout <feature-branch>

# merge main branch to feature branch
git merge main

# bump the version following semantic guide above part=patch|minor|major
make version part=minor

# push the new version tag to origin
make release

# merge the feature branch to main branch on github

Finally, create new release on cfn101-workshop release page

  • Select Releases and choose Draft a new release
  • Choose a tag version
  • Select Auto-generate release notes
  • Publish release

Troubleshooting

If you get an error installing rain

[INFO] Installing environment for https://github.com/aws-cloudformation/rain.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command:...

The default proxy.golang.org is blocked on your network. To fix it, run:

export GOPROXY=direct