Skip to content

Commit

Permalink
parsing k8s version
Browse files Browse the repository at this point in the history
  • Loading branch information
c-pius committed Apr 8, 2024
1 parent dc2390e commit c5c2559
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
17 changes: 15 additions & 2 deletions .github/actions/install-kubectl/action.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
name: Install kubectl
description: Downloads kubectl and installs it locally. Follows the instructions for Debian-based distributions at https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/#install-using-native-package-management.
inputs:
k8s_version:
description: 'The version of Kubernetes to install. For example, 1.28.7.'
required: true
runs:
using: "composite"
steps:
- name: Parse K8s minor version
id: parse_k8s_minor_version
shell: bash
run: |
split=( ${{ inputs.k8s_version//./ }} )
k8s_minor_version=${split[0]}.${split[1]}
echo Using K8s minor version ${k8s_minor_version}
echo "k8s_minor_version=${k8s_minor_version}" >> $GITHUB_OUTPUT
- name: Download the public signing key for the Kubernetes package repositories
shell: bash
run: |
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --batch --yes --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
curl -fsSL https://pkgs.k8s.io/core:/stable:/v${{ steps.parse_k8s_minor_version.outputs.k8s_minor_version }}/deb/Release.key | sudo gpg --batch --yes --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
- name: Add the appropriate Kubernetes apt repository
shell: bash
run: |
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v${{ steps.parse_k8s_minor_version.outputs.k8s_minor_version }}/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
- name: Install kubectl
shell: bash
run: |
Expand Down
6 changes: 6 additions & 0 deletions .github/actions/setup-tools/action.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Setup tools
description: Downloads, installs and configures all the tools needed to setup and run the tests.
inputs:
k8s_version:
description: 'The version of Kubernetes to install. For example, 1.28.7.'
required: true
runs:
using: "composite"
steps:
- uses: ./.github/actions/install-kubectl
with:
k8s_version: ${{ inputs.k8s_version }}
4 changes: 4 additions & 0 deletions .github/workflows/test-e2e-junk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ jobs:
e2e-integration:
needs: wait-for-image-build
runs-on: ubuntu-latest
env:
K8S_VERSION: 1.28.7
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-tools
with:
k8s_version: ${{ env.K8S_VERSION }}

0 comments on commit c5c2559

Please sign in to comment.