Assignment Submission Reference

Contents:

Turning in your assignment

Step 1. Commit all your code

See the version control handout for details on how to do this.

Step 2. Create a tag marking your most recent commit.

To turn in your assignment:

To create a tag, use the VCS > Git > Tag... option in IntelliJ. By default, the tag is placed on the most recent commit that you've made. This means that, when you're placing a tag, you should make sure you've committed all your work so the TA will see your complete assignment. We will grade all work up-to and including the work done in the commit that's tagged.

At the bottom of each assignment, we specify a specific tag name that you need to use to mark your final submission for that assignment. You must use the correct tag name, or your assignment has not been submitted. Tags are case-sensitive.

When you create a tag, DO NOT add a message. Adding a tag message changes what kind of tag is created, and can cause problems later on. You should name the tag appropriately, but leave the tag message blank.

Step 3. Pushing a Tag to GitLab

When you create a tag, it's created in your local repository only, just like commits. In order to let GitLab know that you made a new tag, you need to push the tag, just like commits! Unfortunately, tags aren't included in a normal push, so we need to do something slightly different to push a tag. Use the VCS > Git > Push... window like normal, but make sure the "Push Tags" checkbox in the bottom left is checked. If not, you won't push tags to GitLab and we won't be able to find your final assignment!

The above works just like a normal git push, except it also includes tags in the push. Be sure that tags are pushed, so the TA can find your assignment when we get to grading!

Step 4. Double-Checking Your Assignment

You are responsible for ensuring that your submission appears in the gitlab repository (with the appropriate tag) as you intended it. We will only grade what appears in gitlab, not what is on another machine.

Here are some additional checks that you can perform to ensure that this is the case. The first item will catch most problems. The second, while more time consuming, is more foolproof.

  1. Check the status of your gitlab runner. The runner runs each time you push the final tag for an assignment. Browse to https://gitlab.cs.washington.edu/cse331-QUARTER-students/cse331-QUARTER-MyCSENetId/pipelines to see the pipelines for your repository. Look for the pipeline marked with the assignment you just submitted. If there's a green check-mark, the pipeline has passed. If there's a red X, the pipeline has failed. Click the red X for details about the failure, fix whatever caused the issue, and re-submit your assignment.
  2. Check that everything is properly stored and tagged in your repository
    • Login to attu. See the software setup handout for details on how to do this.
    • (First time only) Set up the ssh key on attu.
      1. Generate an RSA key pair.

        bash$ ssh-keygen -o -t rsa -b 4096 -C "your@email.com" 
        

        • Press enter when asked for a file name (use default)
        • No passphrase
        • You’ll be told: “Your public key has been saved in (…)”
      2. Copy the the generated public key - run the below command and then copy its output.

        bash$ cat ~/.ssh/id_rsa.pub   
        

      3. Paste that into your GitLab account, under “Profile” -> “Settings” -> “SSH Key”. Sign in at Gitlab.
    • Clone a fresh copy of your project and checkout the commit with a specific tag. Do this:

      bash$ git clone git@gitlab.cs.washington.edu:cse331-QUARTER-students/cse331-QUARTER-MyCSENetId.git
      bash$ cd cse331-QUARTER-MyCSENetId
      bash$ git checkout hwN-final 
      

    • Run the gradle task that is instructed on the homework assignment. Make sure that the project is properly compiled and your code has passed.

      bash$ ./gradlew GradleTaskName    
      

    • Remove the repository once you are done.

      bash$ cd ..
      bash$ rm -rf cse331-QUARTER-YourCSENetID
      

Special Cases

Listed below are some special cases that don't necessarily apply to every assignment submission. See below if it's relevant to your situation.

Using a Late Day (Turning in your Assignment Late)

To use a late day, just don't tag your repository on the day it is due. Be sure to tag your repository when you complete the homework, though!

Deleting/Moving a Tag (Re-Submitting an Assignment)

If you've already created and/or pushed a tag, but you decide to take a late day or make change to your code and want to move the tag, we can do the following. Since removing tags is a little more complicated and is fairly rare, there isn't a menu for this in IntelliJ. We'll need to use the IntelliJ terminal window for a few parts of this (the same one you use to run gradle tasks). (Windows users may need to run these commands from Git Bash instead of the terminal. Contact the course staff if need help with this.) The basic process is broken down into four steps:

Note: Some mac users may recieve an error message or a request to install xcode or the command line developer tools when running the git command from the IntelliJ terminal. Instead of typing just git, use /usr/local/bin/git. If you're still having issues, contact the course staff for help.

To remove the old tag, run the following command from the IntellIJ terminal. (The "-d" means "delete".)

git tag -d TAG-NAME-HERE

To remove the tag from GitLab, run the following. This will remove the tag with whatever name you specify from GitLab. This needs to be done separately because of how tags behave in git. If you tried to push the new tag without removing the old one from GitLab first, you'd get an error.

git push origin master :refs/tags/TAG-NAME-HERE

Create the new tag on your updated code. Depending on the situation, you may want to tag your most recent commit or you may want to go back and tag some earlier commit in your history. To tag the most recent commit, simply follow the "Creating a Tag" (Step 2) instructions above. To tag an older commit in your history, follow the instructions in the "Tagging an Old Commit" section below. Once you have a tag in the right place, push it to GitLab as described in the "Pushing a Tag to GitLab" (Step 3) section above. If you get an error about the tag already existing, make sure you have deleted the old tag from GitLab by running the above command.

Tagging an Old Commit

Sometimes, you need to put a tag on an older commit in your repository. For example, this happens if the tag wasn't in the right place when you originally submitted an assignment, but you've already been working on the next assignment and have newer commits in your repository. To do this, there are two main steps: (a) figure out which commit you want to put the tag on, and (b) put the tag on that specific commit.

To Locate the Commit you want to Tag
  1. Open your repository in the GitLab web interface by navigating to https://gitlab.cs.washington.edu/cse331-QUARTER-students/cse331-QUARTER-NETID. Make sure to replace QUARTER with the current quarter, and NETID with your netid.
  2. On the left, navigate to Repository > Commits. On this page, you see the entire history of your repository, with the newer commits at the top and the older commits at the bottom.
  3. Decide which commit you want to move the tag to. To help you, you can click on each commit message to see the exact changes that were made in that commit. You can also mouse-over the time in "NAME authored TIME ago" under each commit message to see the exact date/time of that commit.
  4. Once you've decided which commit you want to move your tag to, copy the SHA for that commit - you'll need it for the next part. The SHA is a string of letters and numbers that uniquely identifies the commit - you can think of it as the "name" of the commit. On the GitLab commits page, each commit's SHA is listed next to it on the right side of the page. An example SHA might be: 42fbcd22.
To Tag a Specific Commit
  1. Now that you have the SHA of the commit you want to tag, open your project in IntelliJ and open the VCS > Git > Tag... window.
  2. Enter the tag name as usual. In the "Commit" field, paste the SHA that you copied from earlier. (If desired, you can click "Validate" once you've pasted the SHA and IntelliJ will show you the commit you've selected, to double-check that you have the right one.) Do not enter a message.
  3. Click "Create Tag" to finish placing the tag on your selected commit. (Note: if you're moving a tag from an older commit, you need to delete the old tag before you do this. See the "Deleting/Moving a Tag" instructions above.)
  4. Now that you have the new tag, follow the instructions in "Pushing a Tag to GitLab" (Step 3) above to push that tag as usual.