diff --git a/data/release-notes/PLACEHOLDER-TEMPLATE.yml b/data/release-notes/PLACEHOLDER-TEMPLATE.yml new file mode 100644 index 0000000000..c4545e6201 --- /dev/null +++ b/data/release-notes/PLACEHOLDER-TEMPLATE.yml @@ -0,0 +1,200 @@ +date: '2099-12-31' +release_candidate: true +deprecated: false +intro: | + {% note %} + + **Note:** If {% data variables.location.product_location %} is running a release candidate build, you can’t upgrade with a hotpatch. We recommend that you only run release candidates in a test environment. + + {% endnote %} + + For upgrade instructions, see "[Upgrading {% data variables.product.prodname_ghe_server %}](/admin/enterprise-management/updating-the-virtual-machine-and-physical-resources/upgrading-github-enterprise-server)." +sections: + # Remove section heading if the section contains no notes. + + features: + # Remove a sub-section heading if the heading contains no notes. If sections + # that regularly recur are missing, add placeholders to this template. + + - heading: Instance administration + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: Instance services + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: Identity and access management + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: Authentication + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: Migrations + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: Policies + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: Audit logs + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: GitHub Connect + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: GitHub Advanced Security + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: Dependabot + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: Code security + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: GitHub Actions + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: GitHub Packages + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: GitHub Pages + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: Community experience + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: Organizations + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: Repositories + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: Issues + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: Projects + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: GitHub Discussions + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: Commits + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: Pull requests + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: Releases + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: Gist + notes: + # LINK TO RELEASES ISSUE + - | + ... + + - heading: Markdown + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: Accessibility + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: GitHub Mobile + notes: + # LINK TO RELEASE ISSUE + - | + ... + + - heading: Integrations and extensions + notes: + # LINK TO RELEASE ISSUE + - | + ... + + changes: + # LINK TO RELEASE ISSUE + - | + ... + + known_issues: + # INCLUDE NOTES FOR RELEASE FROM "GHES Release Note Tracking" PROJECT'S "Known Issues" TAB + - | + ... + + deprecations: + # LINK TO RELEASE ISSUE + - | + ... \ No newline at end of file diff --git a/src/automated-pipelines/lib/config.json b/src/automated-pipelines/lib/config.json new file mode 100644 index 0000000000..ea8a3b105f --- /dev/null +++ b/src/automated-pipelines/lib/config.json @@ -0,0 +1,9 @@ +{ + "automation-pipelines": [ + "codeql-cli", + "github-apps", + "graphql", + "rest", + "webhooks" + ] +} \ No newline at end of file diff --git a/src/ghes-releases/lib/deprecation-steps.md b/src/ghes-releases/lib/deprecation-steps.md index c6311ffe12..a7a4efeb4f 100644 --- a/src/ghes-releases/lib/deprecation-steps.md +++ b/src/ghes-releases/lib/deprecation-steps.md @@ -119,9 +119,8 @@ Poke around several pages, ensure that the stylesheets are working properly, ima **Note:** We do not remove the old content for GHES release notes. New release notes can be added after we perform a deprecation in some rare cases, and not removing this content makes it easier for us to re-scrape the content to add to Azure Blob Storage. -- [ ] In your `docs-internal` checkout, create a new branch `remove--static-files` branch: `git checkout -b remove--static-files` (you can branch off of `main` or from your `deprecate-` branch, up to you). -- [ ] Run `src/ghes-releases/scripts/remove-static-files.js` and commit results. -- [ ] Re-generate the static files by running `src/rest/scripts/update-files.js --decorate-only`. +- [ ] In your `docs-internal` checkout, create a new branch: `git checkout -b remove--data-files` (you can branch off of `main` or from your `deprecate-` branch, up to you). +- [ ] Run `src/ghes-releases/scripts/sync-automated-pipeline-data.js` and commit results. - [ ] Open a new PR. - [ ] Get a review from docs-engineering and merge. This step can be merged independently from step 6. The purpose of splitting up steps 5 and 6 is to focus the review on specific files. diff --git a/src/ghes-releases/lib/release-steps.md b/src/ghes-releases/lib/release-steps.md index 019d2f4631..2c2484baf6 100644 --- a/src/ghes-releases/lib/release-steps.md +++ b/src/ghes-releases/lib/release-steps.md @@ -18,238 +18,13 @@ If you aren't comfortable going through the steps alone, sync up with a docs eng ``` src/ghes-releases/scripts/update-enterprise-dates.js ``` -- [ ] Create REST files based on previous version. Copy the latest GHES release data to a new directory for new release. For example, if the current release is 3.8 and the new release is 3.9: +- [ ] Create placeholder data files for automation pipelines and release notes: + + **Note:** The content in `data/release-notes/enterprise-server/PLACEHOLDER-TEMPLATE.yml` is copied to `data/release-notes/enterprise-server//PLACEHOLDER.yml`. All of the content in this file will be updated when the release notes are created in the megabranch including the filename `PLACEHOLDER.yml`. You can update the date or leave it as-is and wait to update it when the release notes are finalized. + ``` - cp -rf src/rest/data/ghes-3.8 src/rest/data/ghes-3.9 + src/ghes-releases/scripts/sync-automated-pipeline-data.js ``` - -- [ ] Create GraphQL files based on previous version. Copy the latest GHES release data to a new directory for new release. For example, if the current release is 3.8 and the new release is 3.9: - - ``` - cp -rf src/graphql/data/ghes-3.8 src/graphql/data/ghes-3.9 - cp -rf data/graphql/ghes-3.8 data/graphql/ghes-3.9 - ``` -- [ ] Create webhook files based on previous version. Copy the latest GHES release data to a new directory for new release. For example, if the current release is 3.8 and the new release is 3.9: - - ``` - cp -rf src/webhooks/data/ghes-3.8 src/webhooks/data/ghes-3.9 - ``` - -- [ ] Create GitHub App files based on previous version. Copy the latest GHES release data to a new directory for new release. For example, if the current release is 3.8 and the new release is 3.9: - - ``` - cp -rf src/github-apps/data/ghes-3.8 src/github-apps/data/ghes-3.9 - ``` - -- [ ] Create a placeholder release notes file called `data/release-notes///PLACEHOLDER.yml`. For example `data/release-notes/enterprise-server/3-1/PLACEHOLDER.yml`. Add the following placeholder content to the file: - - **Note:** All of the content in this file will be updated when the release notes are created in the megabranch including the filename `PLACEHOLDER.yml`. You can update the date or leave it as-is and wait to update it when the release notes are finalized. - -
Click to view placeholder... - - ```yaml - date: '2099-12-31' - release_candidate: true - deprecated: false - intro: | - {% note %} - - **Note:** If {% data variables.location.product_location %} is running a release candidate build, you can’t upgrade with a hotpatch. We recommend that you only run release candidates in a test environment. - - {% endnote %} - - For upgrade instructions, see "[Upgrading {% data variables.product.prodname_ghe_server %}](/admin/enterprise-management/updating-the-virtual-machine-and-physical-resources/upgrading-github-enterprise-server)." - sections: - # Remove section heading if the section contains no notes. - - features: - # Remove a sub-section heading if the heading contains no notes. If sections - # that regularly recur are missing, add placeholders to this template. - - - heading: Instance administration - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: Instance services - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: Identity and access management - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: Authentication - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: Migrations - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: Policies - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: Audit logs - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: GitHub Connect - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: GitHub Advanced Security - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: Dependabot - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: Code security - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: GitHub Actions - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: GitHub Packages - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: GitHub Pages - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: Community experience - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: Organizations - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: Repositories - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: Issues - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: Projects - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: GitHub Discussions - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: Commits - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: Pull requests - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: Releases - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: Gist - notes: - # LINK TO RELEASES ISSUE - - | - ... - - - heading: Markdown - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: Accessibility - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: GitHub Mobile - notes: - # LINK TO RELEASE ISSUE - - | - ... - - - heading: Integrations and extensions - notes: - # LINK TO RELEASE ISSUE - - | - ... - - changes: - # LINK TO RELEASE ISSUE - - | - ... - - known_issues: - # INCLUDE NOTES FOR RELEASE FROM "GHES Release Note Tracking" PROJECT'S "Known Issues" TAB - - | - ... - - deprecations: - # LINK TO RELEASE ISSUE - - | - ... - ``` -
- [ ] If this is a release candidate release, add a Release Candidate banner: ``` diff --git a/src/ghes-releases/scripts/sync-automated-pipeline-data.js b/src/ghes-releases/scripts/sync-automated-pipeline-data.js new file mode 100755 index 0000000000..199eb4bda3 --- /dev/null +++ b/src/ghes-releases/scripts/sync-automated-pipeline-data.js @@ -0,0 +1,158 @@ +#!/usr/bin/env node + +// [start-readme] +// +// This script adds and removes placeholder data files in the +// automation pipelines data directories and +// data/release-notes/enterprise-server directories. This script +// uses the supported and deprecated versions to determine what +// directories should exist. This script also modifies the `api-versions` +// key if it exists in a pipeline's lib/config.json file. +// +// [end-readme] + +import { existsSync } from 'fs' +import { readFile, readdir, writeFile, cp } from 'fs/promises' +import { rimraf } from 'rimraf' +import { difference, intersection } from 'lodash-es' +import { mkdirp } from 'mkdirp' + +import { deprecated, supported } from '../../../lib/enterprise-server-releases.js' + +const pipelines = JSON.parse(await readFile('src/automated-pipelines/lib/config.json'))[ + 'automation-pipelines' +] +await updateAutomatedConfigFiles(pipelines, supported, deprecated) + +// The allVersions object uses the 'api-versions' data stored in the +// src/rest/lib/config.json file. We want to update 'api-versions' +// before the allVersions object is created so we need to import it +// after calling updateAutomatedConfigFiles. +const { allVersions } = await import('../../../lib/all-versions.js') + +// Gets all of the base names (e.g., ghes-) in the allVersions object +// Currently, this is only ghes- but if we had more than one type of +// numbered release it would get all of them. +const numberedReleaseBaseNames = Array.from( + new Set([ + ...Object.values(allVersions) + .filter((version) => version.hasNumberedReleases) + .map((version) => version.openApiBaseName), + ]) +) + +// A list of currently supported versions (calendar date inclusive) +// in the format using the short name rather than full format +// (e.g., enterprise-server@). The list is filtered +// to only include versions that have numbered releases (e.g. ghes-). +// The list is generated from the `apiVersions` key in allVersions. +// This is currently only needed for the rest and github-apps pipelines. +const versionNamesCalDate = Object.values(allVersions) + .filter((version) => version.hasNumberedReleases) + .map((version) => + version.apiVersions.length + ? version.apiVersions.map((apiVersion) => `${version.openApiVersionName}-${apiVersion}`) + : version.openApiVersionName + ) + .flat() +// A list of currently supported versions in the format using the short name +// rather than the full format (e.g., enterprise-server@). The list is filtered +// to only include versions that have numbered releases (e.g. ghes-). +// Currently, this is used for the graphql and webhooks pipelines. +const versionNames = Object.values(allVersions) + .filter((version) => version.hasNumberedReleases) + .map((version) => version.openApiVersionName) + +for (const pipeline of pipelines) { + if (!existsSync(`src/${pipeline}/data`)) continue + const isCalendarDateVersioned = JSON.parse(await readFile(`src/${pipeline}/lib/config.json`))[ + 'api-versions' + ] + + const directoryListing = await readdir(`src/${pipeline}/data`) + // filter the directory list to only include directories that start with + // basenames with numbered releases (e.g., ghes-). + const existingDataDir = directoryListing.filter((directory) => + numberedReleaseBaseNames.some((basename) => directory.startsWith(basename)) + ) + const expectedDirectory = isCalendarDateVersioned ? versionNamesCalDate : versionNames + + // Get a list of data directories to remove (deprecate) and remove them + const removeFiles = difference(existingDataDir, expectedDirectory) + for (const directory of removeFiles) { + console.log(`Removing src/${pipeline}/data/${directory}`) + rimraf(`src/${pipeline}/data/${directory}`) + } + + // Get a list of data directories to create (release) and create them + const addFiles = difference(expectedDirectory, existingDataDir) + if (addFiles.length > numberedReleaseBaseNames.length) { + throw new Error( + 'Only one new release per numbered release version should be added at a time. Check that the lib/enterprise-server-releases.js is correct.' + ) + } + for (const base of numberedReleaseBaseNames) { + const dirToAdd = addFiles.find((item) => item.startsWith(base)) + if (!dirToAdd) continue + // The suppported array is ordered from most recent (index 0) to oldest + // Index 1 will be the release prior to the most recent release + const lastRelease = supported[1] + const previousDirName = existingDataDir.filter((directory) => directory.includes(lastRelease)) + + console.log( + `Copying src/${pipeline}/data/${previousDirName} to src/${pipeline}/data/${dirToAdd}` + ) + await cp(`src/${pipeline}/data/${previousDirName}`, `src/${pipeline}/data/${dirToAdd}`, { + recursive: true, + }) + } +} + +// Add and remove the GHES release note data. Once we create an automation +// pipeline for release notes, we can remove this because it will use the +// same directory structure as the other pipeline data directories. +const ghesReleaseNotesDirs = await readdir('data/release-notes/enterprise-server') +const supportedHyphenated = supported.map((version) => version.replace('.', '-')) +const deprecatedHyphenated = deprecated.map((version) => version.replace('.', '-')) +const addRelNoteDirs = difference(supportedHyphenated, ghesReleaseNotesDirs) +const removeRelNoteDirs = intersection(deprecatedHyphenated, ghesReleaseNotesDirs) +for (const directory of removeRelNoteDirs) { + console.log(`Removing data/release-notes/enterprise-server/${directory}`) + rimraf(`data/release-notes/enterprise-server/${directory}`) +} +for (const directory of addRelNoteDirs) { + console.log(`Create new directory data/release-notes/enterprise-server/${directory}`) + await mkdirp(`data/release-notes/enterprise-server/${directory}`) + await cp( + `data/release-notes/PLACEHOLDER-TEMPLATE.yml`, + `data/release-notes/enterprise-server/${directory}/PLACEHOLDER.yml` + ) +} + +// If the config file for a pipeline includes `api-versions` update that list +// based on the supported and deprecated releases. +async function updateAutomatedConfigFiles(pipelines, supported, deprecated) { + const [currentReleaseNumber, previousReleaseNumber] = supported + for (const pipeline of pipelines) { + const configFilepath = `src/${pipeline}/lib/config.json` + const configData = JSON.parse(await readFile(configFilepath)) + const apiVersions = configData['api-versions'] + if (!apiVersions) continue + for (const key of Object.keys(apiVersions)) { + // Copy the previous release's calendar date versions to the new release + if (key.includes(previousReleaseNumber)) { + const newKey = key.replace(previousReleaseNumber, currentReleaseNumber) + apiVersions[newKey] = apiVersions[key] + } + // Remove any deprecated versions + for (const deprecatedRelease of deprecated) { + if (key.includes(deprecatedRelease)) { + delete apiVersions[key] + } + } + } + const newConfigData = Object.assign({}, configData) + newConfigData['api-versions'] = apiVersions + await writeFile(configFilepath, JSON.stringify(newConfigData, null, 2)) + } +} diff --git a/src/github-apps/data/meta.json b/src/github-apps/data/meta.json deleted file mode 100644 index bc3703e797..0000000000 --- a/src/github-apps/data/meta.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "api-versions": { - "fpt": [ - "2022-11-28" - ], - "ghec": [ - "2022-11-28" - ] - } -} \ No newline at end of file diff --git a/src/github-apps/lib/config.json b/src/github-apps/lib/config.json index 09cb2ba196..5856bff10e 100644 --- a/src/github-apps/lib/config.json +++ b/src/github-apps/lib/config.json @@ -1,3 +1,11 @@ { + "api-versions": { + "fpt": [ + "2022-11-28" + ], + "ghec": [ + "2022-11-28" + ] + }, "sha": "4f01b320bd0b43272b52c0d70cfc69f10cebc977" } \ No newline at end of file diff --git a/src/graphql/lib/config.json b/src/graphql/lib/config.json new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/src/graphql/lib/config.json @@ -0,0 +1 @@ +{} \ No newline at end of file