Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code ingress with git #611

Closed
wants to merge 164 commits into from
Closed

Code ingress with git #611

wants to merge 164 commits into from

Conversation

ots22
Copy link
Member

@ots22 ots22 commented Apr 23, 2020

JR: This PR is out-of-date and includes several changes that are already incorporated into master. I've migrated the most important changes to 264-code-ingress-gitlab and will make a PR from there once tested.

The overall concept is shown in the diagram:

gitlab-ingress.pdf
Key:

  • arrow with solid head: connection initiated from tail to head
  • arrow with empty head: something else
  • box: a virtual machine
  • "document" symbol: a script - runs steps indicated by arrows of the same colour
  • "folder" symbol: a git repo
  • cylinder: data

An Admin (via a script) creates a snapshot of a single commit of the requested repo, and also creates a new repo on a GitLab instance (the "Reviewer" or "External" GitLab) that is only visible to Reviewers. Once two Reviewers approve, the snapshot is made available on the ("Internal") GitLab (the same as used by Users), under the user "Ingress."

The workflow is as follows:

  1. User sends a request (out of band) for an external git resource to Admin (who should be authorized to clone it)
  2. Admin can perform a preliminary check by themselves at this stage
  3. Admin runs "SRE_Upload_Git_Repo_to_GitlabExternal.ps1", passing (as supplied by the requesting User):
    • The SRE id
    • The GitHub URL to requested resource
    • The name of the repo to use internally (which may be different from the basename of the URL path to avoid name clashes, since all requested repos end up in a single namespace)
    • The commit hash (to snapshot)
    • The name of the branch to use internally
  4. A Reviewer logs in to the External GitLab. They will be able to see two groups: "unapproved" and "approval", with a repo with the above name in each. There will be an open Merge Request from the repo in "unapproved" to the one in "approval" with the changes introduced by the most recent snapshot (effectively squashing all commits since the last approved snapshot).
  5. The Reviewer reviews the code using the usual GitLab facilities, with an opportunity for discussion with the other Reviewer. They indicate their approval or disapproval using the "thumbs up" or "thumbs down" reaction to the Merge Request. (We do not have Merge Request approvals available on our version of GitLab).
  6. The merge is made automatically (by a cron job), provided that there are:
    • two "thumbs up" responses
    • no "thumbs down" responses
    • no unresolved comments
  7. All "approval" repos are mirrored to the Internal GitLab, where they belong to the user "Ingress", and are visible alongside User repositories there.

Closes #257. Closes #264.

ots22 and others added 23 commits May 14, 2020 21:06
…ngress, within cw20/Test A sandbox

Progress during call on 2020-04-23

Co-authored-by: jack89roberts <jack89roberts@users.noreply.github.com>
Co-authored-by: jemrobinson <jemrobinson@users.noreply.github.com>
Co-authored-by: nbarlowATI <nbarlowATI@users.noreply.github.com>
Co-authored-by: jemrobinson <jemrobinson@users.noreply.github.com>
Co-authored-by: nbarlowATI <nbarlowATI@users.noreply.github.com>
Co-authored-by: ots22 <ots22@users.noreply.github.com>
Adds a user on gitlab internal that can be used to ingress repos from gitlab external:
* Config and setup changed to add secrets for username, password and API token (stored in keyvault).
* gitlab-rails commands in cloud init to add the user and generate the token.

By default the username is "external" with email "external@<gitlab-domain-host>", e.g. external@cw20.dsgroupdev.co.uk. The email isn't valid/used but the gitlab server will only accept new users from the given domain.
Needs testing.

Also renames some parameters and secrets to make the distinction between external and internal clearer.
…rnal

Also add creation of "approved" and "unapproved" groups on gitlab external
For local gitlab testing on my laptop only - not a secret valid for anything in safe haven.
ots22 and others added 24 commits July 3, 2020 14:38
…ment.template.ps1 idempotent by removing CAP/RAP settings
- Add rules for outbound connections identity server

- Remove inbound RDP rule

- Add inbound rule for session host
$null = Get-AzNetworkSecurityRuleConfig -Name $Name -NetworkSecurityGroup $NetworkSecurityGroup -ErrorVariable notExists -ErrorAction SilentlyContinue
$rule = Get-AzNetworkSecurityRuleConfig -Name $Name -NetworkSecurityGroup $NetworkSecurityGroup -ErrorVariable notExists -ErrorAction SilentlyContinue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't we say we were going to put the refactor of this and related functions into it's own PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sorry, this commit probably shouldn't have ended up on this branch - I'll make a separate PR for this.

The absence of this rule was blocking RDP connections between the APP session host
and the DSVM, since this NSG is applied to the DATA subnet.

There is almost certainly something more fundamentally wrong, but this patch means
that if this branch is deployed (e.g. in a test environment), it won't cause this
issue.
@jemrobinson
Copy link
Member

Closing this PR as it is out-of-date and includes several changes that are already incorporated into master. I've migrated the most important changes to 264-code-ingress-gitlab and will make a PR from there once tested.

@jemrobinson jemrobinson deleted the 264-gitlab-ingress branch September 27, 2022 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Define Git-based code ingress Code ingress during gitlab deployment
5 participants