DevOps Classroom Series – 11/Oct/2020

Azure Pipelines for .net code and other eco systems

Azure Artifacts

  • Azure Artifacts can help us in creating & sharing the below package feeds
    • Maven
    • npm
    • Nuget
    • Pip
    • Universal Packages
    • Gradle
  • Lets create a feed in Azure Artifacts Preview
  • Now connect to the feed and search for tasks with artifacts Preview Preview

Git Pending Topics

  • git bare repos
  • git submodules
  • git stash
  • git hooks
  • git pull request
  • git web hooks
  • git branching strategy
  • DevOps Engineers Day to Day Actitivies

Quick Git Areas Diagram


Git Bare Repos

  • What is Remote Repository?
    • Is a server allowing users to clone, pull and push the changes
    • So Remote Repository is generally hosted on a server with
      • daemon (background service) which runs always & allows users to connect using
        • http(s)
        • ssh
        • git
    • There are two kinds of Remote Repositories
      • Hosted Remote repositories: In this case we will not have access to server and the repositories & user administration options will be given.
        • GitHub
        • Azure Repos
        • AWS Code Commit
        • Gitlab
        • BitBucket
      • Self Hosted Remote Repositories: In this case we create a remote repository and install the necessary software and make the server a Remote Repository
        • gitolite
        • gitlab Self-Hosted
        • Bit Bucket Self Hosted
    • On the Remote Repositories will there be developers working on this? NO, So why do i need a working tree in this case.
    • In Git to clone the repository which doesnot give you working trees and directly gives you .git folder is called as bare repository.
    • Lets clone a bare repo Preview Preview Preview

Git Submodules

  • Scenario: Your organization has two teams for one project
    • UI team (Android/IPhone/WebPages)
    • APP team (Python based web apps)
  • Our company uses UI from external organization, the external organization shares their git repository with you.
  • Now you need to combine the code from ui and app team then create packages.
  • To solve this we need some way where git allows to store other git repositories in the current repository.
  • Git gives an option to do this via two methods
    • Git submodule
    • Git subtrees
  • Refer the links below
  • Now lets create a submodule based project Preview
  • Now lets look into the folder view Preview Preview Preview Preview Preview
  • Ensure you set the following when working with submodules
git config --global status.submoduleSummary 1
  • Now Refer Here

  • Now if other developers want to clone this code they have to execute some extra set of commands Preview Preview

  • cloning the repository will not bring the changes. so observe the screenshots Preview

Git Stash

  • If you want to preserve the changes you made locally and work on them at a later point of time we can execute git stash.
  • stash will create the changeset as a stack item and working directory & staging area changes will be preserved
  • To view the stash items git stash list
  • To apply the changes of stash to working directory
git stash apply
  • To apply the changes and remove the changes from the stash list we execute
git stash pop

Git Hooks

  • A pre-defined script that gets executed in response to specific actions of your Git repository
  • There are two types of Hooks
    • Client-Side Hooks:
      • Scripts that execute on the client machine (from local repository)
    • Server-Side Hooks:
      • Scripts that executes on Git Server (Remote Repo) on Specific Git Events
  • During git commit and push a lot of events occur as shown below Preview
  • And at each position we can call external scripts written in any language.
  • Navigate to .git/hooks Preview
  • Client Side Hooks should be used to
    • improve workflow for developers using repository
    • Cannot be used to enforce policy
    • used for pre-commit check
  • Server Side Hooks can be used to
    • enforce policy for rejecting pushes which do not follow
  • For rejecting pushed based on overall policies use pre-recieve
  • For evaluating individual branches use update
  • For notifications, use post-recieve
  • We can update server side hooks if we have access to remote server. But as we have already discussed about Hosted Remote Repositories, getting an access is not possible so to mitigate this Hosted Repositories provide WebHooks

Git Forks & Pull Request

  • As discussed in the classroom
    • Forks create a local copy of the repository in your account
    • submitting the changes done in your local repository to base repository can be done via pull request.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin