Should Environmental Data Be Placed Into Version Control?

Problem scenario
You are not sure if environmental specific values should be placed into version control. What should do you?

Solution
Some people think that everything should go into version control. But others disagree. Here are examples of each philosophy:

“You need to get everything in version control. Everything. Not just the code, but everything required to build the environment.” (This was taken from page 297 of The Phoenix Project.) This is very clear in how it disagrees with the twelve-factor app principles.

How Do You List the Repositories in GitHub for a Specific Organization without Using the Web UI?

Problem scenario
How do you use the GitHub API to list repositories for an organization?

Solution
Draft a command like this:

curl -u jdoe https://api.github.com/orgs/foobar/repos | grep git_commits_url

  • Change “jdoe” to the username of your GitHub account
  • Change “foobar” to the name of your organization

How Do You Troubleshoot a Web UI Problem with GitLab?

Problem scenario
When you are using GitLab, you receive various 500 errors. The web UI is not working correctly. What should you do?

Possible solution #1
1. Go to the back-end of the GitLab server. Run this: sudo gitlab-ctl tail
2. Reproduce the web UI problems that you are having. Examine the output.

Possible solution #2
You may want to install Fiddler on your desktop to get more details about the front-end.

How Do You Create a Master Branch (or First Branch) with the GitHub API?

Problem scenario
You do not want to copy a branch to create a new one. How do you create a branch of a repository that has no branches?

Solution
You must know the relevant organization name of the Git repository and the name of the repository itself. Do these changes:

  • Change “acme” to the organization name
  • Change “goodrepo” to the repository name of your choice.

How Do You Find the Web UI of a GitLab Server on Your Network?

Problem scenario
You inherited a GitLab server on your network to manage. You want to find the front end of the URL. What should you do?

Solution
Find the external IP address. Log into the back-end. If it has access to the internet, run this command: curl icanhazip.com

If you have no access to the internet, run this command: ip addr show

Use the IP addresses exhaustively in a web browser with a port in this fashion (where ppp should be replaced with the port number you want to try): http://x.x.x.x:pppp

The port number may be one to five numbers long.

How Do You Troubleshoot This Error “502 Whoops, GitLab is taking too much time to respond.”?

Problem scenario
You try to log into GitLab for the first time, but you get this error:

“502 Whoops, GitLab is taking too much time to respond.”

What should you do?

Solution
Go to the back end of the server. Run the top command. Is the left most load average above 1 (e.g, 1.08)?

The top line of the results of the top command will look something like this:

load average: 1.08,

How Do You Find Out if a GitHub Repository’s Branch is Protected or Not?

Problem scenario
Using the API you want to know if a given GitHub repository’s branch is protected. What do you do?

Solution
Draft the four commands below. Replace “jdoe” with the GitHub username. Replace “organizationname” with the organization name in your repo. Replace “repositoryname” with the repository name. Replace “master” with the branch you want to check. Then run the four commands below.

Why Cannot You List Every Repository in Your GitHub Organization’s Account?

Problem scenario
You are trying to list the repositories in your GitHub organization with the REST API. You run something like this:

curl -u $username:$password https://api.github.com/orgs/$ORGNAME/repos

But as you add repositories, all are not showing. What is wrong?

Possible solution
Do you have more than 30 repositories? The output of the curl (GET REST) invocation can be the same as you add repositories if you exceed 30.

How Do You Create an Issue for a Repository in a GitHub Organization the API?

Problem scenario
You are running this command:

curl -u jdoe:$password -X PUT -d ‘{“title”: “Look at this bug”, “body”: “This is a serious problem here.”, “assignees”: [ “jdoe” ], “milestone”: 1, “labels”: [ “bug” ]}’ https://api.github.com/repos/$orgname/$reponame/issues

The message in the response you receive is “Not Found”. You found documentation that refers to an “owner” being in the URL. You see “POST /repos/:owner/:repo/issues” (with no reference to the organization).