The purpose of this assignment is to ensure you have the foundational skills required for this course. These include basic familiarity with version control, programming, and containerization. Please make sure that you complete this assignment before the add/drop date or you might struggle to keep up with the class.
In this assignment, you will:
- Clone a repository to your local machine.
- Install and set up Docker (which is required for all subsequent assignments).
- Edit a simple C program.
- Use a Docker container to compile and run the C program.
- Push a signed commit with your updates to GitHub.
- Clone the homework repository to your local machine:
git clone <repository-url> cd <repository-name>
- Navigate to the
HW0directory:cd HW0
- Install Docker by following the instructions for your operating system:
- Verify the installation:
You should see the Docker version printed to the terminal.
docker --version
- Open
homework0.cin your preferred text editor. - Replace the placeholder email address in the program with your actual email:
const char EMAIL_ADDRESS[] = "your_email@domain.com";
- Save your changes.
-
Build the Docker image:
docker build -t hw0_image .This will compile your program inside a Docker container.
-
Run the Docker container to execute your program:
docker run --rm hw0_image
You should see the output displaying your email address and a "flag" generated by hashing your email with a salt.
-
If you need to rebuild or destroy a Docker image (for example, after making significant code changes), use the following commands:
- To remove the Docker image:
docker rmi hw0_image
- To rebuild the image:
docker build -t hw0_image .
- To remove the Docker image:
-
Configure Git to sign commits if you haven’t already:
- Generate a GPG key if you don’t have one:
gpg --full-generate-key
- Add the key to your GitHub account by following the GitHub GPG guide.
- Configure Git to use your key:
git config --global user.signingkey <your-gpg-key-id> git config --global commit.gpgsign true
- Generate a GPG key if you don’t have one:
-
Stage and commit your changes:
git add HW0/homework0.c git commit -S -m "Updated email address for Homework 0" -
Push your changes to GitHub:
git push origin main
- Salt File (
assignment_salt.txt):- For testing locally, a
assignment_salt.txtfile is provided with a dummy salt value. You do not need to modify or worry about this file. - During grading, a separate salt file will be used to ensure your program works correctly in a different environment.
- For testing locally, a
- Verify that your repository on GitHub reflects the updated
homework0.cfile. - Confirm that your commit is signed and verified on GitHub (look for the "Verified" badge next to your commit).
- Docker Installation Issues: Refer to the official Docker documentation for troubleshooting installation problems.
- GPG Signing Issues: Ensure your GPG key is correctly configured and added to GitHub.
- Compilation Errors:
Double-check your syntax in
homework0.c. Ensure you’ve replaced the placeholder email with your actual email address. - Rebuilding Docker Images:
If your code changes are not reflected, rebuild the Docker image using:
docker build -t hw0_image .
Your instructor will pull your repository to verify the following:
- The updated
homework0.cfile with your email address. - A signed commit pushed to GitHub.
Make sure everything is correct before the due date. If you encounter issues, reach out to the course staff for assistance.