Showing posts with label Cloud-Source-Repositories. Show all posts
Showing posts with label Cloud-Source-Repositories. Show all posts

Create and Configure Cloud Source Repositories by generating SSH Keys and uploading from Windows Powershell.

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> ls

    Directory: C:\Users\Ketan.Patel\Downloads\planner\planner_lite

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         8/28/2023  10:44 AM            783 planner.m
-a----         8/28/2023  10:44 AM           9485 plannerlite.py
-a----         8/28/2023  10:44 AM           2682 planner_types.py

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git status

fatal: not a git repository (or any of the parent directories): .git

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git init

Initialized empty Git repository in C:/Users/Ketan.Patel/Downloads/planner/planner_lite/.git/

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git status

On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        planner.m
        planner_types.py
        plannerlite.py

nothing added to commit but untracked files present (use "git add" to track)

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git add .

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
        new file:   planner.m
        new file:   planner_types.py
        new file:   plannerlite.py

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git commit -m "first planner commit"

[master (root-commit) 17a9789] first planner commit
 3 files changed, 348 insertions(+)
 create mode 100644 planner.m
 create mode 100644 planner_types.py
 create mode 100644 plannerlite.py

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git status

On branch master
nothing to commit, working tree clean

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git remote -v

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git remote add google ssh://ketan.patel@supernal.aero@source.developers.google.com:2022/p/new-user-learning/r/simulation

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git remote -v

google  ssh://ketan.patel@supernal.aero@source.developers.google.com:2022/p/new-user-learning/r/simulation (fetch)
google  ssh://ketan.patel@supernal.aero@source.developers.google.com:2022/p/new-user-learning/r/simulation (push)

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git push --all google

The authenticity of host '[source.developers.google.com]:2022 ([142.251.2.82]:2022)' can't be established.
ECDSA key fingerprint is SHA256:AGvEpqYNMqsRNIviwyk4J4HM0lEylomDBKOWZsBn434.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[source.developers.google.com]:2022' (ECDSA) to the list of known hosts.
ketan.patel@supernal.aero@source.developers.google.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

PS C:\Users\Ketan.Patel> ssh-keygen -t rsa -C "ketan.patel@supernal.aero"

Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\Ketan.Patel/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\Ketan.Patel/.ssh/id_rsa.
Your public key has been saved in C:\Users\Ketan.Patel/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:MuYhOj0OmqXVwNawvIlHdEIaGp7QY/f4WHt+/LDWbKY ketan.patel@supernal.aero
The key's randomart image is:
+---[RSA 3072]----+
|+..              |
|+== .            |
|o++o.o           |
| + *. o          |
|  B o+=.S        |
| + B.+o+.        |
|. X + .o ..o     |
| B + .  . +o=    |
|+   .    oE=.    |
+----[SHA256]-----+

PS C:\Users\Ketan.Patel> cd .ssh

PS C:\Users\Ketan.Patel\.ssh> ls

    Directory: C:\Users\Ketan.Patel\.ssh

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         8/28/2023  11:00 AM           2610 id_rsa
-a----         8/28/2023  11:00 AM            580 id_rsa.pub
-a----         8/28/2023  10:58 AM            741 known_hosts
-a----         8/26/2023  10:28 AM            368 known_hosts.old

PS C:\Users\Ketan.Patel\.ssh> pwd

Path
----
C:\Users\Ketan.Patel\.ssh

PS C:\Users\Ketan.Patel\.ssh> cat id_rsa.pub

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDCIdjrFxQyvTDX/ivpB8BgEG2TDRYmS2tCA6KUBviZ0uGpfjcwlmmk0xQVlDR511O8j86kvVzW7J48idkm5BE4fQqbIgjPx49YYfCE6oOqqg5nIBLGrQ1bBDSjkKAsAif6+jhjkp7+ku/h/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+SR/FnYvlsr7O6NDfsnDS4DT40qyJEBf3FAeV/TbfikWOzKAvWUJXaAr5pUhuBUlKagzLqSQDBltSlpgSnzEjTzSrLv5ONM= ketan@abc.com
PS C:\Users\Ketan.Patel\.ssh>


https://source.cloud.google.com/user/ssh_keys





 

REGISTER THE SSH KEY FROM DESKTOP:












PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> dir

Directory: C:\Users\Ketan.Patel\Downloads\planner\planner_lite

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         8/28/2023  10:44 AM            783 planner.m
-a----         8/28/2023  10:44 AM           9485 plannerlite.py
-a----         8/28/2023  10:44 AM           2682 planner_types.py

PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite> git push --all google

Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 12 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 4.25 KiB | 2.12 MiB/s, done.
Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Waiting for private key checker: 3/3 objects left
To ssh://supernal.aero@source.developers.google.com:2022/p/new-user-learning/r/simulation
 * [new branch]      master -> master
PS C:\Users\Ketan.Patel\Downloads\planner\planner_lite>



CLONE REPO TO CLOUD SHELL :






ketan_patel@cloudshell:~ (new-user-learning)$ gcloud source repos clone simulation --project=new-user-learning

Cloning into '/home/ketan_patel/simulation'...
remote: Total 5 (delta 0), reused 5 (delta 0)
Receiving objects: 100% (5/5), 4.25 KiB | 4.25 MiB/s, done.
Project [new-user-learning] repository [simulation] was cloned to [/home/ketan_patel/simulation].

ketan_patel@cloudshell:~ (new-user-learning)$ cd simulation/

ketan_patel@cloudshell:~/simulation (new-user-learning)$ ls

plannerlite.py  planner.m  planner_types.py
ketan_patel@cloudshell:~/simulation (new-user-learning)$

Cloud Source Repositories

Cloud Source Repositories, fully-managed private Git repositories hosted on Google Cloud Platform (GCP), is tightly integrated with other GCP tools, making it easy to automatically build, test, deploy, and debug code right out of the gate. With just a few clicks and without any additional setup or configuration, you can extend Cloud Source Repositories with other GCP tools to perform other tasks as a part of your development workflow. In this post, let’s take a closer look at some of the GCP tools that are integrated with Cloud Source Repositories, and how they simplify developer workflows:



 669  mkdir GCP
  670  cd GCP
  671  echo "ketan" > ketan.txt
  672  cd
  673  ssh-keygen -t rsa -C "ketan.patel@supernal.aero"
  674  cd .ssh
  675  ls -l
  676  cat id_rsa.pub
  677  cd
  678  cd GCP
  679  ls -l
  683  gcloud init
  685  gcloud source repos create azureketanvm1
  686  git remote add google https://source.developers.google.com/p/new-user-learning/r/azureketanvm1
  687  gcloud config list
  688  git remote -v
  689  git init
  690  ls
  691  ls -al
  692  git remote -v
  693  git remote add google https://source.developers.google.com/p/new-user-learning/r/azureketanvm1
  694  git remote -v
  695  git push google master
  696  git add .
  697  git status
  698  git commit -m "first commit"
  699  git status






ketan@ketanvm1:~$ mkdir GCP

ketan@ketanvm1:~$ cd GCP

ketan@ketanvm1:~/GCP$ echo "ketan" > ketan.txt

ketan@ketanvm1:~/GCP$ cd

ketan@ketanvm1:~$ ssh-keygen -t rsa -C "ketan.patel@supernal.aero"

Generating public/private rsa key pair.
Enter file in which to save the key (/home/ketan/.ssh/id_rsa):
/home/ketan/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/ketan/.ssh/id_rsa
Your public key has been saved in /home/ketan/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:b86nJiB/53fki2BJg6X8RCiL3C165/it+n2vhP2Ueq8 ketan.patel@supernal.aero
The key's randomart image is:
+---[RSA 3072]----+
|                 |
|         .       |
|      . . o      |
|   . o = =       |
|    o + S +      |
|    .... = =  .. |
|    .o... O ooo  |
|     ..+oBoo+=+  |
|      o==*B=+=E+.|
+----[SHA256]-----+
ketan@ketanvm1:~$

ketan@ketanvm1:~$ cd .ssh

ketan@ketanvm1:~/.ssh$ ls -l
total 8
-rw------- 1 ketan ketan    0 Jun 23 17:17 authorized_keys
-rw------- 1 ketan ketan 2610 Aug 21 22:28 id_rsa
-rw-r--r-- 1 ketan ketan  579 Aug 21 22:28 id_rsa.pub

ketan@ketanvm1:~/.ssh$ cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC91i4eEYr4W/utQkKYZqJgQHxizCUisbbKRPsd5eRC                                                     O6uIubn7DEVP58SptnbSRQWswhkiuu6UITDGIv7iyF1Drih+abxQlWQugJ9ZUQgi8ljqY+wZR9icYoXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXkLjwnErfx0A3PDGizncvuJkI2ZbhZbk+fJyCSeSiM= ketan.p atel@supernal.aero

ketan@ketanvm1:~/.ssh$ cd

ketan@ketanvm1:~$ cd GCP

ketan@ketanvm1:~/GCP$ ls -l
total 4
-rw-rw-r-- 1 ketan ketan 6 Aug 21 22:27 ketan.txt


ketan@ketanvm1:~/GCP$ gcloud init

Welcome! This command will take you through the configuration of gcloud.

Settings from your current configuration [default] are:
compute:
  region: us-west1
  zone: us-west1-a
core:
  account: ketan.patel@supernal.aero
  disable_usage_reporting: 'True'
  project: new-user-learning

Pick configuration to use:
 [1] Re-initialize this configuration [default] with new settings
 [2] Create a new configuration
Please enter your numeric choice:  1

Your current configuration has been set to: [default]

You can skip diagnostics next time by using the following flag:
  gcloud init --skip-diagnostics

Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.
Reachability Check passed.
Network diagnostic passed (1/1 checks passed).

Choose the account you would like to use to perform operations for this configuration:
 [1] ketan.patel@supernal.aero
 [2] Log in with a new account
Please enter your numeric choice:  1

You are logged in as: [ketan.patel@supernal.aero].

Pick cloud project to use:
 [1] cosmic1234abcd
 [2] dv1234
 [3] dvabcd
 [4] new-user-learning

 [5] Enter a project ID
 [6] Create a new project
Please enter numeric choice or text value (must exactly match list item):  4

Your current project has been set to: [new-user-learning].

Do you want to configure a default Compute Region and Zone? (Y/n)?  Y

Which Google Compute Engine zone would you like to use as project default?
If you do not specify a zone via a command line flag while working with Compute Engine resources, the default is assumed.
 [1] us-east1-b
<truncated>
 [10] us-central1-b
 [11] us-west1-b
 [12] us-west1-c
 [13] us-west1-a
<truncated>
Did not print [66] options.
Too many options [116]. Enter "list" at prompt to print choices fully.
Please enter numeric choice or text value (must exactly match list item):  13

Your project default Compute Engine zone has been set to [us-west1-a].
You can change it by running [gcloud config set compute/zone NAME].

Your project default Compute Engine region has been set to [us-west1].
You can change it by running [gcloud config set compute/region NAME].

Your Google Cloud SDK is configured and ready to use!

* Commands that require authentication will use ketan.patel@supernal.aero by default
* Commands will reference project `new-user-learning` by default
* Compute Engine commands will use region `us-west1` by default
* Compute Engine commands will use zone `us-west1-a` by default

Run `gcloud help config` to learn how to change individual settings

This gcloud configuration is called [default]. You can create additional configurations if you work with multiple accounts and/or projects.
Run `gcloud topic configurations` to learn more.

Some things to try next:

* Run `gcloud --help` to see the Cloud Platform services you can interact with. And run `gcloud help COMMAND` to get help on any gcloud command.
* Run `gcloud topic --help` to learn about advanced features of the SDK like arg files and output formatting
* Run `gcloud cheat-sheet` to see a roster of go-to `gcloud` commands.



ketan@ketanvm1:~/GCP$ git config --global credential.'https://source.developers.google.com'.helper gcloud.sh

ketan@ketanvm1:~/GCP$ gcloud source repos create azureketanvm1
Created [azureketanvm1].
WARNING: You may be billed for this repository. See https://cloud.google.com/source-repositories/docs/pricing for details.




ketan@ketanvm1:~/GCP$ git init
Initialized empty Git repository in /home/ketan/GCP/.git/

ketan@ketanvm1:~/GCP$ ls -al
total 16
drwxrwxr-x  3 ketan ketan 4096 Aug 21 22:36 .
drwxr-xr-x 23 ketan ketan 4096 Aug 21 22:34 ..
drwxrwxr-x  7 ketan ketan 4096 Aug 21 22:36 .git
-rw-rw-r--  1 ketan ketan    6 Aug 21 22:27 ketan.txt

ketan@ketanvm1:~/GCP$ git remote -v

ketan@ketanvm1:~/GCP$ git remote add google https://source.developers.google.com/p/new-user-learning/r/azureketanvm1

ketan@ketanvm1:~/GCP$ git remote -v
google  https://source.developers.google.com/p/new-user-learning/r/azureketanvm1 (fetch)
google  https://source.developers.google.com/p/new-user-learning/r/azureketanvm1 (push)


ketan@ketanvm1:~/GCP$ git add .

ketan@ketanvm1:~/GCP$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
        new file:   ketan.txt

ketan@ketanvm1:~/GCP$ git commit -m "first commit"
[master (root-commit) df7e485] first commit
 1 file changed, 1 insertion(+)
 create mode 100644 ketan.txt

ketan@ketanvm1:~/GCP$ git status
On branch master
nothing to commit, working tree clean

ketan@ketanvm1:~/GCP$ git push google master
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 217 bytes | 217.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Waiting for private key checker: 1/1 objects left
To https://source.developers.google.com/p/new-user-learning/r/azureketanvm1
 * [new branch]      master -> master
ketan@ketanvm1:~/GCP$







UPDATE CURRENT DIRECTORY AND PUSH IT:

ketan@ketanvm1:~/GCP$ echo patel > patel
ketan@ketanvm1:~/GCP$ git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        patel

nothing added to commit but untracked files present (use "git add" to track)
ketan@ketanvm1:~/GCP$ git add .
ketan@ketanvm1:~/GCP$ git commit -m "second commit"
[master e2955bd] second commit
 1 file changed, 1 insertion(+)
 create mode 100644 patel
ketan@ketanvm1:~/GCP$ git status
On branch master
nothing to commit, working tree clean
ketan@ketanvm1:~/GCP$ git push google master
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 277 bytes | 277.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Waiting for private key checker: 1/1 objects left
To https://source.developers.google.com/p/new-user-learning/r/azureketanvm1
   df7e485..e2955bd  master -> master
ketan@ketanvm1:~/GCP$




Cloud Source Repositories: Qwik Start

 Google Cloud Source Repositories provides Git version control to support collaborative development of any application or service. In this lab, you will create a local Git repository that contains a sample file, add a Google Source Repository as a remote, and push the contents of the local repository. You will use the source browser included in Source Repositories to view your repository files from within the Cloud Console.

Task 1: Create a new Cloud Source Repository named REPO_DEMO:

student_04_f3547d22d614@cloudshell:~ (qwiklabs-gcp-03-e1abab50929c)$ gcloud source repos create REPO_DEMO

Created [REPO_DEMO].
WARNING: You may be billed for this repository. See https://cloud.google.com/source-repositories/docs/pricing for details.
student_04_f3547d22d614@cloudshell:~ (qwiklabs-gcp-03-e1abab50929c)$ 


Task 2. Clone the new repository into your Cloud Shell session
Clone the contents of your new Cloud Source Repository to a local repo in your Cloud Shell session:

student_04_f3547d22d614@cloudshell:~ (qwiklabs-gcp-03-e1abab50929c)$ gcloud source repos clone REPO_DEMO

Cloning into '/home/student_04_f3547d22d614/REPO_DEMO'...
warning: You appear to have cloned an empty repository.
Project [qwiklabs-gcp-03-e1abab50929c] repository [REPO_DEMO] was cloned to [/home/student_04_f3547d22d614/REPO_DEMO].
student_04_f3547d22d614@cloudshell:~ (qwiklabs-gcp-03-e1abab50929c)$ 


student_04_f3547d22d614@cloudshell:~/REPO_DEMO (qwiklabs-gcp-03-e1abab50929c)$ gcloud source repos list
REPO_NAME: REPO_DEMO
PROJECT_ID: qwiklabs-gcp-03-e1abab50929c

student_04_f3547d22d614@cloudshell:~/REPO_DEMO (qwiklabs-gcp-03-e1abab50929c)$ git add myfile.txt
student_04_f3547d22d614@cloudshell:~/REPO_DEMO (qwiklabs-gcp-03-e1abab50929c)$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
        new file:   myfile.txt

student_04_f3547d22d614@cloudshell:~/REPO_DEMO (qwiklabs-gcp-03-e1abab50929c)$ git commit -m "First file" myfile.txt
[master (root-commit) 5ad71da] First file
 1 file changed, 1 insertion(+)
 create mode 100644 myfile.txt
student_04_f3547d22d614@cloudshell:~/REPO_DEMO (qwiklabs-gcp-03-e1abab50929c)$ 
student_04_f3547d22d614@cloudshell:~/REPO_DEMO (qwiklabs-gcp-03-e1abab50929c)$ git status
On branch master
Your branch is based on 'origin/master', but the upstream is gone.
  (use "git branch --unset-upstream" to fixup)

nothing to commit, working tree clean
student_04_f3547d22d614@cloudshell:~/REPO_DEMO (qwiklabs-gcp-03-e1abab50929c)$ git branch
* master
student_04_f3547d22d614@cloudshell:~/REPO_DEMO (qwiklabs-gcp-03-e1abab50929c)$ git push origin master
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 222 bytes | 222.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Waiting for private key checker: 1/1 objects left
To https://source.developers.google.com/p/qwiklabs-gcp-03-e1abab50929c/r/REPO_DEMO
 * [new branch]      master -> master
student_04_f3547d22d614@cloudshell:~/REPO_DEMO (qwiklabs-gcp-03-e1abab50929c)$ 
student_04_f3547d22d614@cloudshell:~/REPO_DEMO (qwiklabs-gcp-03-e1abab50929c)$ 
student_04_f3547d22d614@cloudshell:~/REPO_DEMO (qwiklabs-gcp-03-e1abab50929c)$ 
student_04_f3547d22d614@cloudshell:~/REPO_DEMO (qwiklabs-gcp-03-e1abab50929c)$ gcloud source repos list
REPO_NAME: REPO_DEMO
PROJECT_ID: qwiklabs-gcp-03-e1abab50929c
URL: https://source.developers.google.com/p/qwiklabs-gcp-03-e1abab50929c/r/REPO_DEMO
student_04_f3547d22d614@cloudshell:~/REPO_DEMO (qwiklabs-gcp-03-e1abab50929c)$ history
    1  gcloud source repos create REPO_DEMO
    2  gcloud source repos clone REPO_DEMO
    3  cd REPO_DEMO/
    4  echo "Hello World" > myfile.txt
    5  git config --global user.email "ketan@example.com"
    6  git config --global user.name "ketan patel"
    7  git status
    8  git add myfile.txt
    9  git status
   10  git commit -m "First file" myfile.txt
   11  git status
   12  git branch
   13  git push origin master
   14  gcloud source repos list
   15  history
student_04_f3547d22d614




create a Data Fusion instance and deploy a sample pipeline

Create a Data Fusion instance and deploy a sample pipeline that reads an input file from Cloud Storage, transforms and filters the data to o...