Skip to content

Commit

Permalink
Merge pull request #2 from ThinkParQ/repository-migration
Browse files Browse the repository at this point in the history
Migrate repository to the ThinkParQ organization
  • Loading branch information
iamjoemccormick authored Jul 24, 2023
2 parents e357625 + a6c4a02 commit a935ee4
Show file tree
Hide file tree
Showing 55 changed files with 1,403 additions and 4,371 deletions.
360 changes: 360 additions & 0 deletions .github/workflows/build-test-publish-operator.yaml

Large diffs are not rendered by default.

262 changes: 262 additions & 0 deletions .github/workflows/build-test-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
name: "Test and Publish BeeGFS CSI Driver"

on:
workflow_dispatch:
push:
branches:
- "master"
tags:
- "v*"
pull_request:
branches:
- "master"

env:
# Container image registry to publish images to:
REGISTRY: ghcr.io
# Where to push an image of the CSI driver that will be retained (for master builds or releases) without a specific tag:
IMAGE_NAME: ghcr.io/thinkparq/beegfs-csi-driver
# Where to push an image of the CSI driver for testing (including the operator) without a specific tag:
TEST_IMAGE_NAME: ghcr.io/thinkparq/test-beegfs-csi-driver

# Note for all test images the github.sha will be used as the tag.

jobs:
build-and-unit-test:
runs-on: ubuntu-22.04
timeout-minutes: 5
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v3
with:
# Work around for how release-tools verify-subtree.sh verifies release-tools has not been modified.
fetch-depth: "0"

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.4
# Dependencies are cached by default: https://github.com/actions/setup-go#v4
# This can be explicitly disabled if it ever causes problems.

- name: Build the container image
run: |
export SHELL=/bin/bash
make container
echo -n "verifying images:"
docker images
- name: Install test dependencies
run: |
go install github.com/onsi/ginkgo/v2/[email protected]
timeout-minutes: 5

- name: Run unit tests
run: |
ACK_GINKGO_DEPRECATIONS=1.16.5 TESTARGS="-v -ginkgo.v" make test
# TODO: Consider if we should write the results to a file and keep it as an artifact.
# For example using: https://github.com/marketplace/actions/junit-report-action
# TODO: Can we cache anything here? test-vendor downloads a lot of stuff.
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go#caching-dependencies

- name: Log into the GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Push the image for reuse in subsequent steps, jobs, and workflows.
# For now just tag with the commit ID to ensure subsequent jobs in this workflow run use the correct image.
- name: Tag and push the CSI driver as a test package
run: |
docker tag beegfs-csi-driver:latest ${{ env.TEST_IMAGE_NAME }}:${{ github.sha }}
docker push ${{ env.TEST_IMAGE_NAME }}:${{ github.sha }}
e2e-tests:
runs-on: ubuntu-22.04
timeout-minutes: 10
needs: build-and-unit-test
strategy:
fail-fast: true
matrix:
k8s-version: [1.24.15, 1.25.11, 1.26.3, 1.27.3]
beegfs-version: [7.3.4]
permissions:
packages: read
contents: read
steps:
- uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Deploy Kubernetes ${{ matrix.k8s-version }} using Minikube
uses: medyagh/setup-minikube@latest
with:
driver: none
kubernetes-version: ${{ matrix.k8s-version }}

- name: Deploy BeeGFS ${{ matrix.beegfs-version }} for testing
run: |
export BEEGFS_VERSION=$(echo ${{ matrix.beegfs-version }})
export BEEGFS_SECRET=$(echo ${{ secrets.CONN_AUTH_SECRET }})
envsubst < test/env/beegfs-ubuntu/beegfs-fs-1.yaml | kubectl apply -f -
kubectl get pods -A
# TODO: Cache BeeGFS packages https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows
# https://stackoverflow.com/questions/59269850/caching-apt-packages-in-github-actions-workflow
- name: Install the BeeGFS ${{ matrix.beegfs-version }} DKMS client
run: |
sudo wget -P /etc/apt/sources.list.d/. https://www.beegfs.io/release/beegfs_${{ matrix.beegfs-version }}/dists/beegfs-focal.list
sudo wget -q https://www.beegfs.io/release/beegfs_${{ matrix.beegfs-version }}/gpg/GPG-KEY-beegfs -O- | sudo apt-key add -
sudo apt-get update && sudo apt-get install beegfs-client-dkms beegfs-helperd beegfs-utils -y
sudo sed -i 's/connDisableAuthentication = false/connDisableAuthentication = true/' /etc/beegfs/beegfs-helperd.conf
sudo systemctl start beegfs-helperd && sudo systemctl enable beegfs-helperd
- name: Deploy the BeeGFS CSI driver
run: |
export BEEGFS_SECRET=$(echo ${{ secrets.CONN_AUTH_SECRET }})
envsubst < test/env/beegfs-ubuntu/csi-beegfs-connauth.yaml > deploy/k8s/overlays/default/csi-beegfs-connauth.yaml
# TODO: Enable once the K8s versions in the matrix are added to versions/
# sed -i 's?/versions/latest?/versions/v${{ matrix.k8s-version }}?g' deploy/k8s/overlays/default/kustomization.yaml
echo -e "\nimages:\n - name: ${{ env.IMAGE_NAME }}\n newName: ${{ env.TEST_IMAGE_NAME }}\n newTag: ${{ github.sha }}" >> deploy/k8s/overlays/default/kustomization.yaml
kubectl apply -k deploy/k8s/overlays/default
# TODO (BCSI-7): Actually run e2e tests using Ginko with an appropriate timeout.

- name: Deploy all examples to verify the driver is available
run: |
echo "${{ secrets.CONN_AUTH_SECRET }}" | sudo tee /etc/beegfs/connAuth
sudo sed -i '0,/connAuthFile[[:space:]]*=[[:space:]]*/s//connAuthFile = \/etc\/beegfs\/connAuth/' /etc/beegfs/beegfs-client.conf
sudo sed -i '0,/sysMgmtdHost[[:space:]]*=[[:space:]]*/s//sysMgmtdHost = localhost/' /etc/beegfs/beegfs-client.conf
sudo beegfs-ctl --cfgFile=/etc/beegfs/beegfs-client.conf --unmounted --createdir /k8s
sudo beegfs-ctl --cfgFile=/etc/beegfs/beegfs-client.conf --unmounted --createdir /k8s/all
sudo beegfs-ctl --cfgFile=/etc/beegfs/beegfs-client.conf --unmounted --createdir /k8s/all/static
sudo beegfs-ctl --cfgFile=/etc/beegfs/beegfs-client.conf --unmounted --createdir /k8s/all/static-ro
kubectl apply -f examples/k8s/all
# If the controller or node service failed to start, our test pod would still be in phase pending.
# We'll check periodically if the pod has started and if we reach the max number of attempts fail with debug output.
- name: Wait and verify the test pod is running
run: |
MAX_ATTEMPTS=36
SLEEP_TIME=5
COUNTER=0
while [ $COUNTER -lt $MAX_ATTEMPTS ]; do
POD_STATUS=$(kubectl get pods csi-beegfs-all-app -o jsonpath='{.status.phase}')
echo "Pod status: ${POD_STATUS}"
if [ "${POD_STATUS}" == "Running" ]; then
echo "Verified test pod is running."
break
else
echo "Pod is not running, waiting for ${SLEEP_TIME} seconds..."
sleep ${SLEEP_TIME}
COUNTER=$((COUNTER+1))
fi
done
if [ $COUNTER -eq $MAX_ATTEMPTS ]; then
echo "Test pod did not reach 'Running' status within the maximum allowed time. Outputting debug information and exiting with error..."
kubectl get pods -A
kubectl describe pod -n beegfs-csi csi-beegfs-controller-0
POD_NAME=$(kubectl get pods -n beegfs-csi -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep 'csi-beegfs-node-')
kubectl describe pod -n beegfs-csi $POD_NAME
kubectl describe pod csi-beegfs-all-app
docker images
exit 1
fi
publish-images:
runs-on: ubuntu-22.04
timeout-minutes: 5
needs: e2e-tests
if: github.event_name != 'pull_request'
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Install Cosign
uses: sigstore/[email protected]
with:
cosign-release: "v2.1.1"

- name: Pull tested CSI driver image from ghcr.io
run: |
docker pull ${{ env.TEST_IMAGE_NAME }}:${{ github.sha }}
- name: Log in to the GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# This uses the semantic versioning option for https://github.com/docker/metadata-action#semver
- name: Extract metadata for container image
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}},prefix=v
type=semver,pattern={{major}}.{{minor}},prefix=v
# TODO: Consider adding labels available as steps.meta.output.labels.
- name: Tag and push the image to GitHub Container Registry
run: |
tags=$(echo "${{ steps.meta.outputs.tags }}" | tr '\n' ' ')
for tag in $tags; do
docker tag ${{ env.TEST_IMAGE_NAME }}:${{ github.sha }} $tag
docker push $tag
done
# Adapted from:
# https://github.blog/2021-12-06-safeguard-container-signing-capability-actions/
# https://github.com/sigstore/cosign-installer#usage
- name: Sign image with Cosign
run: |
tags=$(echo "${{ steps.meta.outputs.tags }}" | tr '\n' ' ')
for tag in $tags; do
DIGEST=$(docker image inspect $tag --format '{{index .RepoDigests 0}}')
cosign sign --yes --key env://COSIGN_PRIVATE_KEY \
-a "repo=${{ github.repository }}" \
-a "run=${{ github.run_id }}" \
-a "ref=${{ github.sha }}" \
$DIGEST
done
env:
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}

# We'll keep around a few old test packages to (a) avoid deleting image for workflows running in parallel,
# and (b) it may be useful to pull a package to troubleshoot workflow failures.
cleanup-test-images:
runs-on: ubuntu-22.04
timeout-minutes: 3
needs: publish-images
if: always()
steps:
- name: Extract package names
run: |
test_image_name="${{ env.TEST_IMAGE_NAME }}"
test_image_pkg=${test_image_name##*/}
echo "TEST_IMAGE_PKG=$test_image_pkg" >> $GITHUB_ENV
- name: Cleanup old ${{ env.TEST_IMAGE_PKG }} packages
uses: actions/delete-package-versions@v4
with:
package-name: "${{ env.TEST_IMAGE_PKG }}"
package-type: "container"
min-versions-to-keep: 5
90 changes: 90 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "Code scanning using CodeQL"

on:
push:
branches: ["master"]
pull_request:
# The branches below must be a subset of the branches above
branches: ["master"]
paths-ignore:
- "**/*.md"
- "**/*.txt"
schedule:
- cron: "26 10 * * 0"

jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 10) || 20 }} # Setting timeout to double what was actually observed.
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ["go"] # Note Python was auto detected but only used in release-tools.
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
# Enable to debug if fewer lines are scanned than expected:
# https://docs.github.com/en/code-security/code-scanning/troubleshooting-code-scanning/codeql-scanned-fewer-lines-than-expected
#debug: true
languages: ${{ matrix.language }}
# Run the all available queries: https://codeql.github.com/codeql-query-help/go/
queries: security-and-quality
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
# This is the default approach for Go: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages?learn=code_security_actions&learnProduct=code-security#autobuild-for-go
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog
Notable changes to the BeeGFS CSI driver will be documented in this file.

[1.5.0] - PRERELEASE
--------------------

### Changed
- Migrated project to the ThinkParQ GitHub organization.
- Migrated container images from DockerHub to GitHub Container Registry.

[1.4.0] - 2022-12-12
--------------------
Expand Down
Loading

0 comments on commit a935ee4

Please sign in to comment.