Skip to content

Commit 453adc7

Browse files
authored
repo sync
2 parents 1f7580a + 6578f08 commit 453adc7

File tree

6 files changed

+139
-5
lines changed

6 files changed

+139
-5
lines changed

content/admin/enterprise-management/upgrade-requirements.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ versions:
2121

2222
### Recommendations
2323

24-
- Include as few upgrades as possible in your upgrade process. For example, instead of upgrading from {% data variables.product.prodname_enterprise %} {{ enterpriseVersions.supported[2] }} to {{ enterpriseVersions.supported[1] }} to {{ enterpriseVersions.latest }}, you could upgrade from {% data variables.product.prodname_enterprise %} {{ enterpriseVersions.supported[2] }} to {{ enterpriseVersions.latest }}.
24+
- Include as few upgrades as possible in your upgrade process. For example, instead of upgrading from {% data variables.product.prodname_enterprise %} {{ enterpriseServerReleases.supported[2] }} to {{ enterpriseServerReleases.supported[1] }} to {{ enterpriseServerReleases.latest }}, you could upgrade from {% data variables.product.prodname_enterprise %} {{ enterpriseServerReleases.supported[2] }} to {{ enterpriseServerReleases.latest }}.
2525
- If you’re several versions behind, upgrade {% data variables.product.product_location_enterprise %} as far forward as possible with each step of your upgrade process. Using the latest version possible on each upgrade allows you to take advantage of performance improvements and bug fixes. For example, you could upgrade from {% data variables.product.prodname_enterprise %} 2.7 to 2.8 to 2.10, but upgrading from {% data variables.product.prodname_enterprise %} 2.7 to 2.9 to 2.10 uses a later version in the second step.
2626
- Use the latest patch release when upgrading. {% data reusables.enterprise_installation.enterprise-download-upgrade-pkg %}
2727
- Use a staging instance to test the upgrade steps. For more information, see "[Setting up a staging instance](/enterprise/{{ currentVersion }}/admin/guides/installation/setting-up-a-staging-instance/)."
2828
- When running multiple upgrades, wait at least 24 hours between feature upgrades to allow data migrations and backgrounded upgrade tasks to fully complete.
2929

3030
### Requirements
3131

32-
- You must upgrade from a feature release that's **at most** two releases behind. For example, to upgrade to {% data variables.product.prodname_enterprise %} {{ enterpriseVersions.latest }}, you must be on {% data variables.product.prodname_enterprise %} {{ enterpriseVersions.supported[1] }} or {{ enterpriseVersions.supported[2] }}.
32+
- You must upgrade from a feature release that's **at most** two releases behind. For example, to upgrade to {% data variables.product.prodname_enterprise %} {{ enterpriseServerReleases.latest }}, you must be on {% data variables.product.prodname_enterprise %} {{ enterpriseServerReleases.supported[1] }} or {{ enterpriseServerReleases.supported[2] }}.
3333
- {% data reusables.enterprise_installation.hotpatching-explanation %}
3434
- A hotpatch may require downtime if the affected services (like kernel, MySQL, or Elasticsearch) require a VM reboot or a service restart. You'll be notified when a reboot or restart is required. You can complete the reboot or restart at a later time.
3535
- Additional root storage must be available when upgrading through hotpatching, as it installs multiple versions of certain services until the upgrade is complete. Pre-flight checks will notify you if you don't have enough root disk storage.

includes/error-404-deprecation-message.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% if enterpriseVersions.deprecated contains currentVersion %}
2-
{% assign deprecatedDate = enterpriseVersions.dates[currentVersion].deprecationDate %}
1+
{% if enterpriseServerReleases.deprecated contains currentVersion %}
2+
{% assign deprecatedDate = enterpriseServerReleases.dates[currentVersion].deprecationDate %}
33
<div class="deprecation-banner border rounded-1 mb-2 bg-yellow-light p-3 border-yellow f5">
44
<p>
55
<b>

middleware/context.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ module.exports = async function contextualize (req, res, next) {
3434
req.context.query = req.query
3535
req.context.languages = languages
3636
req.context.earlyAccessPaths = earlyAccessPaths
37-
req.context.enterpriseVersions = enterpriseServerReleases
3837
req.context.productNames = productNames
3938
req.context.enterpriseServerReleases = enterpriseServerReleases
39+
req.context.enterpriseServerVersions = Object.keys(allVersions).filter(version => version.startsWith('enterprise-server@'))
4040
req.context.redirects = redirects
4141
req.context.site = site[req.language].site
4242
req.context.siteTree = siteTree
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env node
2+
3+
const fs = require('fs')
4+
const path = require('path')
5+
const walk = require('walk-sync')
6+
const frontmatter = require('@github-docs/frontmatter')
7+
const contentPath = path.join(process.cwd(), 'content')
8+
const dataPath = path.join(process.cwd(), 'data')
9+
10+
// [start-readme]
11+
//
12+
// Run this script to update these Liquid conditionals:
13+
//
14+
// {% if currentVersion != 'free-pro-team@latest' %}
15+
//
16+
// to:
17+
//
18+
// {% if enterpriseServerVersions contains currentVersion %}
19+
//
20+
// [end-readme]
21+
22+
// The new conditional to add
23+
const newConditional = 'enterpriseServerVersions contains currentVersion'
24+
25+
// The old conditional to replace
26+
const oldConditional = /currentVersion != ["']free-pro-team@latest["']/g
27+
28+
console.log('Working...\n')
29+
30+
const englishContentFiles = walkContent(contentPath)
31+
const englishDataFiles = walkData(dataPath, englishContentFiles)
32+
33+
function walkContent (dirPath) {
34+
return walk(dirPath, { includeBasePath: true, directories: false })
35+
.filter(file => file.includes('/content/'))
36+
.filter(file => file.endsWith('.md'))
37+
.filter(file => !file.endsWith('README.md'))
38+
}
39+
40+
function walkData (dirPath, contentFiles) {
41+
return walk(dirPath, { includeBasePath: true, directories: false })
42+
.filter(file => file.includes('/data/reusables') || file.includes('/data/variables'))
43+
.filter(file => !file.endsWith('README.md'))
44+
}
45+
46+
englishDataFiles
47+
.forEach(file => {
48+
const dataContent = fs.readFileSync(file, 'utf8')
49+
50+
// Update Liquid in data files
51+
const newDataContent = updateLiquid(dataContent, file)
52+
53+
fs.writeFileSync(file, newDataContent)
54+
})
55+
56+
englishContentFiles
57+
.forEach(file => {
58+
const { data, content } = frontmatter(fs.readFileSync(file, 'utf8'))
59+
60+
// Update Liquid in content files
61+
const newContent = updateLiquid(content, file)
62+
63+
// Update Liquid in frontmatter props
64+
Object.keys(data)
65+
.filter(key => typeof data[key] === 'string')
66+
.forEach(key => {
67+
data[key] = updateLiquid(data[key], file)
68+
})
69+
70+
fs.writeFileSync(file, frontmatter.stringify(newContent, data, { lineWidth: 10000 }))
71+
})
72+
73+
function updateLiquid (content) {
74+
return content.replace(oldConditional, newConditional)
75+
}
76+
77+
console.log('Done!')
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: Page versioned for all Enterprise releases
3+
versions:
4+
free-pro-team: '*'
5+
enterprise-server: '*'
6+
---
7+
8+
{% if currentVersion == 'free-pro-team@latest' %}
9+
10+
This text should only render on non-Enterprise
11+
12+
{% endif %}
13+
14+
15+
{% if enterpriseServerVersions contains currentVersion %}
16+
17+
This text should render on any actively supported version of Enterprise Server
18+
19+
{% endif %}

tests/unit/page.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const path = require('path')
22
const cheerio = require('cheerio')
33
const Page = require('../../lib/page')
4+
const allVersionIds = Object.keys(require('../../lib/all-versions'))
45
const enterpriseServerReleases = require('../../lib/enterprise-server-releases')
56
const nonEnterpriseDefaultVersion = require('../../lib/non-enterprise-default-version')
67
// get the `free-pro-team` segment of `free-pro-team@latest`
@@ -121,6 +122,43 @@ describe('Page class', () => {
121122
const $ = cheerio.load(rendered)
122123
expect($('a[href="/capistrano"]').length).toBe(1)
123124
})
125+
126+
// Most of our Liquid versioning tests are in https://github.com/docs/render-content,
127+
// But they don't have access to our currently supported versions, which we're testing here.
128+
// This test ensures that this works as expected: {% if enterpriseServerVersions contains currentVersion %}
129+
test('renders the expected Enterprise Server versioned content', async () => {
130+
const page = new Page({
131+
relativePath: 'page-versioned-for-all-enterprise-releases.md',
132+
basePath: path.join(__dirname, '../fixtures'),
133+
languageCode: 'en'
134+
})
135+
// set version to the latest enteprise version
136+
const context = {
137+
currentVersion: `enterprise-server@${enterpriseServerReleases.latest}`,
138+
currentLanguage: 'en',
139+
enterpriseServerVersions: allVersionIds.filter(id => id.startsWith('enterprise-server@'))
140+
}
141+
let rendered = await page.render(context)
142+
let $ = cheerio.load(rendered)
143+
expect($.text()).toBe('This text should render on any actively supported version of Enterprise Server')
144+
expect($.text()).not.toBe('This text should only render on non-Enterprise')
145+
146+
// change version to the oldest enterprise version, re-render, and test again;
147+
// the results should be the same
148+
context.currentVersion = `enterprise-server@${enterpriseServerReleases.oldestSupported}`
149+
rendered = await page.render(context)
150+
$ = cheerio.load(rendered)
151+
expect($.text()).toBe('This text should render on any actively supported version of Enterprise Server')
152+
expect($.text()).not.toBe('This text should only render on non-Enterprise')
153+
154+
// change version to non-enterprise, re-render, and test again;
155+
// the results should be the opposite
156+
context.currentVersion = nonEnterpriseDefaultVersion
157+
rendered = await page.render(context)
158+
$ = cheerio.load(rendered)
159+
expect($.text()).not.toBe('This text should render on any actively supported version of Enterprise Server')
160+
expect($.text()).toBe('This text should only render on non-Enterprise')
161+
})
124162
})
125163

126164
test('preserves `languageCode`', () => {

0 commit comments

Comments
 (0)