166 lines
6.8 KiB
Markdown
166 lines
6.8 KiB
Markdown
## Task 21
|
|
|
|
The Nautilus development team has provided requirements to the DevOps team for a new application development project, specifically requesting the establishment of a Git repository. Follow the instructions below to create the Git repository on the Storage server in the Stratos DC:
|
|
|
|
Utilize yum to install the git package on the Storage Server.
|
|
Create a bare repository named /opt/beta.git (ensure exact name usage).
|
|
|
|
```bash
|
|
|
|
ssh natasha@ststor01
|
|
|
|
# install git
|
|
sudo yum install -y git
|
|
|
|
# create the bare repo (exact path/name)
|
|
sudo git init --bare /opt/beta.git
|
|
|
|
# verify
|
|
ls -la /opt/beta.git
|
|
```
|
|
|
|
## Task 22
|
|
|
|
The DevOps team established a new Git repository last week, which remains unused at present. However, the Nautilus application development team now requires a copy of this repository on the Storage Server in the Stratos DC. Follow the provided details to clone the repository:
|
|
|
|
The repository to be cloned is located at /opt/cluster.git
|
|
Clone this Git repository to the /usr/src/kodekloudrepos directory. Perform this task using the natasha user, and ensure that no modifications are made to the repository or existing directories, such as changing permissions or making unauthorized alterations.
|
|
|
|
```bash
|
|
|
|
ssh natasha@ststor01
|
|
|
|
git clone /opt/news.git /usr/src/kodekloudrepos
|
|
ls -la /usr/src/kodekloudrepos
|
|
|
|
```
|
|
|
|
## Task 23
|
|
|
|
There is a Git server utilized by the Nautilus project teams. Recently, a new developer named Jon joined the team and needs to begin working on a project. To begin, he must fork an existing Git repository. Follow the steps below:
|
|
|
|
Click on the Gitea UI button located on the top bar to access the Gitea page.
|
|
Login to Gitea server using username jon and password Jon_pass123.
|
|
Once logged in, locate the Git repository named sarah/story-blog and fork it under the jon user.
|
|
|
|
Note: For tasks requiring web UI changes, screenshots are necessary for review purposes. Additionally, consider utilizing screen recording software such as loom.com to record and share your task completion process.
|
|
|
|
Solution:
|
|
Clicky-clack in gitea UI
|
|
|
|
## Task 24
|
|
|
|
Nautilus developers are actively working on one of the project repositories, /usr/src/kodekloudrepos/media. Recently, they decided to implement some new features in the application, and they want to maintain those new changes in a separate branch. Below are the requirements that have been shared with the DevOps team:
|
|
|
|
On Storage server in Stratos DC create a new branch xfusioncorp_media from master branch in /usr/src/kodekloudrepos/media git repo.
|
|
|
|
Please do not try to make any changes in the code.
|
|
|
|
```bash
|
|
ssh natasha@ststor01
|
|
|
|
cd /usr/src/kodekloudrepos/media
|
|
git checkout master
|
|
git checkout -b xfusioncorp_media
|
|
```
|
|
|
|
## Task 25
|
|
|
|
The Nautilus application development team has been working on a project repository /opt/media.git. This repo is cloned at /usr/src/kodekloudrepos on storage server in Stratos DC. They recently shared the following requirements with DevOps team:
|
|
|
|
Create a new branch datacenter in /usr/src/kodekloudrepos/media repo from master and copy the /tmp/index.html file (present on storage server itself) into the repo. Further, add/commit this file in the new branch and merge back that branch into master branch. Finally, push the changes to the origin for both of the branches.
|
|
|
|
```bash
|
|
ssh natasha@ststor01
|
|
|
|
# do some pretty uninteresant git operations and file copies
|
|
```
|
|
|
|
## Task 26
|
|
|
|
The xFusionCorp development team added updates to the project that is maintained under /opt/demo.git repo and cloned under /usr/src/kodekloudrepos/demo. Recently some changes were made on Git server that is hosted on Storage server in Stratos DC. The DevOps team added some new Git remotes, so we need to update remote on /usr/src/kodekloudrepos/demo repository as per details mentioned below:
|
|
|
|
a. In /usr/src/kodekloudrepos/demo repo add a new remote dev_demo and point it to /opt/xfusioncorp_demo.git repository.
|
|
b. There is a file /tmp/index.html on same server; copy this file to the repo and add/commit to master branch.
|
|
c. Finally push master branch to this new remote origin.
|
|
|
|
```bash
|
|
ssh natasha@ststor01
|
|
sudo su -
|
|
|
|
cd /usr/src/kodekloudrepos/demo
|
|
git remote add dev_demo /opt/xfusioncorp_demo.git
|
|
|
|
# b. copy file in, stage, commit on master
|
|
git checkout master # make sure we're on master
|
|
cp /tmp/index.html .
|
|
git add index.html
|
|
git commit -m "Add index.html"
|
|
|
|
# c. push master to the NEW remote (dev_demo), not origin
|
|
git push dev_demo master
|
|
```
|
|
|
|
## Task 27
|
|
|
|
The Nautilus application development team was working on a git repository /usr/src/kodekloudrepos/games present on Storage server in Stratos DC. However, they reported an issue with the recent commits being pushed to this repo. They have asked the DevOps team to revert repo HEAD to last commit. Below are more details about the task:
|
|
|
|
In /usr/src/kodekloudrepos/games git repository, revert the latest commit ( HEAD ) to the previous commit (JFYI the previous commit hash should be with initial commit message ).
|
|
|
|
Use revert games message (please use all small letters for commit message) for the new revert commit.
|
|
|
|
```bash
|
|
ssh natasha@ststor01
|
|
sudo su -
|
|
|
|
cd /usr/src/kodekloudrepos/games
|
|
sudo git log --oneline
|
|
|
|
git revert HEAD --no-commit
|
|
git commit -m "revert games"
|
|
```
|
|
|
|
## Task 28
|
|
|
|
The Nautilus application development team has been working on a project repository /opt/news.git. This repo is cloned at /usr/src/kodekloudrepos on storage server in Stratos DC. They recently shared the following requirements with the DevOps team:
|
|
|
|
There are two branches in this repository, master and feature. One of the developers is working on the feature branch and their work is still in progress, however they want to merge one of the commits from the feature branch to the master branch, the message for the commit that needs to be merged into master is Update info.txt. Accomplish this task for them, also remember to push your changes eventually.
|
|
|
|
```bash
|
|
ssh natasha@ststor01
|
|
sudo su -
|
|
|
|
cd /usr/src/kodekloudrepos/news
|
|
git log feature --oneline
|
|
|
|
git checkout master
|
|
git cherry-pick 9472ff2
|
|
git push origin master
|
|
```
|
|
|
|
|
|
## Task 29
|
|
|
|
Clicky clack in gitea UI
|
|
|
|
## Task 30
|
|
|
|
The Nautilus application development team was working on a git repository /usr/src/kodekloudrepos/beta present on Storage server in Stratos DC. This was just a test repository and one of the developers just pushed a couple of changes for testing, but now they want to clean this repository along with the commit history/work tree, so they want to point back the HEAD and the branch itself to a commit with message add data.txt file. Find below more details:
|
|
|
|
In /usr/src/kodekloudrepos/beta git repository, reset the git commit history so that there are only two commits in the commit history i.e initial commit and add data.txt file.
|
|
|
|
Also make sure to push your changes.
|
|
|
|
```bash
|
|
ssh natasha@ststor01
|
|
sudo su -
|
|
|
|
cd /usr/src/kodekloudrepos/beta
|
|
git log --oneline
|
|
|
|
git reset --hard e23457b
|
|
|
|
git push -f
|
|
|
|
```
|