Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .github/workflows/build-docker-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Build hydra image

on:
pull_request_target:
types: [opened, synchronize, reopened]
paths:
- 'docker/env/Dockerfile'
- 'docker/env/build_n_push.sh'
- 'requirements.in'
- 'requirements.txt'

permissions:
actions: write
contents: write

jobs:
check_org_membership:
runs-on: ubuntu-latest
outputs:
isTeamMember: ${{ steps.teamAffiliation.outputs.isTeamMember }}
steps:
- name: Check user for team affiliation
uses: tspascoal/get-user-teams-membership@v3
id: teamAffiliation
with:
GITHUB_TOKEN: ${{ secrets.AUTO_BACKPORT_TOKEN }}
username: ${{ github.actor }}
team: 'dev'

build_image:
needs: check_org_membership
if: needs.check_org_membership.outputs.isTeamMember == 'true' && contains(github.event.pull_request.labels.*.name, 'New Hydra Version')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.

- name: Check if docker image is already built
run: |
git fetch origin master
commits_headlines=$(git log origin/master..HEAD --pretty=format:"%s")
if [[ "$commits_headlines" == *"chore(hydra): create image"* ]]; then
echo "Docker image already built"
exit 0
else
echo "Docker image not built yet"
fi
env:
GH_TOKEN: ${{ secrets. GITHUB_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install uv==0.2.24
- name: Generate a random name based on PR
run: |
docker_version=$(cut -d'-' -f1 ./docker/env/version | awk -F. '{print $1"."$2+1}')
sha=$(echo "${{ github.sha }}" | cut -c1-7)
echo "${docker_version}-PR${{ github.event.number }}-${sha}" > ./docker/env/version
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build Docker image
run: |
./docker/env/build_n_push.sh
- name: Configure Git
run: |
git config --global user.name 'scylla-sct[bot]'
git config --global user.email 'scylla-sct[bot]@users.noreply.github.com'
- name: Commit changes
run: |
git add -u
git commit -m "chore(hydra): create image $( cat ./docker/env/version )"
- name: Push changes
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ azure-storage-blob==12.16.0
questionary==2.1.0
pbr==6.1.0
hdrhistogram==0.9.2
deepdiff==8.1.1
deepdiff==8.3.0
PyGithub==2.1.1
gimme-aws-creds==2.8.0
confluent-kafka==2.5.3
Expand Down