Skip to content

Commit 4a308fc

Browse files
authored
Merge branch 'main' into dheath-boundary-ICU-18250
2 parents d8e5bb2 + 9509701 commit 4a308fc

File tree

17 files changed

+459
-141
lines changed

17 files changed

+459
-141
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
page_title: Add a data source - Slack
3+
description: >-
4+
Add Slack as a data source for Vault Radar.
5+
---
6+
7+
# Onboard a Slack data source
8+
9+
@include 'private-beta-feature.mdx'
10+
11+
HCP Vault Radar allows you to connect to any workspace on [Slack
12+
](#onboard-slack) and scan for secrets in public channels.
13+
14+
## Prerequisites
15+
16+
- Permission in Slack to install third-party apps from the marketplace.
17+
18+
<Highlight title="Known limitations">
19+
20+
Vault Radar has a limit of 5000 channels per workspace. If you have more
21+
than 5000 channels, Vault Radar selects the 5000 channels with the
22+
most recent activity.
23+
24+
</Highlight>
25+
26+
## Add a Slack Data source
27+
28+
1. Click **Settings/Data Sources**.
29+
30+
1. Select **HCP Vault Radar Scan**.
31+
32+
1. Under **Team Collaboration**, click **Slack**.
33+
![Select Slack data source](/img/docs/vault-radar/slack-onboarding-flow.png)
34+
35+
1. Click **Connect to Slack** to **install the Slack app**. This initiates
36+
the OAuth flow with Slack.
37+
38+
1. Select the **Slack workspace** from the dropdown list and click **Allow**
39+
![Install Slack App onto a workspace](/img/docs/vault-radar/install-slack-app-to-workspace.png)
40+
41+
<Note title="Permission required to install Slack app">
42+
43+
If you do not have permission to install apps into the selected workspace,
44+
you will see a **Submit Request** button instead of the **Allow** button.
45+
46+
Coordinate with your Slack workspace administrator to approve the app
47+
installation.
48+
49+
</Note>
50+
51+
HCP Vault Radar displays the message **Authenticated to Slack**.
52+
53+
1. Click **Next**.
54+
55+
1. Select either **All active channels** or **Select channels to monitor**.
56+
57+
The onboarding workflow joins the Slack app to the selected channels. If you
58+
have a large number of channels, this process will take several minutes to
59+
complete.
60+
61+
1. Click **Finish** to start onboarding and scanning the selected channels.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Note title="Private beta feature">
2+
3+
This feature is available as an _invitation only beta release_. Beta functionality is stable
4+
but possibly incomplete and subject to change. We strongly discourage using beta
5+
features in production.
6+
7+
</Note>

content/hcp-docs/data/docs-nav-data.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,10 @@
702702
"path": "vault-radar/get-started/add-data-sources/jira/jira-data-center"
703703
}
704704
]
705+
},
706+
{
707+
"title": "Slack <sup>Beta</sup>",
708+
"path": "vault-radar/get-started/add-data-sources/slack/"
705709
}
706710
]
707711
},
270 KB
Loading
374 KB
Loading

scripts/sync-ga-to-rc/README.md

Lines changed: 82 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,76 @@ for versioned docs by comparing updates since a provided cutoff in the current
66

77
The default cutoff date is the last run date for the provided product slug, if
88
it exists. Otherwise, the script defaults to the creation date of the RC release
9-
branch. The script standardizes all timestamps to ISO for simplicity but takes
10-
the optional override date as a local time.
9+
branch, which it calculates as the date of the first commit associated with the
10+
branch that does not exist in main. The script standardizes all timestamps to
11+
UTC for simplicity but takes the optional override date as a local time.
1112

1213

1314
## Assumptions
1415

15-
- Your RC release branch use the following naming convention: `<product_slug>/<rc_version> <docTag>`.
16+
- Your RC folder uses the following naming convention: `<product_slug>/<rc_folder> <docTag>`.
1617
- You have the GitHub CLI (`gh`) installed. The CLI is required if you want the
1718
script to create a PR on your behalf. ==> DISABLED (THE PROCESS IS STILL BUGGY)
1819

20+
## Usage
21+
22+
```text
23+
node sync-ga-to-rc.mjs -slug <product> -ga <ga_folder> -rc <rc_folder> [<optional_flags>]
24+
```
1925

2026
## Flags
2127

22-
Flag | Type | Default | Description
23-
--------- | -------- | ------------ | -----------
24-
`-slug` | `string` | No, required | Product slug used for the root content folder
25-
`-ga` | `string` | No, required | Version of the current docset
26-
`-rc` | `string` | No, required | Version of the unreleased docset
27-
`-tag` | `string` | "" | String used to tag non-GA docsets (e.g., "(rc)")
28-
`-branch` | `string` | `main` | Name of the GA branch
29-
`-date` | `string` | null | Local override date in "YYYY-MM-DD HH:MM:SS" format for the commit date cutoff
30-
`-update` | `bool` | false | Indicates whether to apply any safe changes locally
31-
`-pr` | `bool` | false | Indicates whether to apply any safe changes locally and generate a PR if possible
32-
`-merged` | `bool` | false | Indicates that RC docs are merged to `-branch`
33-
`-help` | `bool` | false | Print usage help text and exit
28+
Flag | Type | Default | Description
29+
----------- | -------- | ---------------------------- | -----------
30+
`-slug` | `string` | None, required | Product slug used for the root content folder
31+
`-ga` | `string` | None, required | GA folder; typically the GA version with `.x`
32+
`-rc` | `string` | None, required | Unreleased docset folder ; typically the RC version with `.x`
33+
`-tag` | `string` | "" | String used to tag non-GA docsets (e.g., "(rc)")
34+
`-branch` | `string` | `<product_slug>/<rc_folder>` | Name of the RC branch
35+
`-gaBranch` | `string` | `main` | Name of the GA branch
36+
`-date` | `string` | null | Local override date in "YYYY-MM-DD HH:MM:SS" format for the commit date cutoff
37+
`-update` | `bool` | false | Indicates whether to apply any safe changes locally
38+
`-pr` | `bool` | false | Indicates whether to apply any safe changes locally and generate a PR if possible
39+
`-merged` | `bool` | false | Indicates that RC docs are merged to `-gaBranch`
40+
`-help` | `bool` | false | Print usage help text and exit
3441

3542

43+
## Adding exceptions
3644

37-
## Usage
45+
If you have files you **know** the script should always ignore, you can add the
46+
relative path from your product root to the exclusion file `data/exclude.json`
47+
using your product slug.
3848

39-
```text
40-
node sync-ga-to-rc.mjs -slug <product> -ga <ga_version> -rc <rc_version> [-tag <folder_tag>] [-branch <ga_branch>] [-date <override_date] [-update] [-pr]
49+
Expected schema:
50+
51+
```json
52+
[
53+
{
54+
"<produc_slug>": [
55+
"<relative_path_1>",
56+
"<relative_path_1>",
57+
...
58+
"<relative_path_N>",
59+
]
60+
}
61+
]
62+
```
63+
64+
For example:
65+
66+
```json
67+
[
68+
{
69+
"vault": [
70+
"/content/docs/updates/important-changes.mdx",
71+
"/content/docs/updates/release-notes.mdx",
72+
"/content/docs/updates/change-tracker.mdx"
73+
]
74+
}
75+
]
4176
```
4277

78+
4379
## Examples
4480

4581
### Basic call
@@ -48,7 +84,13 @@ node sync-ga-to-rc.mjs -slug <product> -ga <ga_version> -rc <rc_version> [-tag <
4884
$ node sync-ga-to-rc.mjs -slug vault -ga 1.20.x -rc 1.21.x -tag rc
4985
```
5086

51-
### Provide an override date
87+
### Provide an explicit release branch name
88+
89+
```shell-session
90+
$ node sync-ga-to-rc.mjs -slug boundary -ga 0.20.x -rc 0.21.x -branch boundary/0.21.0
91+
```
92+
93+
### Provide an override date and explicit tag string
5294

5395
Use `-tag` to provide a specific doc tag and set a custom override date with
5496
`-date`:
@@ -76,52 +118,16 @@ $ node sync-ga-to-rc.mjs \
76118

77119
### Sync two published versions
78120

79-
Use `-merged` and set `-tag` to "none" so the script compares folders for past
80-
versions in `main`:
121+
Use `-merged` so the script compares folders in `main`:
81122

82123
```shell-session
83124
$ node sync-ga-to-rc.mjs \
84125
-slug vault \
85126
-ga 1.19.x \
86127
-rc 1.20.x \
87-
-merged \
88-
-tag none
89-
```
90-
91-
## Adding exceptions
92-
93-
If you have files you **know** the script should always ignore, you can add the
94-
relative path from your product root to the exclusion file `data/exclude.json`
95-
using your product slug.
96-
97-
Expected schema:
98-
99-
```json
100-
[
101-
{
102-
"<produc_slug>": [
103-
"<relative_path_1>",
104-
"<relative_path_1>",
105-
...
106-
"<relative_path_N>",
107-
]
108-
}
109-
]
128+
-merged
110129
```
111130

112-
For example:
113-
114-
```json
115-
[
116-
{
117-
"vault": [
118-
"/content/docs/updates/important-changes.mdx",
119-
"/content/docs/updates/release-notes.mdx",
120-
"/content/docs/updates/change-tracker.mdx"
121-
]
122-
}
123-
]
124-
```
125131

126132
## General workflow
127133

@@ -133,27 +139,33 @@ Next, the script builds the following file sets:
133139
- exclusions - a list of files the script should ignore during the sync
134140
- GAΔ - files in the GA (current) docset with a last commit date later
135141
than the provided cutoff date.
142+
than the provided cutoff date.
136143
- RCΔ - files in the RC (unreleased) docset with a last commit date
137144
later than the provided cutoff date.
138145
- GA-only - files in the GA (current) docset that do not exist in the RC
139146
docset.
147+
- GAd - files deleted from the GA (current) docset that still exist in
148+
the RC (unreleased) docset
140149

141150
The script determines what to do with the files based on the following rubric
142151
where GAu and RCu are the set of files unchanged since the cutoff in the GA and
143152
RC docsets:
144153

145-
Set definition | Implication | Action
146-
-------------------- | ------------------ | -------------------------
147-
file ∈ { RCu ∧ GAu } | file unchanged | ignore
148-
file ∈ { RCu ∧ GAΔ } | updated in GA only | safe to update in RC
149-
file ∈ { RCΔ ∧ GAu } | updated in RC only | ignore
150-
file ∈ { RCΔ ∧ GAΔ } | updated in both | possible conflict; needs manual review
151-
file ∈ { RC ∧ !GA } | new file for RC | ignore
152-
file ∈ { !RC ∧ GA } | new file for GA | safe to update in RC
153-
154-
If `-update` is `true`, the script slams files in the RC folder with files from
155-
the GA folder with any file deemed "safe", prints a note to review the
156-
information in the conflict file, and updates the last run date.
154+
Set definition | Implication | Action
155+
-------------------- | -------------------- | -------------------------
156+
file ∈ { RCu ∧ GAu } | file unchanged | ignore
157+
file ∈ { RCu ∧ GAΔ } | updated in GA only | safe to update in RC
158+
file ∈ { RCΔ ∧ GAu } | updated in RC only | ignore
159+
file ∈ { RCΔ ∧ GAΔ } | updated in both | possible conflict; needs manual review
160+
file ∈ { RC ∧ !GA } | new file for RC | ignore
161+
file ∈ { !RC ∧ GA } | new file for GA | safe to update in RC
162+
file ∈ { RC ∧ GAd } | file deleted from GA | safe to delete in RC
163+
164+
If `-update` is `true`, the script creates a working branch, changes to that
165+
branch, slams files in the RC folder with files from the GA folder with any file
166+
deemed "safe", deletes files in RC that show up as deleted in the gitlog for GA,
167+
prints a note to review the information in the conflict file, and updates the
168+
last run date.
157169

158170
If `-update` is `false`, the script generates log files and exits.
159171

@@ -171,6 +183,7 @@ but it also creates the following artifacts:
171183
File set | Output file
172184
------------------- | --------------------
173185
GAΔ | output/ga-delta.txt
186+
GAd | output/delete-list.txt
174187
RCΔ | output/rc-delta.txt
175188
GA-only | output/ga-only.txt
176189
updated files | output/safe-list.txt

scripts/sync-ga-to-rc/bash-helpers/definitions.sh

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
myDir=$(pwd)
2121
repoName="web-unified-docs"
2222
localReposDir=${myDir%"/${repoName}"*}
23+
outputDir="${myDir}/output"
2324

2425
repoRoot="${localReposDir}/${repoName}" # Local root directory of the repo
2526
docRoot="${repoRoot}/content/<PRODUCT>" # Root directory of product docs
@@ -32,6 +33,30 @@ rcDocs="" # Set in helper from command line arguments; for example, "${docRoot
3233
gaDocs="" # Set in helper from command line arguments; for example, "${docRoot}/v1.20.x"
3334

3435
jsonTemplate='{"file": "<FILENAME>", "shortname": "<SHORTNAME>", "commit": "<COMMIT>"}'
35-
prBranch="bot/<PRODUCT>-ga-to-rc-sync-$(date +%Y%m%d)"
36+
prBranch="bot/<PRODUCT>-ga-to-rc-sync-$(date +%Y%m%d-%H%M%S)"
3637
prTitle="<PRODUCT> GA to RC auto-sync"
3738
prBody="Draft PR created by \`sync-ga-to-rc.mjs\` to push recent GA updates to the RC release branch for <PRODUCT>"
39+
40+
41+
# Helper function to convert an ISO time string to UTC
42+
#
43+
function getUTCDate {
44+
45+
local dateString="${1}"
46+
local myShell="${SHELL}"
47+
local zBash="/bin/zsh"
48+
local uBash="/bin/bash"
49+
local unixTime
50+
51+
# Bail if any of the command line parameters were omitted
52+
if [[ -z "${dateString}" ]] ; then return; fi
53+
54+
# The date command in zbash (standard shell for MacOS) is wildly different
55+
# from standard bash, so we convert differently based on the shell
56+
if [[ "${myShell}" == "${zBash}" ]] ; then
57+
unixTime=$(date -j -f '%Y-%m-%d %H:%M:%S %z' "${dateString}" +'%s')
58+
echo $(date -j -u -r ${unixTime} +'%Y-%m-%d %H:%M:%S')
59+
else
60+
echo $(date -u +'%Y-%m-%d %H:%M:%S' -d "${dateString}")
61+
fi
62+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#
2+
# Copyright (c) HashiCorp, Inc.
3+
# SPDX-License-Identifier: BUSL-1.1
4+
#
5+
# ------------------------------------------------------------------------------
6+
# Delete RC docs
7+
#
8+
# For every relative path in the input list, delete the RC version if it exists
9+
#
10+
# Expected usage: delete-rc-docs.sh <productKey> <gaFolder> <rcFolder> <deleteListFile>
11+
# Example: delete-rc-docs.sh vault '1.20.x' '1.21.x (rc)' 'delete-list.txt'
12+
13+
# Pull in the common variable definitions
14+
currDir="$(dirname "$0")"
15+
. "${currDir}/definitions.sh"
16+
17+
# Set variables from command line argument
18+
productKey="${1}" # root folder for product docs (product key)
19+
gaFolder="${2}" # GA doc folder name
20+
rcFolder="${3}" # RC doc folder name
21+
deleteList="${4}" # file of GA paths we can overwrite in RC
22+
23+
# Bail if any of the command line parameters were omitted
24+
if [[ -z "${productKey}" ]] ; then exit ; fi
25+
if [[ -z "${gaFolder}" ]] ; then exit ; fi
26+
if [[ -z "${rcFolder}" ]] ; then exit ; fi
27+
if [[ -z "${deleteList}" ]] ; then exit ; fi
28+
29+
cd "${repoRoot}"
30+
31+
while read line; do
32+
33+
# Grab the filename and generate the cooresponding RC path
34+
gaPath=$(echo "${line}" | awk -F " " '{print $3}')
35+
rcPath=${gaPath/${gaFolder}/${rcFolder}}
36+
37+
# Skip any file that may have ended up in the list from a different product
38+
if [[ "${gaPath}" != *"/content/${productKey}/"* ]]; then continue ; fi
39+
if [[ "${rcPath}" != *"/content/${productKey}/"* ]]; then continue ; fi
40+
41+
# If the file exists in the RC folder, delete it
42+
if [[ -f "${rcPath}" ]] ; then rm -r "${rcPath}" ; fi
43+
44+
done < "${outputDir}/${deleteList}"

0 commit comments

Comments
 (0)