Skip to content

Commit a41a1f1

Browse files
Merge branch 'master' into fix/event-page-performance
2 parents 8dcfabd + 9166fdd commit a41a1f1

4 files changed

Lines changed: 162 additions & 86 deletions

File tree

.github/workflows/build-and-preview-site.yml

Lines changed: 110 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,17 @@ concurrency:
1313
group: preview-${{ github.event.pull_request.number || github.run_id }}
1414
cancel-in-progress: true
1515

16+
defaults:
17+
run:
18+
shell: bash
19+
1620
jobs:
1721
preview:
1822
runs-on: ubuntu-latest
23+
outputs:
24+
removed_prs_json: ${{ steps.prune-previews.outputs.removed_prs_json }}
25+
env:
26+
PREVIEW_RETENTION_LIMIT: 6
1927

2028
steps:
2129

@@ -67,15 +75,116 @@ jobs:
6775
action: auto
6876
comment: false
6977

78+
- name: Checkout gh-pages for preview retention
79+
if: github.event.action != 'closed'
80+
uses: actions/checkout@v4
81+
with:
82+
ref: gh-pages
83+
fetch-depth: 0
84+
path: gh-pages-maintenance
85+
86+
- name: Prune old PR previews
87+
id: prune-previews
88+
if: github.event.action != 'closed'
89+
run: |
90+
cd gh-pages-maintenance
91+
mkdir -p pr-preview
92+
removed_prs=()
93+
94+
mapfile -t previews < <(
95+
while IFS= read -r preview; do
96+
timestamp="$(git log -1 --format=%ct -- "pr-preview/$preview" 2>/dev/null || echo 0)"
97+
printf '%s %s\n' "$timestamp" "$preview"
98+
done < <(find pr-preview -mindepth 1 -maxdepth 1 -type d -name 'pr-*' -printf '%f\n') \
99+
| sort -nr \
100+
| awk '{print $2}'
101+
)
102+
103+
if (( ${#previews[@]} <= PREVIEW_RETENTION_LIMIT )); then
104+
echo "removed_prs_json=[]" >> "$GITHUB_OUTPUT"
105+
exit 0
106+
fi
107+
108+
for preview in "${previews[@]:PREVIEW_RETENTION_LIMIT}"; do
109+
rm -rf "pr-preview/$preview"
110+
removed_prs+=("${preview#pr-}")
111+
done
112+
113+
if git diff --quiet -- pr-preview; then
114+
echo "removed_prs=" >> "$GITHUB_OUTPUT"
115+
echo "removed_prs_json=[]" >> "$GITHUB_OUTPUT"
116+
exit 0
117+
fi
118+
119+
git config user.name "github-actions[bot]"
120+
git config user.email "github-actions[bot]@users.noreply.github.com"
121+
git add pr-preview
122+
git commit -m "Prune old PR previews"
123+
git push
124+
125+
echo "removed_prs=$(IFS=,; echo "${removed_prs[*]}")" >> "$GITHUB_OUTPUT"
126+
echo "removed_prs_json=$(printf '%s\n' "${removed_prs[@]}" | jq -R . | jq -sc .)" >> "$GITHUB_OUTPUT"
127+
70128
- name: Comment PR with Preview URL
71129
if: github.event.action != 'closed'
72130
uses: marocchino/sticky-pull-request-comment@v2
73131
with:
74132
header: pr-preview
75133
message: |
76134
🚀 Preview deployment: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.pull_request.number }}/
135+
> *Note: Preview may take a moment (GitHub Pages deployment in progress). Please wait and refresh. Track deployment [here](https://github.com/${{ github.repository }}/actions/workflows/pages/pages-build-deployment)*
136+
137+
- name: Comment on pruned previews
138+
if: github.event.action != 'closed' && steps.prune-previews.outputs.removed_prs_json != '[]'
139+
uses: actions/github-script@v7
140+
env:
141+
REMOVED_PRS_JSON: ${{ steps.prune-previews.outputs.removed_prs_json }}
142+
PREVIEW_RETENTION_LIMIT: ${{ env.PREVIEW_RETENTION_LIMIT }}
143+
with:
144+
script: |
145+
const removedPrs = JSON.parse(process.env.REMOVED_PRS_JSON);
146+
const retentionLimit = process.env.PREVIEW_RETENTION_LIMIT;
147+
const header = "pr-preview";
148+
const marker = `<!-- Sticky Pull Request Comment${header} -->`;
149+
150+
for (const prNumber of removedPrs) {
151+
const body =
152+
`Preview deployment for PR #${prNumber} removed.\n\n` +
153+
`This PR preview was automatically pruned because we keep only the ${retentionLimit} most recently updated previews on GitHub Pages to stay within deployment size limits.\n\n` +
154+
`If needed, push a new commit to this PR to generate a fresh preview.\n` +
155+
`${marker}`;
156+
157+
const { data: comments } = await github.rest.issues.listComments({
158+
owner: context.repo.owner,
159+
repo: context.repo.repo,
160+
issue_number: Number(prNumber),
161+
per_page: 100,
162+
});
163+
164+
const existingComment = [...comments].reverse().find((comment) =>
165+
comment.user?.login === "github-actions[bot]" &&
166+
comment.body?.includes(marker)
167+
);
168+
169+
if (existingComment) {
170+
await github.rest.issues.updateComment({
171+
owner: context.repo.owner,
172+
repo: context.repo.repo,
173+
comment_id: existingComment.id,
174+
body,
175+
});
176+
continue;
177+
}
178+
179+
await github.rest.issues.createComment({
180+
owner: context.repo.owner,
181+
repo: context.repo.repo,
182+
issue_number: Number(prNumber),
183+
body,
184+
});
185+
}
77186
78-
- name: Cleanup PR preview
187+
- name: Cleanup PR preview on close
79188
if: github.event.action == 'closed'
80189
uses: rossjrw/[email protected]
81190
with:

src/sections/Kanvas/index.js

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import React from "react";
2+
import { StaticImage } from "gatsby-plugin-image";
23
import KanvasWrapper from "./kanvas.style";
34
import { Container } from "../../reusecore/Layout";
45
import Features from "../../components/Features-carousel";
56
import KanvasModes from "./kanvas-modes";
67
import Catalog from "./kanvas-catalog";
78
import Platform from "./kanvas-platform";
89
import KanvasBanner from "./kanvas_banner";
9-
import designerImage from "../../assets/images/kanvas/KanvasDesigner.webp";
10-
import visualizerImage from "../../assets/images/kanvas/KanvasVisualizer.webp";
1110
import DesignerFeatures from "./FeaturesSection/Design/DesignerFeatures";
1211
import CollaboratorFeatures from "./FeaturesSection/Collaborate/CollaboratorFeatures";
1312
import VisualizerFeatures from "./FeaturesSection/Visualize/VisualizerFeatures";
@@ -28,9 +27,6 @@ import { ReactComponent as Collab2 } from "./FeaturesSection/Collaborate/images/
2827
import { ReactComponent as Collab3 } from "./FeaturesSection/Collaborate/images/collab3-colorMode.svg";
2928
import { ReactComponent as Collab4 } from "./FeaturesSection/Collaborate/images/collab4-colorMode.svg";
3029

31-
import Avatar1 from "./FeaturesSection/Collaborate/images/avatar1.webp";
32-
import Avatar2 from "./FeaturesSection/Collaborate/images/avatar2.webp";
33-
import Avatar3 from "./FeaturesSection/Collaborate/images/avatar3.webp";
3430
import Kaur from "../../sections/Pricing/reviews/kaur-kallas.webp";
3531
import Ala from "../../sections/Pricing/reviews/ala-eddine-benhassir.jpeg";
3632
import Phillip from "../../sections/Pricing/reviews/phillip-ulberg.jpeg";
@@ -56,12 +52,10 @@ const Kanvas = (props) => {
5652
description:
5753
"Drag-and-drop your cloud native infrastructure using a palette of thousands of versioned Kubernetes components and Cloud services. Collaborate wtih teammates using this self-service engineering platform. Using GitOps? Integrate advanced performance analysis into your pipeline.",
5854
content: (
59-
<img
60-
src={designerImage}
55+
<StaticImage
56+
src="../../assets/images/kanvas/KanvasDesigner.webp"
6157
alt="Designer Mode"
6258
className="designer-img modes-image"
63-
width="100%"
64-
height="auto"
6559
style={{ aspectRatio: "16/9" }}
6660
/>
6761
),
@@ -71,12 +65,10 @@ const Kanvas = (props) => {
7165
description:
7266
"Operator offers an interactive topology of your Kubernetes clusters with live terminal sessions, log streaming and performance testing of your applications. Designs created in Designer mode can be deployed and viewed as running in your environment using Operator.",
7367
content: (
74-
<img
75-
src={visualizerImage}
68+
<StaticImage
69+
src="../../assets/images/kanvas/KanvasVisualizer.webp"
7670
alt="Operator Mode"
7771
className="modes-image"
78-
width="100%"
79-
height="auto"
8072
style={{ aspectRatio: "16/9" }}
8173
/>
8274
),
@@ -165,13 +157,13 @@ const Kanvas = (props) => {
165157
description: "Designer and Operator live side-by-side, so all design work, from ideation to operation, can be found in one place.",
166158
imgContent: (
167159
<>
168-
<img
160+
<StaticImage
169161
id="avatar-1"
170-
src={Avatar1}
162+
src="./FeaturesSection/Collaborate/images/avatar1.webp"
171163
alt=""
172-
width="48"
173-
height="48"
174-
style={{ objectFit: "cover" }}
164+
width={48}
165+
height={48}
166+
imgStyle={{ objectFit: "cover" }}
175167
/>
176168
<Collab1 id="collaborate-image1" alt="collaborate-image1" />
177169
</>
@@ -187,13 +179,13 @@ const Kanvas = (props) => {
187179
description: "Build an iterative design flow with live collaboration that keeps you in the loop whether you're working in the office or remotely.",
188180
imgContent: (
189181
<>
190-
<img
182+
<StaticImage
191183
id="avatar-2"
192-
src={Avatar2}
184+
src="./FeaturesSection/Collaborate/images/avatar2.webp"
193185
alt="avatar-2"
194-
width="48"
195-
height="48"
196-
style={{ objectFit: "cover" }}
186+
width={48}
187+
height={48}
188+
imgStyle={{ objectFit: "cover" }}
197189
/>
198190
<Collab2 id="collaborate-image2" alt="collaborate-image2" />
199191
</>
@@ -204,13 +196,13 @@ const Kanvas = (props) => {
204196
description: "Build an iterative design flow with live collaboration that keeps you in the loop whether you're working in the office or remotely.",
205197
imgContent: (
206198
<>
207-
<img
199+
<StaticImage
208200
id="avatar-3"
209-
src={Avatar3}
201+
src="./FeaturesSection/Collaborate/images/avatar3.webp"
210202
alt="avatar-3"
211-
width="48"
212-
height="48"
213-
style={{ objectFit: "cover" }}
203+
width={48}
204+
height={48}
205+
imgStyle={{ objectFit: "cover" }}
214206
/>
215207
<Collab3 id="collaborate-image3" alt="collaborate-image3" />
216208
</>
@@ -225,13 +217,13 @@ const Kanvas = (props) => {
225217
description: "Kanvas is an end-to-end management platform, here to help teams understand problems, explore options, and build solutions—together.",
226218
imgContent: (
227219
<>
228-
<img
220+
<StaticImage
229221
id="avatar-3"
230-
src={Avatar3}
222+
src="./FeaturesSection/Collaborate/images/avatar3.webp"
231223
alt="avatar-3"
232-
width="48"
233-
height="48"
234-
style={{ objectFit: "cover" }}
224+
width={48}
225+
height={48}
226+
imgStyle={{ objectFit: "cover" }}
235227
/>
236228
<Collab4 id="collaborate-image4" alt="collaborate-image4" />
237229
</>

0 commit comments

Comments
 (0)