• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Page Information

    Loading...
  1. Dashboard
  2. Undefined Space
  3. Skara
  4. CLI Tools

Page History

Versions Compared

Old Version 12

changes.mady.by.user Erik Helin

Saved on Mar 09, 2020

compared with

New Version 13

changes.mady.by.user Erik Helin

Saved on Mar 09, 2020

  • Previous Change: Difference between versions 11 and 12
  • Next Change: Difference between versions 13 and 14
  • View Page History

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note: It is not necessary to use the Skara CLI tools to contribute changes. Contributors that prefer to use e.g. desktop applications, web browsers and/or IDEs that integrate with applicable external Git source code hosting providers are free to do so. See the Tools section for available options.

Table of Contents

Overview

The following steps has to be once (the initial setup):

  • Install Git
  • Configure Git
  • Create a GitHub account
  • Install the Skara CLI tooling
  • Create a personal access token

The following steps has to be done once per repository you want to contribute to:

  • Create a personal fork

The following steps has to be done for each change you want to make:

  • Create a local branch
  • Make your change
  • Create a pull request
  • Interact with reviewers
    • Update the pull request based on reviewer feedback
  • Integrate pull request

Every once in a while you will probably want to:

  • Sync your personal fork with the upstream repository

After you have used the tools for a while you will probably want to:

  • Configure commonly used Skara options
  • Setup useful Git aliases

Installing

To install the Skara tooling, simply clone the Skara repository and include the Skara Git configuration file:

...

To update the Skara tooling run git skara update. This will pull eventual updates and rebuild the tooling if necessary.

Configuring

Personal Access Token

Some of the Skara tools requires a "Personal Access Token" (PAT) to authenticate against an external Git source code hosting provider's API. A PAT is a like a password that has limited capabilities, it can only be used to successfully authenticate and perform certain limited actions. The following Skara tools requires a PAT:

...

If you do not intend to use the above tools, then there is no need to set up a PAT and you can skip this section. If you want to make use of the above tools, then please read on. To set up and store a person access token, please see the instructions in one of the following sections depending on your operating system and environment.

Windows

Git Credential Manager for Windows

To store the personal access token you are about to generate you need a Git credential manager. If you installed Git via https://gitforwindows.org/ (recommended) then you already have a credential manager from Microsoft installed (it is bundled with "Git for Windows"). If you installed Git via some other mechanism, then you must first install https://github.com/Microsoft/Git-Credential-Manager-for-Windows.

Generating a Personal Access Token

To generate a a Personal Access Token on GitHub go to https://github.com/settings/tokens and and click on "Generate new token". You only need to select the "repo" scope (permission). After you have generated your token, store it in the Git Credential Manager for Windows using git token store:

Code Block
languagebash
> git token store https://github.com
Username: <insert your Github username>
Password: <insert your "Personal Access Token", not your GitHub password>

macOS

To generate a a Personal Access Token on GitHub go to https://github.com/settings/tokens and and click on "Generate new token". You only need to select the "repo" scope (permission). After you have generated your token, store it in Keychain using git token store:

Code Block
languagebash
$ git token store https://github.com
Username: <insert your Github username>
Password: <insert your "Personal Access Token", not your GitHub password>

GNU/Linux

On GNU/Linux the way you will store the personal access token you are about to generate depends on your desktop environment. If you are using the a desktop environment with support for the GNOME Keyring, then follow the instructions in the GNOME section. If you are using GNU/Linux installation without a desktop environment or with a desktop environment that does not support the GNOME Keyring, see the Other section for instructions.

GNOME

On GNU/Linux the recommended setup is to use libsecret and the "libsecret credential helper" in order to use GNOME Keyring as the Git credential manager. Please follow the instructions for setting up libsecret for the GNU/Linux distribution you are using, then proceed to generate a personal access token.

Fedora

Fedora 29 and 30 comes with libsecret and GNOME Keyring installed by default. When you install the git package you also get the libsecret credential helper installed. To configure git to use the libsecret credential helper run:

...

Code Block
languagebash
sudo dnf install seahorse
Ubuntu

Ubuntu 19.04 and 18.04.2 (LTS) comes with libsecret and GNOME Keyring installed by default. Unfortunately even if you install the Git package you will not get a binary version of the libsecret credential helper installed (you only get the source). This means you have to compile the libsecret credential helper yourself. This is easy to do, it just requires two extra commands:

...

Code Block
languagebash
$ sudo apt install seahorse
Generating a personal access token

To generate a a Personal Access Token on GitHub go to https://github.com/settings/tokens and and click on "Generate new token". You only need to select the "repo" scope (permission). After you have generated your token, store it in the GNOME Keyring using git token store:

Code Block
languagebash
$ git token store https://github.com
Username: <insert your Github username>
Password: <insert your "Personal Access Token", not your GitHub password>
Other

If you are using a desktop environment or distribution without support for GNOME Keyring, or if you want to use your own scheme for storing the PAT, then that is also supported. You can store non-sensitive data such as your username and the URL of the Git source code hosting provider in your ~/.gitconfig file in the "credential" section:

...

For the PAT itself, all Skara tools interacting with an external Git source code hosting provider's API supports the GIT_TOKEN environment variable. This means that instead of storing your PAT in a secure way in a Git credential manager you will have to secure the PAT yourself according to your security requirements. To generate a a Personal Access Token on GitHub go to https://github.com/settings/tokens and and click on "Generate new token". You only need to select the "repo" scope (permission). The following sections then give a few examples on how to securely store the PAT you just generated depending your security needs.

GPG

You can use GnuPG (GPG) to store your PAT in an encrypted file. The file can be encrypted either using a GPG key or using a passphrase. If you have a GPG key you probably already know how to encrypt a file with it, so we will only cover encrypting using a passphrase here. To encrypt the PAT in a file using a passphrase, run the following command (replacing <PAT> with your personal access token):

...

Code Block
languagebash
GIT_TOKEN=$(gpg --decrypt ~/pat.gpg) git pr list
age

You can use age to store you PAT in an encrypted file. To encrypt the file using a passphrase, run the following command (replacing <PAT> with your personal access token):

...

Code Block
languagebash
$ GIT_TOKEN=$(age --decrypt ~/pat.age) git pr list
File Permissions
Warning

This is not as secure as storing the personal access token encrypted. Any person or program who can read ~/pat.txt will be able to read your personal access token and impersonate you.

...

Code Block
languagebash
$ GIT_TOKEN=$(cat ~/pat.txt) git pr list

Using

Creating a personal fork

The first step in the Skara workflow is to create a personal fork of an existing OpenJDK repository. Your personal fork is a copy of the original OpenJDK repository. Having a personal fork allows you to experiment with changes without affecting the original OpenJDK project. Having a personal fork also enables you to create pull requests targeted towards the original OpenJDK repository.Creating a personal fork is easy. Either use the GitHub web UI or use use the Skara CLI tooling. The following command will for example create a personal fork of the jdk repository.To create personal fork

Code Block
$ git fork https://github.com/openjdk/jdk<REPO>

For example, to create a personal fork of the jdk repository, runThe above Skara CLI command git fork will also clone your personal fork to a local repository on your computer. One common way of structuring your local repositories is by following the domainname and path convention. This is not a requirement, but has proven to be a useful way of keeping track of multiple repositories. For an example, see below:

Code Block
languagebash
$ tree
.
├── git
│   └── github.com
│       ├── edvbld
│       │   ├── jdk
│       │   └── loom
│       └── openjdk
│           ├── jdk
│           ├── loom
│           └── valhalla
└── hg
    └── hg.openjdk.java.net
        ├── code-tools
        │   └── jtreg
        └── jdk
            └── jdk

In the above example you can see that I have two personal forks of the openjdk/jdk and openjdk/loom repositories:

  • edvbld/jdk
  • edvbld/loom

For convenience I also have local clones of three upstream OpenJDK repositories: jdk, loom and valhalla.

Creating a local branch

To be able to work on mulitple changes concurrently you will want to create a local Git branch per change. Creating a local branch in Git is very easy:

Code Block
languagebash
$ git checkout -b <branch-name>

If you are using Git 2.24 or newer then you can also use the more recent git switch command which reads a bit more natural:
git switch --create <branch-name>

Listing local branches

A common way of structuring your local branches is to name them after the issue they correspond to, for example JDK-8237566 (or just 8237566). After making a few changes you will start to have a couple of local branches. You can list your local branches with git branch:

Code Block
languagebash
$ git branch
  JDK-8237566
* JDK-8149128
  JDK-8077146
  master

A perhaps nicer way to visualize your branches is to view them in all a commit graph with the help of git log:

Code Block
languagebash
$ git log --format=oneline --graph --all

Switching branches

You can switch between local branches using:

Code Block
languagebash
$ git checkout <branch-name>
fork https://github.com/openjdk/jdk

The above command git fork will also clone your personal fork to a local repository on your computer.If you are using Git 2.24 or newer then you can also use the more recent git switch command: git switch <branch-name>

Multiple local clones

If you are used to having one local clone of a repository for each change you are working on then that is also supported. The only difference is that you first create a local clone of your personal fork, then create a local branch in that local clone. Fortunately the Skara git fork command is idempotent - if you already have a personal fork then you will just get that one. Therefore the following commands can be run by those preferring to have one local repository per change they are working on:

...

Overview
Content Tools
ThemeBuilder

Terms of Use
• License: GPLv2
• Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Kolekti ThemeBuilder Powered by Atlassian Confluence 8.5.23
  • Kolekti ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Kolekti ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 316, "requestCorrelationId": "985a4de99a14a191"}