Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lab1 #80

Open
wants to merge 33 commits into
base: purelab
Choose a base branch
from
Open

Lab1 #80

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
80bbdbb
circleci default config
Sep 29, 2018
ce1fcea
circleci default config
Sep 29, 2018
97da547
Update LAB.md
tangollama Oct 2, 2018
37be3c8
Update LAB_INSTRUCTIONS.md
tangollama Oct 2, 2018
59ef18a
Update LAB_INSTRUCTIONS.md
tangollama Oct 2, 2018
d36ad90
Update LAB.md
tangollama Oct 2, 2018
1949d2a
Update LAB_INSTRUCTIONS.md
tangollama Oct 2, 2018
37393ae
Bug fixed
tangollama Oct 2, 2018
7aaa9f3
Update LAB_INSTRUCTIONS.md
tangollama Oct 2, 2018
347bd50
Update LAB_INSTRUCTIONS.md
tangollama Oct 2, 2018
2f01bf4
Update LAB_INSTRUCTIONS.md
tangollama Oct 2, 2018
a4096db
Create README.md
tangollama Oct 3, 2018
dabceca
Merge pull request #24 from tangollama/circleci
tangollama Oct 5, 2018
8c38613
Initial commit of labreport with @tangollama
trevordbunch Sep 26, 2019
1ead543
remove LAB.md
trevordbunch Sep 26, 2019
a9c1de6
Complete Step 1, 2 and 3 of LAB_TREVORDBUNCH
trevordbunch Sep 26, 2019
dbf826a
Answer Step 4
trevordbunch Sep 26, 2019
ec18770
Add Images
trevordbunch Sep 26, 2019
47e83cd
Add images to LabReport
trevordbunch Sep 26, 2019
eafe253
Adjust submitting instructions
trevordbunch Jan 24, 2021
13e571f
Update Lab readme, instructions and templates
trevordbunch Feb 15, 2021
1fe415c
Merge pull request #1 from trevordbunch/labreport
trevordbunch Feb 15, 2021
050b420
Merge pull request #2 from trevordbunch/main
trevordbunch Feb 15, 2021
0e3ae4c
Reset purelab
trevordbunch Feb 15, 2021
d4f22eb
Update repo branch names
trevordbunch Feb 17, 2021
f8513e0
Update Node links to Instructions
trevordbunch Feb 17, 2021
fa4fc85
Update Instructions
trevordbunch Mar 5, 2021
2e92bd8
Fixed typos and links in markdown files
JeffSinsel Jan 31, 2023
94babae
Merge pull request #59 from JeffSinsel/purelab
trevordbunch Feb 2, 2023
a4ac3c2
d
JG1579 Mar 10, 2023
0f30c85
Update config.yml
JG1579 Mar 10, 2023
3cc0717
Update config.yml
JG1579 Mar 10, 2023
080cde8
Update LAB_[Jg1579].md
JG1579 Mar 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
version: 2.1
jobs:
# running commands on a basic image
Hello-World:
docker:
- image: alpine:3.15
auth:
username: mydockerhub-user
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
steps:
- run:
name: Saying Hello
command: |
echo 'Hello World!'
echo 'This is the delivery pipeline'
# fetching code from the repo
Fetch-Code:
docker:
- image: cimg/base:2021.04
auth:
username: mydockerhub-user
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
steps:
- checkout
- run:
name: Getting the Code
command: |
ls -al
echo '^^^Your repo files^^^'
# running a node container
Using-Node:
docker:
- image: cimg/node:17.2
auth:
username: mydockerhub-user
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
steps:
- run:
name: Running the Node Container
command: |
node -v
Now-Complete:
docker:
- image: alpine:3.15
auth:
username: mydockerhub-user
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
steps:
- run:
name: Approval Complete
command: |
echo 'The work is now complete.'
workflows:
Example-Workflow:
jobs:
- Hello-World
- Fetch-Code:
requires:
- Hello-World
- Using-Node:
requires:
- Fetch-Code
- Hold-for-Approval:
type: approval
requires:
- Using-Node
- Fetch-Code
- Now-Complete:
requires:
- Hold-for-Approval
76 changes: 37 additions & 39 deletions labreports/LAB_INSTRUCTIONS.md → LAB_INSTRUCTIONS.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
# CIS 411 Lab 0: GitHub + CircleCI
The purpose of this lab is to both impart/confirm a level of professional comfort working with tools like GitHub and CircleCI as well as to invite a student to consider what precisely is happening conceptually and actually (behind the scenes) in the execution of the lab.
# Lab Instructions

## Submitting work
Lab reports will be submitted by generating a markdown file in the labreports directory under the naming convention: **LAB_[GITHUB HANDLE].md**, and submitting a Pull Request to this repository that include your lab report as well as any accompanying images/files (there are diagrams required in the lab content).

* Throughout these instructions, you'll find that **items marked in bold text** reference content you are to submit in your lab report.
* For the purposes of clear communication, you may base your lab report off of the template found in [LAB.md](LAB.md), but you're also free, welcome, and encouraged to get more creative.
* If you are unfamiliar with markdown, I recommend checking [1000 places on the Interwebs](http://lmgtfy.com/?q=learn+markdown) that will help you close that gap.

# Step 0: Create a GitHub account++
## Step 0: Create a GitHub account++
1. If you don't have a GitHub account already, [create one](https://github.com/join). If you do, **record the name of your handle in your lab report** and **record a link to one repository you either follow or star**.
2. If you don't already have _git_ installed on your development machine, [do so](https://git-scm.com/downloads).
3. Install a text editor or some sort of application for local development. Lately, I'm partial to [Visual Studio Code](https://code.visualstudio.com/) and my instructions assume it's use, but you're welcome to diviate. _Each one should choose their own sword, etc. etc._
3. Install a text editor or some sort of application for local development. Lately, I'm partial to [Visual Studio Code](https://code.visualstudio.com/) and my instructions assume it's use, but you're welcome to deviate. _Each one should choose their own sword, etc. etc._
4. To run the project in Step 2, you'll need to have [node.js](https://nodejs.org/en/download/) and [npm](https://docs.npmjs.com/cli/install) installed.

# Step 1: Fork this repository
1. After logging in, navigate to the [root](https://github.com/tangollama/cis411_lab0) of this repository.
## Step 1: Fork this repository
1. After logging in, navigate to the [purelab branch root](https://github.com/trevordbunch/cis411_lab1_CI/tree/purelab) of this repository.
2. Fork this repository to your personal GitHub account (hint: read the page).
3. **Record the URL to your forked repo in your lab report.**
4. **Generate a simple diagram** (in Google Draw or your favorite diagramming tool) that demonstrates the relationship between _this_ repository and my account (tangollama) with your account and your newly forked repository. (i.e. Is this the same thing as a source control branch or is there something unique about a fork in a distributed version control system? _Hint... I'm asking for a reason._)
4. **Generate a simple diagram** (in Google Draw or your favorite diagramming tool) that demonstrates the relationship between _this_ repository and my account (trevordbunch) with your account and your newly forked repository. (i.e. Is this the same thing as a source control branch or is there something unique about a fork in a distributed version control system? _Hint... I'm asking for a reason._ If it's helpful, think about the relationship you and another student who is conducting the fork command each has to this repository.)

# Step 2: Clone your forked repository from the command line
## Step 2: Clone your forked repository from the command line
1. Navigate to your forked repository in your GitHub account and copy the reference to your repository in from the <button class="btn btn-sm btn-primary">Clone or Download</button> button.
2. Open the terminal or command line interface on your development machine, navigate to your chosen working directory, and execute the following command: ```git clone [YOUR COPIED GITHUB CLONE REFERENCE]```.
3. Navigate to that directory ```cd cis411_lab0```.
2. Open the terminal or command line interface on your development machine, *navigate to your chosen working directory*, and execute the following command: ```git clone [YOUR COPIED GITHUB CLONE REFERENCE]```.
3. Navigate to that directory ```cd cis411_lab1_CI```.

## Step 3: Run the application locally
1. If you haven't already - make sure that you have installed [node.js](https://nodejs.org/en/download/) and [npm](https://docs.npmjs.com/cli/install)
4. Run ```npm install``` and watch the magic happen.
5. Run ```npm start``` and navigate to http://localhost:4000/graphql.
6. Run the following GraphQL mutation in GraphiQL and **record the response**.
6. Run the following GraphQL mutation in GraphQL and **record the response**.
```
mutation {
mutateAccount(input: {
Expand All @@ -40,47 +35,50 @@ mutation {
}
}
```
Use Ctrl+C or Cmd+C to exit out of the node application within the terminal.

# Step 3: Creating a feature branch
## Step 4: Creating a feature branch
[Branching and merging](https://www.atlassian.com/agile/software-development/branching) is a common tactic used in change management and feature development. We're going to use a branch (and eventually a merge) to build our lab report.
1. Create the branch ```git branch -c labreport```.
2. Create a lab report mardown file (ex. ```cp labreports/LAB.md labreports/LAB_[GITHUB USERNAME].md``` ).
3. Add the file to your branch ```git commit -a -m "your commit and reference @tangollama in the message"```.
4. Push the change to GitHub ```git push -u origin labreport```.
5. As you make additional changes to the lab report, commit and push at least one more change to the branch.
6. **Add the output of your git commit log** for your feature branch to your lab report ```git log --oneline```.
1. Create the branch ```git checkout -b labreport```.
2. Create a lab report markdown file (ex. ```cp labreports/LAB_Template.md labreports/LAB_[GITHUB USERNAME].md``` ).
3. Add your lab report ```git add *```
4. Add the file to your branch ```git commit -a -m "your commit and reference @trevordbunch in the message"```.
5. Push the change to GitHub ```git push -u origin labreport```.
6. As you make additional changes to the lab report, commit and push at least one more change to the branch.
7. **Add the output of your git commit log** for your feature branch to your lab report ```git log --oneline```.
8. **Generate a simple diagram** that demonstrates the relationship between your main and feature branch in your forked repository.

# Step 4: Setup a Continuous Integration configuration
1. [Signup for CircleCI](https://circleci.com/signup/) with your GitHub account.
2. Login to CircleCI and add your project to your account (ex. https://circleci.com/add-projects/gh/[YOUR GITHUB HANDLE]) by clicking _Add Project_.
## Step 5: Setup a Continuous Integration configuration
1. [Sign up for CircleCI](https://circleci.com/signup/) with your GitHub account.
2. Login to CircleCI and add your project to your account (ex. https://circleci.com/add-projects/gh/[YOUR_GITHUB_HANDLE]) by clicking _Add Project_.
3. Follow the setup instructions, including creating the .circleci directory and adding the default config.yml file.
![CircleCI setup](../assets/circleci_setup.png "CircleCI Setup")
![CircleCI setup](assets/circleci_setup.png "CircleCI Setup")
- Create a directory name .circleci in your project ```mkdir .circleci```.
- Add a file to that directory named config.yml ```code .circleci/config.yml```.
- Copy the content for the setup instructions into config.yml.
4. **Document in your lab report** what your .circleci/config.yml is doing in as much detail as you can determine. A diagram is not required but is highlt encouraged. **Additionally, answer the following questions.**
4. **Document in your lab report** what your .circleci/config.yml is doing in as much detail as you can determine. A diagram is not required but is highly encouraged. **Additionally, answer the following questions.**
- What do the various sections on the config file do?
- When a CI build is successful, what does that philosophically and practically/precisely indicate about the build?
- If you were to take the next step and ready this project for Continuous Delivery, what additional changes might you make in this configuration (conceptual, not code)?

# Step 5: Merging the feature branch
## Step 6: Merging the feature branch
1. Commit your changes to your feature branch ```git commit -a -m "your commit message```.
2. Switch to the master branch ```git checkout master```.
2. Switch to the main branch ```git checkout main```.
3. Merge the changes from your feature branch ```git merge labreport```.
4. **Add the output of your git commit log** from master to your lab report ```git log --oneline```.
4. **Add the output of your git commit log** from main to your lab report ```git log --oneline```.
5. Validate that your CircleCI build is running doing so successfully, **by grabbing a screenshot of the _Jobs_ list in CircleCI and including it in your report**.

# Step 6: Submitting a Pull Request
Once you've completed your report markdown, have ensured that your forked repository is successfully running in CircleCI, and have committed all your changes to your (primary) master branch, initiate a Pull Request in GitHub to submit your Lab Report.
1. Navigate to the root of your forked repository (ex. https://github.com/YOURHANDLE/cis411_lab0).
## Step 7: Submitting a Pull Request
Once you've completed your report markdown, have ensured that your forked repository is successfully running in CircleCI, and have committed all your changes to your (primary) main branch, and `push` your updated main branch back to Github, and then initiate a Pull Request in GitHub to submit your Lab Report.
1. Navigate to the root of your forked repository (ex. https://github.com/YOURHANDLE/cis411_lab1_CI).
2. Click the _New pull request_ button.
3. Choose the base fork _tangollama/cis411_lab0_ is the target and that your fully updated _master_ branch is the source.
3. Choose the base fork _trevordbunch/cis411_lab1_ is the target and that your fully updated _main_ branch is the source.
4. Enter a title and description for the Pull Request (PR), **referencing at least one other student in the content via their GitHub handle**, and submit the PR.

# Step 7: [EXTRA CREDIT] Augment the core project
# Step 8: [EXTRA CREDIT] Augment the core project
For the purposes of gaining 10%, 20% _or even more extra credit_ on the assignment, perform any of the following:
1. Add one or more unit tests to the core assignment project.
2. Configure the CircleCI config.yml to automatically build a Docker image of the project.
3. Configure an automatic deployment of the successful CircleCI build to an Amazon EC2 instance.

**Note this work in your lab report** by submitting it in your PR and linking to either the PR or the specific commit as recorded in GitHub in your lab report.
**Note this work in your lab report** by submitting it in your PR and linking to either the PR or the specific commit as recorded in GitHub in your lab report.
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# CIS 411 Lab 1: Continuous Integration
This is the Continuous Integration for CIS 411: Systems Analysis and Design for [Messiah University](http://messiah.edu)

This lab has four purposes:
1. Within Systems Analysis and Design, you are going to need to articulate a DEVOPs process that includes **Continuous Integration (CI)**, practice of merging all developers' working copies to a shared mainline several times a day,[^1] and be able to describe what is conceptually happening behind the scenes.
2. Develop a comfort using CI tools, such as CircleCI.
3. Read installation requirements to get a system running locally, so that you learn how to contribute and test locally.
4. To ensure that you are only accepting code that works within your repository, you will apply knowledge of spinning up a local environment into CI test condition.

# Doing the Lab
## 1. Pre-Requisites
1. GitHub account
2. Git is installed on your development machine.
3. Text editor or other integrated development environment (IDE) for modifying code.
4. Install [node.js](https://nodejs.org/en/download/) and [npm](https://docs.npmjs.com/cli/install) (STEP 3 in the Lab Instructions).
5. CircleCI account (STEP 5 in the Lab Instructions)

## 2. Lab Description
Within this lab, you will need to fork a repository that has a simple node / graphql application. After confirming that you can successfully run and perform simple actions within the application, then you will configuration CircleCI to perform a test that the application did not break with any changes in the commit before allowing the code into the repository.

Detailed instructions are [here](LAB_INSTRUCTIONS.md), and you are expected to compile your findings into a labreport following this [template](labreports/LAB_Template.md).

## 3. Submissions
You are expected to create a lab report as a markdown file under the labreports directory using the **LAB_[GITHUB Handle].md** naming convention in your forked repository. After you have reviewed your work, then you should submit a `Pull Request` to this repository with your lab report and any accompanying images/files (e.g., required diagrams). Add the `Pull Request` URL into the courseroom LMS (Canvas) for grading.

# Resources
Lab Specific Help.
- [Detailed instructions](LAB_INSTRUCTIONS.md)
- [Lab template](labreports/LAB_Template.md)

Node
- Node Download [https://nodejs.org/en/download/](https://nodejs.org/en/download/)
- Node Package Manager [https://docs.npmjs.com/cli/install](https://docs.npmjs.com/cli/install)
- Checking Node Versions [https://docs.npmjs.com/downloading-and-installing-node-js-and-npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)

Footnotes
[^1]: Fowler, M. *Continuous Integration.* Retrieved from https://martinfowler.com/articles/continuousIntegration.html

CircleCi
- [CircleCI Documentation](https://circleci.com/docs/)
- [Writing YAML](https://circleci.com/docs/2.0/writing-yaml/)
# License
This content is provided under the `MIT` [license](LICENSE).

# Credits
Special thanks to Joel Worrall, aka [tangollama](https://github.com/tangollama), for co-developing this course and writing the original version of this lab [https://github.com/tangollama/cis411_lab0](https://github.com/tangollama/cis411_lab0).
Binary file added assets/circleci_success.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 0 additions & 57 deletions labreports/LAB.md

This file was deleted.

Loading