ENG-4153 | Document setting up GKE Workload Identity/EKS Pod Identity #116
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: e2e-examples | |
on: | |
pull_request: | |
branches: | |
- '**' | |
repository_dispatch: | |
types: [trigger-workflow] | |
jobs: | |
test-docs: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
file-path: | |
- vcluster/deploy/topologies/multi-namespace-mode.mdx | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
- name: Install Runme CLI | |
run: npm install -g runme | |
- name: Install kubectl | |
run: | | |
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl" | |
chmod +x ./kubectl | |
sudo mv ./kubectl /usr/local/bin/kubectl | |
- name: Check if version is provided | |
id: check-version | |
run: | | |
if [ -z "${{ github.event.inputs.version }}" ]; then | |
echo "Version not provided" | |
echo "run-list-releases=true" >> $GITHUB_ENV | |
else | |
echo "Version provided: ${{ github.event.inputs.version }}" | |
echo "run-list-releases=false" >> $GITHUB_ENV | |
fi | |
- name: List releases of another repository | |
id: list-releases | |
if: env.run-list-releases == 'true' | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const owner = 'loft-sh'; | |
const repo = 'vcluster'; | |
// Fetch all releases including pre-releases | |
const releases = await github.rest.repos.listReleases({ | |
owner: owner, | |
repo: repo | |
}); | |
// Function to compare version strings | |
function compareVersions(v1, v2) { | |
const v1parts = v1.replace(/^v/, '').split('.').map(Number); | |
const v2parts = v2.replace(/^v/, '').split('.').map(Number); | |
for (let i = 0; i < Math.max(v1parts.length, v2parts.length); i++) { | |
if ((v1parts[i] || 0) > (v2parts[i] || 0)) return 1; | |
if ((v1parts[i] || 0) < (v2parts[i] || 0)) return -1; | |
} | |
return 0; | |
} | |
// Filter and find the latest release or pre-release with version > 0.19 | |
const minVersion = '0.19.0'; | |
const latestRelease = releases.data | |
.filter(release => compareVersions(release.tag_name, minVersion) > 0) | |
.sort((a, b) => compareVersions(b.tag_name, a.tag_name))[0]; | |
if (latestRelease) { | |
console.log(`Latest release found: ${latestRelease.tag_name}`); | |
core.setOutput('latest-release', latestRelease.tag_name); | |
} else { | |
console.log('No release found with version > 0.19'); | |
core.setOutput('latest-release', ''); | |
} | |
- name: Display latest release | |
if: env.run-list-releases == 'true' | |
run: | | |
echo "Latest vcluster release: ${{ steps.list-releases.outputs.latest-release }}" | |
- name: Install vcluster CLI | |
run: | | |
version=${{ github.event.inputs.version || steps.list-releases.outputs.latest-release }} | |
curl -LO "https://github.com/loft-sh/vcluster/releases/download/${version}/vcluster-linux-amd64" | |
chmod +x ./vcluster-linux-amd64 | |
sudo mv ./vcluster-linux-amd64 /usr/local/bin/vcluster | |
- name: Set up kind | |
run: | | |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64 | |
chmod +x ./kind | |
sudo mv ./kind /usr/local/bin/kind | |
- name: Run documentation tests with Runme | |
run: | | |
runme run -a --skip-prompts --filename ${{ matrix.file-path }} |