-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve vulnerabilities from dependencies (#447)
* update dependencies * update dependencies * add workflows based on PR labels * add workflows based on PR labels * fix lint issues * fix lint issues * add checkout step * fix kubectl command * fix env * fix token
- Loading branch information
1 parent
ce54393
commit b6212a7
Showing
10 changed files
with
1,375 additions
and
1,196 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Push PR Image on Label | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
types: [ labeled ] | ||
|
||
env: | ||
KUBERNETES_VERSION: "1.30.0" | ||
KIND_VERSION: "0.23.0" | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
|
||
push-image: | ||
runs-on: ubuntu-latest | ||
name: Push PR Image | ||
if: ${{ github.event.label.name == 'build-push-image' }} | ||
steps: | ||
|
||
- name: Remove the test label | ||
uses: actions-ecosystem/action-remove-labels@v1 | ||
with: | ||
labels: build-push-image | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{github.event.pull_request.head.sha}} | ||
|
||
- name: Generate Tag | ||
id: generate_tag | ||
run: | | ||
sha=${{ github.event.pull_request.head.sha }} | ||
tag="SNAPSHOT-PR-${{ github.event.pull_request.number }}-${sha:0:8}" | ||
echo "GIT_TAG=$(echo ${tag})" >> $GITHUB_OUTPUT | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Generate image repository path for ghcr registry | ||
run: | | ||
echo GHCR_IMAGE_REPOSITORY=${{env.REGISTRY}}/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV | ||
- name: Login to ghcr registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{env.REGISTRY}} | ||
username: stakater-user | ||
password: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: Build and Push image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ${{ env.DOCKER_FILE_PATH }} | ||
pull: true | ||
push: true | ||
cache-to: type=inline | ||
build-args: BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }} | ||
platforms: linux/amd64,linux/arm,linux/arm64 | ||
tags: | | ||
${{ env.GHCR_IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }} | ||
labels: | | ||
org.opencontainers.image.source=${{ github.event.repository.clone_url }} | ||
org.opencontainers.image.created=${{ steps.prep.outputs.created }} | ||
org.opencontainers.image.revision=${{ github.sha }} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Run Tests on PR Label | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
types: [ labeled ] | ||
|
||
env: | ||
KUBERNETES_VERSION: "1.30.0" | ||
KIND_VERSION: "0.23.0" | ||
|
||
jobs: | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
name: Test | ||
if: ${{ github.event.label.name == 'ok-to-test' }} | ||
steps: | ||
|
||
- name: Remove the test label | ||
uses: actions-ecosystem/action-remove-labels@v1 | ||
with: | ||
labels: ok-to-test | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{github.event.pull_request.head.sha}} | ||
|
||
- name: Set up Go | ||
id: go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: 'go.mod' | ||
|
||
- name: Install Dependencies | ||
run: | | ||
make install | ||
- name: Install kubectl | ||
run: | | ||
curl -LO "https://storage.googleapis.com/kubernetes-release/release/v${KUBERNETES_VERSION}/bin/linux/amd64/kubectl" | ||
sudo install ./kubectl /usr/local/bin/ && rm kubectl | ||
kubectl version --client=true | ||
- name: Install Kind | ||
run: | | ||
curl -L -o kind https://github.com/kubernetes-sigs/kind/releases/download/v${KIND_VERSION}/kind-linux-amd64 | ||
sudo install ./kind /usr/local/bin && rm kind | ||
kind version | ||
kind version | grep -q ${KIND_VERSION} | ||
- name: Create Kind Cluster | ||
run: | | ||
kind create cluster | ||
kubectl cluster-info | ||
- name: Test | ||
run: make test |
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
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
Oops, something went wrong.