Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions babel.config.js

This file was deleted.

10 changes: 8 additions & 2 deletions docs/2.0/docs/overview/getting-started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ Set up authentication for Pipelines to enable secure automation of infrastructur

<PersistentCheckbox id="install-df-3" label="Pipelines Auth Configured" />

### Step 4: [Create new Pipelines repositories](/2.0/docs/pipelines/installation/addingnewrepo)
### Step 4: Create new Pipelines repositories

Alternatively, you can [add Pipelines to an existing repository](/2.0/docs/pipelines/installation/addingexistingrepo).
- [New GitHub repository](/2.0/docs/pipelines/installation/addingnewrepo)
- [New GitLab repository](/2.0/docs/pipelines/installation/addingnewgitlabrepo)

Alternatively, you can add Pipelines to an existing repository:

- [Existing GitHub repository](/2.0/docs/pipelines/installation/addingexistingrepo)
- [Existing GitLab repository](/2.0/docs/pipelines/installation/addinggitlabrepo)

<PersistentCheckbox id="install-df-4" label="Pipelines Repositories Ready" />

Expand Down
4 changes: 2 additions & 2 deletions docs/2.0/docs/pipelines/installation/addinggitlabrepo.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CustomizableValue from '/src/components/CustomizableValue';

# Adding Pipelines to a GitLab Project
# Adding Pipelines to an existing GitLab Project

This guide walks you through the process of adding Gruntwork Pipelines to a GitLab project. By the end, you'll have a fully configured GitLab CI/CD pipeline that can deploy infrastructure changes automatically.

Expand All @@ -11,7 +11,7 @@ Before you begin, make sure you have:
- Basic familiarity with Git, GitLab, and infrastructure as code concepts
- Access to one (or many) AWS account(s) where you have permission to create IAM roles and OIDC providers
- Completed the [Pipelines Auth setup for GitLab](/2.0/docs/pipelines/installation/viamachineusers#gitlab) and setup a machine user with appropriate PAT tokens
- Local access to Gruntwork's GitHub repositories, specifically [boilerplate](https://github.com/gruntwork-io/boilerplate) and the [architecture catalog](https://github.com/gruntwork-io/terraform-aws-architecture-catalog/)
- Local access to Gruntwork's GitHub repositories, specifically the [architecture catalog](https://github.com/gruntwork-io/terraform-aws-architecture-catalog/)

:::info

Expand Down
544 changes: 544 additions & 0 deletions docs/2.0/docs/pipelines/installation/addingnewgitlabrepo.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion docs/2.0/docs/pipelines/installation/scm-comparison.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Gruntwork Pipelines supports both GitHub Actions and GitLab CI/CD as CI/CD platf
| Feature | GitHub | GitLab (Beta) |
| -------------------------------- | --------------------------- | ---------------------------- |
| Infrastructure as Code Pipelines | ✅ | ✅ |
| Account Factory Integration | ✅ | ❌ |
| Account Factory Integration | ✅ | ✅ |
| Enterprise Account Factory | ✅ | ❌ |
| App-based Authentication | ✅ | ❌ |
| Machine User Authentication | ✅ | ✅ |
| Customizable Workflows | ✅ | ✅ |
Expand Down
10 changes: 5 additions & 5 deletions docs/2.0/docs/pipelines/installation/viamachineusers.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ If screen sharing while generating tokens, **pause or hide your screen** before
:::

### Token types
<Tabs>
<Tabs groupId="platform">
<TabItem value="github" label="GitHub" default>

GitHub supports two types of tokens:
Expand Down Expand Up @@ -77,7 +77,7 @@ More information is available [here](https://docs.github.com/en/organizations/ma
![Pending requests](/img/pipelines/security/pending_requests.png)

</TabItem>
<TabItem value="gitlab" label="GitLab">
<TabItem value="GitLab" label="GitLab">

GitLab uses access tokens for authentication. There are several types of access tokens in GitLab:

Expand Down Expand Up @@ -107,8 +107,8 @@ When creating tokens, carefully consider the expiration date and scope of access

## Creating machine users

<Tabs>
<TabItem value="github" label="GitHub" default>
<Tabs groupId="platform">
<TabItem value="GitHub" label="GitHub" default>

The recommended setup for Pipelines uses two machine users: one for opening pull requests and running workflows (`ci-user`) and another with read-only access to repositories (`ci-read-only-user`). Each user is assigned restrictive permissions based on their tasks. As a result, both users may need to participate at different stages to successfully run a pipeline job.

Expand Down Expand Up @@ -389,7 +389,7 @@ For more information on creating and using GitHub Actions Repository secrets, re
</Tabs>

</TabItem>
<TabItem value="gitlab" label="GitLab">
<TabItem value="GitLab" label="GitLab">


For GitLab, Gruntwork Pipelines two CI variables. The first, the `PIPELINES_GITLAB_TOKEN` requires the `Developer`, `Maintainer` or `Owner` role and the scopes listed below. This token will be used to authenticate API calls and access repositories within your GitLab group. The second, the `PIPELINES_GITLAB_READ_TOKEN` will be used to access your own code within GitLab. If not set, Pipelines will default to the `CI_JOB_TOKEN` when accessing internal GitLab hosted code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ This section covers the Pipelines configuration required to deploy an AWS S3 buc
```
2. Create a `vars.yaml` file on your local machine with the following content:

<Tabs>
<Tabs groupId="platform">
<TabItem value="GitHub" label="GitHub" default>
```yaml title="vars.yaml"
AccountName: "$$ACCOUNT_NAME$$"
Expand Down Expand Up @@ -84,7 +84,7 @@ This section covers the Pipelines configuration required to deploy an AWS S3 buc

3. We'll now use that `vars.yaml` file as input to [boilerplate](https://github.com/gruntwork-io/boilerplate) to generate the Terragrunt code for the OIDC Provider and IAM roles. From the root of your repository, run the following command:

<Tabs>
<Tabs groupId="platform">
<TabItem value="GitHub" label="GitHub">
```bash
boilerplate --template-url "[email protected]:gruntwork-io/terraform-aws-architecture-catalog.git//templates/github-actions-single-account-setup?ref=main" --output-folder . --var-file vars.yaml --non-interactive
Expand Down Expand Up @@ -130,7 +130,7 @@ aws sts get-caller-identity

In the event you already have an OIDC provider for your SCM in the AWS account you can import the existing one:

<Tabs>
<Tabs groupId="platform">
<TabItem value="GitHub" label="GitHub">
```
cd _global/$$ACCOUNT_NAME$$/github-actions-openid-connect-provider/
Expand Down
7 changes: 6 additions & 1 deletion sidebars/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,12 @@ const sidebar = [
collapsed: false,
items: [
{
label: "Adding Pipelines to a GitLab Project",
label: "Creating a New GitLab Project with Pipelines",
type: "doc",
id: "2.0/docs/pipelines/installation/addingnewgitlabrepo",
},
{
label: "Adding Pipelines to an Existing GitLab Project",
type: "doc",
id: "2.0/docs/pipelines/installation/addinggitlabrepo",
},
Expand Down
45 changes: 45 additions & 0 deletions src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@
--ifm-heading-color: #15192d;

--ifm-button-border-radius: 12px;

--ifm-checkbox-border-color: #adb5bd;
}

html[data-theme="dark"] {
Expand All @@ -177,6 +179,8 @@ html[data-theme="dark"] {

--ifm-background-color: #15192d;
--ifm-background-surface-color: #0d0622;

--ifm-checkbox-border-color: #777;
}

.docusaurus-highlight-code-line {
Expand Down Expand Up @@ -695,3 +699,44 @@ html[data-theme="dark"] .customizable-value span::after {
border-width: 0 3px 3px 0;
transform: rotate(45deg);
}

/* Create a custom checkbox that looks like the default */
.contains-task-list li input[type="checkbox"] {
-webkit-appearance: none;
appearance: none;
background-color: var(--ifm-background-color);
margin-right: 0.5rem;
font: inherit;
color: currentColor;
width: 1.15em;
height: 1.15em;
border: 0.1em solid var(--ifm-checkbox-border-color);
border-radius: 0.15em;
transform: translateY(-0.075em);
display: inline-grid;
place-content: center;
cursor: pointer;
}

/* Create the checkmark/indicator using an SVG (hidden when not checked) */
.contains-task-list li input[type="checkbox"]::before {
content: "";
width: 0.65em;
height: 0.65em;
transform: scale(0);
transition: 120ms transform ease-in-out;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='white' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z'/%3e%3c/svg%3e");
background-position: center;
background-repeat: no-repeat;
}

/* Show the checkmark when checked */
.contains-task-list li input[type="checkbox"]:checked::before {
transform: scale(1);
}

/* Change the background color of the box when checked */
.contains-task-list li input[type="checkbox"]:checked {
background-color: var(--ifm-color-primary);
border-color: var(--ifm-color-primary);
}
12 changes: 12 additions & 0 deletions src/theme/Root.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
*/

import React, { useState, useEffect } from "react"
import { useLocation } from "@docusaurus/router"
import { interactivePersistentCheckboxes } from "/utils/checkbox"
import { scrollToAnchorInClosedSection } from "/utils/anchor"
import { getRepos } from "/utils"
import {
SubscribersOnlyModal,
Expand Down Expand Up @@ -143,6 +146,15 @@ function Root({ children }) {
const [subscriberNoticeLink, setSubscriberNoticeLink] = useState("")
const [cisNoticeLink, setCisNoticeLink] = useState("")
const [enterpriseNoticeLink, setEnterpriseNoticeLink] = useState("")
const location = useLocation()

useEffect(() => {
interactivePersistentCheckboxes()
}, [location.pathname])

useEffect(() => {
scrollToAnchorInClosedSection(location)
}, [location.hash])

useEffect(function showModalForPrivateGithubLinks() {
const listener = (event) => {
Expand Down
24 changes: 24 additions & 0 deletions utils/anchor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export const scrollToAnchorInClosedSection = (location: Location) => {
const hash = location.hash

if (hash) {
const id = decodeURIComponent(hash.slice(1))
const element = document.getElementById(id)

if (element) {
const details = element.closest("details")
if (details && !details.open) {
const summary = details.querySelector("summary")
if (summary) {
summary.click()

const timeoutId = setTimeout(() => {
element.scrollIntoView({ behavior: "smooth", block: "start" })
}, 500) // 500ms to allow for browser to render the element

return () => clearTimeout(timeoutId)
}
}
}
}
}
52 changes: 52 additions & 0 deletions utils/checkbox.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
export function interactivePersistentCheckboxes() {
const LOCAL_STORAGE_KEY = "docusaurus.checkboxes"

const getStorage = () => {
try {
return JSON.parse(window.localStorage.getItem(LOCAL_STORAGE_KEY) || "{}")
} catch (e) {
return {}
}
}

const updateStorage = (key: string, value: boolean) => {
const data = getStorage()
data[key] = value
window.localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(data))
}

const initCheckboxes = () => {
const checkboxes = document.querySelectorAll<HTMLInputElement>(
".contains-task-list > li input[type='checkbox']"
)

if (checkboxes.length === 0) {
return
}

const data = getStorage()

checkboxes.forEach((checkbox, index) => {
const label =
`${index}:${checkbox?.closest("li")?.textContent?.substring(0, 10)}` ||
`checkbox-${index}`
const key = `${window.location.pathname}:${label}`

checkbox.disabled = false
const checked = data[key] || false
checkbox.checked = checked

checkbox.addEventListener("click", (e) => {
const target = e.target as HTMLInputElement
updateStorage(key, target.checked)
})
})
}

const timeoutId = setTimeout(initCheckboxes, 100)

// Cleanup
return () => {
clearTimeout(timeoutId)
}
}