Skip to content

Commit a935ee4

Browse files
Merge pull request #2 from ThinkParQ/repository-migration
Migrate repository to the ThinkParQ organization
2 parents e357625 + a6c4a02 commit a935ee4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1403
-4371
lines changed

.github/workflows/build-test-publish-operator.yaml

+360
Large diffs are not rendered by default.
+262
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
1+
name: "Test and Publish BeeGFS CSI Driver"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- "master"
8+
tags:
9+
- "v*"
10+
pull_request:
11+
branches:
12+
- "master"
13+
14+
env:
15+
# Container image registry to publish images to:
16+
REGISTRY: ghcr.io
17+
# Where to push an image of the CSI driver that will be retained (for master builds or releases) without a specific tag:
18+
IMAGE_NAME: ghcr.io/thinkparq/beegfs-csi-driver
19+
# Where to push an image of the CSI driver for testing (including the operator) without a specific tag:
20+
TEST_IMAGE_NAME: ghcr.io/thinkparq/test-beegfs-csi-driver
21+
22+
# Note for all test images the github.sha will be used as the tag.
23+
24+
jobs:
25+
build-and-unit-test:
26+
runs-on: ubuntu-22.04
27+
timeout-minutes: 5
28+
permissions:
29+
packages: write
30+
contents: read
31+
steps:
32+
- uses: actions/checkout@v3
33+
with:
34+
# Work around for how release-tools verify-subtree.sh verifies release-tools has not been modified.
35+
fetch-depth: "0"
36+
37+
- name: Set up Go
38+
uses: actions/setup-go@v4
39+
with:
40+
go-version: 1.20.4
41+
# Dependencies are cached by default: https://github.com/actions/setup-go#v4
42+
# This can be explicitly disabled if it ever causes problems.
43+
44+
- name: Build the container image
45+
run: |
46+
export SHELL=/bin/bash
47+
make container
48+
echo -n "verifying images:"
49+
docker images
50+
51+
- name: Install test dependencies
52+
run: |
53+
go install github.com/onsi/ginkgo/v2/[email protected]
54+
timeout-minutes: 5
55+
56+
- name: Run unit tests
57+
run: |
58+
ACK_GINKGO_DEPRECATIONS=1.16.5 TESTARGS="-v -ginkgo.v" make test
59+
# TODO: Consider if we should write the results to a file and keep it as an artifact.
60+
# For example using: https://github.com/marketplace/actions/junit-report-action
61+
# TODO: Can we cache anything here? test-vendor downloads a lot of stuff.
62+
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go#caching-dependencies
63+
64+
- name: Log into the GitHub Container Registry
65+
uses: docker/login-action@v2
66+
with:
67+
registry: ${{ env.REGISTRY }}
68+
username: ${{ github.actor }}
69+
password: ${{ secrets.GITHUB_TOKEN }}
70+
71+
# Push the image for reuse in subsequent steps, jobs, and workflows.
72+
# For now just tag with the commit ID to ensure subsequent jobs in this workflow run use the correct image.
73+
- name: Tag and push the CSI driver as a test package
74+
run: |
75+
docker tag beegfs-csi-driver:latest ${{ env.TEST_IMAGE_NAME }}:${{ github.sha }}
76+
docker push ${{ env.TEST_IMAGE_NAME }}:${{ github.sha }}
77+
78+
e2e-tests:
79+
runs-on: ubuntu-22.04
80+
timeout-minutes: 10
81+
needs: build-and-unit-test
82+
strategy:
83+
fail-fast: true
84+
matrix:
85+
k8s-version: [1.24.15, 1.25.11, 1.26.3, 1.27.3]
86+
beegfs-version: [7.3.4]
87+
permissions:
88+
packages: read
89+
contents: read
90+
steps:
91+
- uses: actions/checkout@v3
92+
93+
- name: Set up Docker Buildx
94+
uses: docker/setup-buildx-action@v2
95+
96+
- name: Deploy Kubernetes ${{ matrix.k8s-version }} using Minikube
97+
uses: medyagh/setup-minikube@latest
98+
with:
99+
driver: none
100+
kubernetes-version: ${{ matrix.k8s-version }}
101+
102+
- name: Deploy BeeGFS ${{ matrix.beegfs-version }} for testing
103+
run: |
104+
export BEEGFS_VERSION=$(echo ${{ matrix.beegfs-version }})
105+
export BEEGFS_SECRET=$(echo ${{ secrets.CONN_AUTH_SECRET }})
106+
envsubst < test/env/beegfs-ubuntu/beegfs-fs-1.yaml | kubectl apply -f -
107+
kubectl get pods -A
108+
109+
# TODO: Cache BeeGFS packages https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows
110+
# https://stackoverflow.com/questions/59269850/caching-apt-packages-in-github-actions-workflow
111+
- name: Install the BeeGFS ${{ matrix.beegfs-version }} DKMS client
112+
run: |
113+
sudo wget -P /etc/apt/sources.list.d/. https://www.beegfs.io/release/beegfs_${{ matrix.beegfs-version }}/dists/beegfs-focal.list
114+
sudo wget -q https://www.beegfs.io/release/beegfs_${{ matrix.beegfs-version }}/gpg/GPG-KEY-beegfs -O- | sudo apt-key add -
115+
sudo apt-get update && sudo apt-get install beegfs-client-dkms beegfs-helperd beegfs-utils -y
116+
sudo sed -i 's/connDisableAuthentication = false/connDisableAuthentication = true/' /etc/beegfs/beegfs-helperd.conf
117+
sudo systemctl start beegfs-helperd && sudo systemctl enable beegfs-helperd
118+
119+
- name: Deploy the BeeGFS CSI driver
120+
run: |
121+
export BEEGFS_SECRET=$(echo ${{ secrets.CONN_AUTH_SECRET }})
122+
envsubst < test/env/beegfs-ubuntu/csi-beegfs-connauth.yaml > deploy/k8s/overlays/default/csi-beegfs-connauth.yaml
123+
# TODO: Enable once the K8s versions in the matrix are added to versions/
124+
# sed -i 's?/versions/latest?/versions/v${{ matrix.k8s-version }}?g' deploy/k8s/overlays/default/kustomization.yaml
125+
echo -e "\nimages:\n - name: ${{ env.IMAGE_NAME }}\n newName: ${{ env.TEST_IMAGE_NAME }}\n newTag: ${{ github.sha }}" >> deploy/k8s/overlays/default/kustomization.yaml
126+
kubectl apply -k deploy/k8s/overlays/default
127+
128+
# TODO (BCSI-7): Actually run e2e tests using Ginko with an appropriate timeout.
129+
130+
- name: Deploy all examples to verify the driver is available
131+
run: |
132+
echo "${{ secrets.CONN_AUTH_SECRET }}" | sudo tee /etc/beegfs/connAuth
133+
sudo sed -i '0,/connAuthFile[[:space:]]*=[[:space:]]*/s//connAuthFile = \/etc\/beegfs\/connAuth/' /etc/beegfs/beegfs-client.conf
134+
sudo sed -i '0,/sysMgmtdHost[[:space:]]*=[[:space:]]*/s//sysMgmtdHost = localhost/' /etc/beegfs/beegfs-client.conf
135+
sudo beegfs-ctl --cfgFile=/etc/beegfs/beegfs-client.conf --unmounted --createdir /k8s
136+
sudo beegfs-ctl --cfgFile=/etc/beegfs/beegfs-client.conf --unmounted --createdir /k8s/all
137+
sudo beegfs-ctl --cfgFile=/etc/beegfs/beegfs-client.conf --unmounted --createdir /k8s/all/static
138+
sudo beegfs-ctl --cfgFile=/etc/beegfs/beegfs-client.conf --unmounted --createdir /k8s/all/static-ro
139+
kubectl apply -f examples/k8s/all
140+
141+
# If the controller or node service failed to start, our test pod would still be in phase pending.
142+
# We'll check periodically if the pod has started and if we reach the max number of attempts fail with debug output.
143+
- name: Wait and verify the test pod is running
144+
run: |
145+
MAX_ATTEMPTS=36
146+
SLEEP_TIME=5
147+
COUNTER=0
148+
149+
while [ $COUNTER -lt $MAX_ATTEMPTS ]; do
150+
POD_STATUS=$(kubectl get pods csi-beegfs-all-app -o jsonpath='{.status.phase}')
151+
echo "Pod status: ${POD_STATUS}"
152+
if [ "${POD_STATUS}" == "Running" ]; then
153+
echo "Verified test pod is running."
154+
break
155+
else
156+
echo "Pod is not running, waiting for ${SLEEP_TIME} seconds..."
157+
sleep ${SLEEP_TIME}
158+
COUNTER=$((COUNTER+1))
159+
fi
160+
done
161+
162+
if [ $COUNTER -eq $MAX_ATTEMPTS ]; then
163+
echo "Test pod did not reach 'Running' status within the maximum allowed time. Outputting debug information and exiting with error..."
164+
kubectl get pods -A
165+
kubectl describe pod -n beegfs-csi csi-beegfs-controller-0
166+
POD_NAME=$(kubectl get pods -n beegfs-csi -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep 'csi-beegfs-node-')
167+
kubectl describe pod -n beegfs-csi $POD_NAME
168+
kubectl describe pod csi-beegfs-all-app
169+
docker images
170+
exit 1
171+
fi
172+
173+
publish-images:
174+
runs-on: ubuntu-22.04
175+
timeout-minutes: 5
176+
needs: e2e-tests
177+
if: github.event_name != 'pull_request'
178+
permissions:
179+
packages: write
180+
contents: read
181+
steps:
182+
- uses: actions/checkout@v3
183+
184+
- name: Set up Docker Buildx
185+
uses: docker/setup-buildx-action@v2
186+
187+
- name: Install Cosign
188+
uses: sigstore/[email protected]
189+
with:
190+
cosign-release: "v2.1.1"
191+
192+
- name: Pull tested CSI driver image from ghcr.io
193+
run: |
194+
docker pull ${{ env.TEST_IMAGE_NAME }}:${{ github.sha }}
195+
196+
- name: Log in to the GitHub Container Registry
197+
uses: docker/login-action@v2
198+
with:
199+
registry: ${{ env.REGISTRY }}
200+
username: ${{ github.actor }}
201+
password: ${{ secrets.GITHUB_TOKEN }}
202+
203+
# This uses the semantic versioning option for https://github.com/docker/metadata-action#semver
204+
- name: Extract metadata for container image
205+
id: meta
206+
uses: docker/metadata-action@v4
207+
with:
208+
images: |
209+
${{ env.IMAGE_NAME }}
210+
tags: |
211+
type=ref,event=branch
212+
type=ref,event=pr
213+
type=semver,pattern={{version}},prefix=v
214+
type=semver,pattern={{major}}.{{minor}},prefix=v
215+
216+
# TODO: Consider adding labels available as steps.meta.output.labels.
217+
- name: Tag and push the image to GitHub Container Registry
218+
run: |
219+
tags=$(echo "${{ steps.meta.outputs.tags }}" | tr '\n' ' ')
220+
for tag in $tags; do
221+
docker tag ${{ env.TEST_IMAGE_NAME }}:${{ github.sha }} $tag
222+
docker push $tag
223+
done
224+
225+
# Adapted from:
226+
# https://github.blog/2021-12-06-safeguard-container-signing-capability-actions/
227+
# https://github.com/sigstore/cosign-installer#usage
228+
- name: Sign image with Cosign
229+
run: |
230+
tags=$(echo "${{ steps.meta.outputs.tags }}" | tr '\n' ' ')
231+
for tag in $tags; do
232+
DIGEST=$(docker image inspect $tag --format '{{index .RepoDigests 0}}')
233+
cosign sign --yes --key env://COSIGN_PRIVATE_KEY \
234+
-a "repo=${{ github.repository }}" \
235+
-a "run=${{ github.run_id }}" \
236+
-a "ref=${{ github.sha }}" \
237+
$DIGEST
238+
done
239+
env:
240+
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
241+
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
242+
243+
# We'll keep around a few old test packages to (a) avoid deleting image for workflows running in parallel,
244+
# and (b) it may be useful to pull a package to troubleshoot workflow failures.
245+
cleanup-test-images:
246+
runs-on: ubuntu-22.04
247+
timeout-minutes: 3
248+
needs: publish-images
249+
if: always()
250+
steps:
251+
- name: Extract package names
252+
run: |
253+
test_image_name="${{ env.TEST_IMAGE_NAME }}"
254+
test_image_pkg=${test_image_name##*/}
255+
echo "TEST_IMAGE_PKG=$test_image_pkg" >> $GITHUB_ENV
256+
257+
- name: Cleanup old ${{ env.TEST_IMAGE_PKG }} packages
258+
uses: actions/delete-package-versions@v4
259+
with:
260+
package-name: "${{ env.TEST_IMAGE_PKG }}"
261+
package-type: "container"
262+
min-versions-to-keep: 5

.github/workflows/codeql.yaml

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "Code scanning using CodeQL"
13+
14+
on:
15+
push:
16+
branches: ["master"]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: ["master"]
20+
paths-ignore:
21+
- "**/*.md"
22+
- "**/*.txt"
23+
schedule:
24+
- cron: "26 10 * * 0"
25+
26+
jobs:
27+
analyze:
28+
name: Analyze
29+
# Runner size impacts CodeQL analysis time. To learn more, please see:
30+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
31+
# - https://gh.io/supported-runners-and-hardware-resources
32+
# - https://gh.io/using-larger-runners
33+
# Consider using larger runners for possible analysis time improvements.
34+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
35+
timeout-minutes: ${{ (matrix.language == 'swift' && 10) || 20 }} # Setting timeout to double what was actually observed.
36+
permissions:
37+
actions: read
38+
contents: read
39+
security-events: write
40+
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
language: ["go"] # Note Python was auto detected but only used in release-tools.
45+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
46+
# Use only 'java' to analyze code written in Java, Kotlin or both
47+
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
48+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
49+
50+
steps:
51+
- name: Checkout repository
52+
uses: actions/checkout@v3
53+
54+
# Initializes the CodeQL tools for scanning.
55+
- name: Initialize CodeQL
56+
uses: github/codeql-action/init@v2
57+
with:
58+
# Enable to debug if fewer lines are scanned than expected:
59+
# https://docs.github.com/en/code-security/code-scanning/troubleshooting-code-scanning/codeql-scanned-fewer-lines-than-expected
60+
#debug: true
61+
languages: ${{ matrix.language }}
62+
# Run the all available queries: https://codeql.github.com/codeql-query-help/go/
63+
queries: security-and-quality
64+
# If you wish to specify custom queries, you can do so here or in a config file.
65+
# By default, queries listed here will override any specified in a config file.
66+
# Prefix the list here with "+" to use these queries and those in the config file.
67+
68+
# 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
69+
# queries: security-extended,security-and-quality
70+
71+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
72+
# If this step fails, then you should remove it and run the build manually (see below)
73+
# 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
74+
- name: Autobuild
75+
uses: github/codeql-action/autobuild@v2
76+
77+
# ℹ️ Command-line programs to run using the OS shell.
78+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
79+
80+
# If the Autobuild fails above, remove it and uncomment the following three lines.
81+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
82+
83+
# - run: |
84+
# echo "Run, Build Application using script"
85+
# ./location_of_script_within_repo/buildscript.sh
86+
87+
- name: Perform CodeQL Analysis
88+
uses: github/codeql-action/analyze@v2
89+
with:
90+
category: "/language:${{matrix.language}}"

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Changelog
22
Notable changes to the BeeGFS CSI driver will be documented in this file.
33

4+
[1.5.0] - PRERELEASE
5+
--------------------
6+
7+
### Changed
8+
- Migrated project to the ThinkParQ GitHub organization.
9+
- Migrated container images from DockerHub to GitHub Container Registry.
410

511
[1.4.0] - 2022-12-12
612
--------------------

0 commit comments

Comments
 (0)