Skip to content

Commit c76ad35

Browse files
Merge pull request #210 from Backblaze/add-lcr-capabilities
Lifecycle rule capabilities for S3 Compatible APIs
2 parents c3576f6 + fb36c49 commit c76ad35

File tree

3 files changed

+31
-22
lines changed

3 files changed

+31
-22
lines changed

.github/workflows/ci_cd.yml

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,41 +23,50 @@ env:
2323
jobs:
2424
build:
2525
runs-on: ${{ github.repository == 'Backblaze/b2-sdk-java-private' && 'self-hosted'|| 'ubuntu-latest' }}
26+
2627
steps:
2728
- uses: actions/checkout@v4
2829
with:
2930
fetch-depth: 0
3031

3132
- uses: actions/setup-java@v4
3233
with:
33-
distribution: 'temurin'
34+
distribution: temurin
3435
java-version: '11'
3536

3637
- uses: gradle/actions/wrapper-validation@v4
3738
- name: Setup Gradle
3839
uses: gradle/actions/setup-gradle@v4
3940

40-
- name: Set up Python
41+
# --- uv + Python 3.13, then create a venv in $RUNNER_TEMP ---
42+
- name: Set up uv
43+
uses: astral-sh/setup-uv@v5
44+
with:
45+
enable-cache: false
46+
47+
- name: Install Python 3.13 and create venv
48+
shell: bash
4149
run: |
42-
python3.8 -m venv env
43-
source env/bin/activate
44-
echo "VIRTUAL ENV:" $VIRTUAL_ENV
45-
# upgrade pip and setuptools so that b2 CLI can be properly installed
46-
pip install --upgrade pip setuptools
47-
pip install b2 pysqlite3
50+
set -euxo pipefail
51+
uv python install 3.13
52+
# Create a throwaway venv for this job
53+
UV_VENV="$RUNNER_TEMP/py313"
54+
uv venv "$UV_VENV"
55+
echo "UV_VENV=$UV_VENV" >> "$GITHUB_ENV"
56+
# Prove it's 3.13
57+
"$UV_VENV/bin/python" --version
58+
59+
- name: Install Python deps into venv (uv)
60+
shell: bash
61+
run: |
62+
uv pip install --python "$UV_VENV/bin/python" --upgrade pip setuptools wheel
63+
uv pip install --python "$UV_VENV/bin/python" b2 pysqlite3-binary
4864
4965
- name: Build the distribution
5066
run: |
5167
$GITHUB_WORKSPACE/gradlew build
52-
#
53-
# Prepare the outputs
54-
#
55-
56-
# make the directory
5768
mkdir -p ${{ env.OUTPUT_DIR }}
5869
cp -v */build/libs/b2-sdk-*.{jar,pom,module} ${{ env.OUTPUT_DIR }}
59-
60-
# zip up the outputs
6170
cd ${{ env.OUTPUT_DIR }}
6271
zip -r $GITHUB_WORKSPACE/build/${{ env.OUTPUT_ZIP }} *
6372
@@ -79,11 +88,9 @@ jobs:
7988

8089
- name: Upload to b2
8190
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/api-v2' || github.ref == 'refs/heads/7.x'
82-
# upload to b2 (if credentials are provided, as they will be for backblaze's builds, but not pull requests)
83-
# This should be using python 3.8
8491
run: |
85-
source $GITHUB_WORKSPACE/env/bin/activate
86-
$GITHUB_WORKSPACE/maybe_upload_build_results ${{ env.OUTPUT_ZIP }}
92+
export PATH="$UV_VENV/bin:$PATH"
93+
"$GITHUB_WORKSPACE/maybe_upload_build_results" "${{ env.OUTPUT_ZIP }}"
8794
8895
- name: Check GitHub Pages status
8996
if: github.ref == 'refs/heads/master'
@@ -92,9 +99,6 @@ jobs:
9299
pages_threshold: major_outage
93100

94101
- name: Deploy Javadoc
95-
# note that i'm only uploading the javadocs for b2-sdk-core.
96-
# that's because i'm lame and building separate javadocs for
97-
# each jar and only uploading one set of javadocs.
98102
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/api-v2' || github.ref == 'refs/heads/7.x') && success()
99103
uses: crazy-max/ghaction-github-pages@v3
100104
with:

core/src/main/java/com/backblaze/b2/client/structures/B2Capabilities.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,7 @@ public interface B2Capabilities {
5454

5555
String READ_BUCKET_NOTIFICATIONS = "readBucketNotifications";
5656
String WRITE_BUCKET_NOTIFICATIONS = "writeBucketNotifications";
57+
58+
String READ_BUCKET_LIFECYCLE_RULES = "readBucketLifecycleRules";
59+
String WRITE_BUCKET_LIFECYCLE_RULES = "writeBucketLifecycleRules";
5760
}

core/src/test/java/com/backblaze/b2/client/structures/B2ApplicationKeyTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public void testEquals() {
3636
capabilities.add(B2Capabilities.WRITE_BUCKET_REPLICATIONS);
3737
capabilities.add(B2Capabilities.READ_BUCKET_NOTIFICATIONS);
3838
capabilities.add(B2Capabilities.WRITE_BUCKET_NOTIFICATIONS);
39+
capabilities.add(B2Capabilities.READ_BUCKET_LIFECYCLE_RULES);
40+
capabilities.add(B2Capabilities.WRITE_BUCKET_LIFECYCLE_RULES);
3941
final B2ApplicationKey applicationKey =
4042
new B2ApplicationKey(
4143
"accountId",

0 commit comments

Comments
 (0)