Skip to content

Commit

Permalink
Merge branch 'main' into patch-5
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwcarlson authored Dec 16, 2024
2 parents 15023e8 + d44a9dd commit 87f9acc
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 18 deletions.
6 changes: 5 additions & 1 deletion .github/actions/redirection-verification/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ inputs:
description: 'Pull Request Environment URL'
required: true
number_retries:
description: 'The number of attempts we should make to contact the target environment URL. 1 second delay between attempt.'
description: 'The number of attempts we should make to contact the target environment URL.'
required: false
default: '100'
retry_sleep:
description: 'The length of time (in ms) to pause between each attempt at trying the redirect.'
required: false
default: '1000'

####
#outputs:
Expand Down
56 changes: 40 additions & 16 deletions .github/actions/redirection-verification/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,58 @@ function linkify(path,url) {
axios.defaults.baseURL = core.getInput('environment-url')
//axios.defaults.baseURL = 'https://httpstat.us/random/200,500-504,500-504,500-504'
const retries = Number(core.getInput('number_retries'))
const retrySleep = Number(core.getInput('retry_sleep'))
//const retries = Number('100')
function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}

const verifyTargetResponse = async(count = 0) => {
const retryTargetResponse = async (url='/',count=0) => {
try {
const axiosResponse = await axios.get('/');
core.notice('Target URL finally responded with a 200. Proceeding.')
const axiosResponse = await axios.head(url);
return axiosResponse;
} catch (error) {
if (error || error.status != 200) {
core.info(`At attempt ${count}, target url responded with status ${error.status}, retrying...`)
if(error || error.status != 200) {
core.debug(`At attempt ${count}, target url ${url} responded with status ${error.status}, retrying...`)
if (count++ < retries) {
await sleep(1000);
return verifyTargetResponse(count);
await sleep(retrySleep)
return retryTargetResponse(url,count)
} else {
core.setFailed(`Max number of retries (${retries}) reached. Aborting.`)
};
core.warning(`Max number of retries ${retries} for end point ${url} reached. Aborting.`)
throw new Error(error)
}
} else {
core.setFailed(`Action failed with error ${error}`)
};
};
};
core.warning(`Action failed with error ${error}`)
throw new Error(error)
}
}
}

// const verifyTargetResponse = async(count = 0) => {
// try {
// const axiosResponse = await axios.get('/');
// core.notice('Target URL finally responded with a 200. Proceeding.')
// return axiosResponse;
// } catch (error) {
// if (error || error.status != 200) {
// core.info(`At attempt ${count}, target url responded with status ${error.status}, retrying...`)
// if (count++ < retries) {
// await sleep(1000);
// return verifyTargetResponse(count);
// } else {
// core.setFailed(`Max number of retries (${retries}) reached. Aborting.`)
// };
// } else {
// core.setFailed(`Action failed with error ${error}`)
// };
// };
// };

const verify = async () => {
let targetReady = await verifyTargetResponse();
// let targetReady = await verifyTargetResponse();
let targetReady = await retryTargetResponse('/');
core.info('Target URL ready. Beginning verification.')
try {
/**
Expand All @@ -90,12 +113,13 @@ const verify = async () => {
core.debug(`I'm going to test ${path} to see if it goes to ${anchors[path].to}`)

try {
const response = await axios.head(path);
const response = await retryTargetResponse(path);
//const response = await axios.head(path);
core.debug(`Response for our check of ${path} is ${response.status}`)
return response
} catch (reqerr) {
// core.debug(`issue encountered with path ${path}!!! Returned status is ${reqerr.status}. More info: `)
core.info(`issue encountered with path ${path}!!! Returned status is ${reqerr.status}. More info: `)
core.debug(`issue encountered with path ${path}!!! Returned status is ${reqerr.status}. More info: `)
core.debug(JSON.stringify(reqerr))
if(axios.isAxiosError(reqerr)) {
// core.debug(reqerr.toJSON())
Expand Down
1 change: 1 addition & 0 deletions shared/data/registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,7 @@
"7.1"
],
"supported": [
"7.6",
"7.3",
"7.2",
"6.0"
Expand Down
1 change: 1 addition & 0 deletions sites/platform/src/guides/symfony/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "Symfony"
weight: -150
partner: true
description: |
Everything you need to get started with [Symfony](https://www.symfony.com/), a [PHP](../../development/templates.md#php) framework for web development, on {{% vendor/name %}}.
---
Expand Down
3 changes: 2 additions & 1 deletion sites/upsun/src/get-started/stacks/symfony/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Deploy Symfony on {{% vendor/name %}}
sidebarTitle: Symfony
layout: single
partner: true
weight: -60
description: |
Complete the last required steps to successfully deploy Symfony on {{% vendor/name %}}.
Expand Down Expand Up @@ -43,4 +44,4 @@ They provide all of the core concepts and common commands you need to know befor
- [Refactoring monolith to multi-app](https://youtu.be/5hApjWiTO1M?feature=shared)
- [{{% vendor/name %}}: From zero to scaling hero](https://youtu.be/FEFBUomV5aY?feature=shared)

{{< guide-buttons next="Get started" nextLink="/get-started/stacks/symfony/get-started.md" type="*" >}}
{{< guide-buttons next="Get started" nextLink="/get-started/stacks/symfony/get-started.md" type="*" >}}

0 comments on commit 87f9acc

Please sign in to comment.