Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5abfc58
Make containers for the pipeline tools separate to the main pipeline
afg1 Nov 25, 2025
771d962
Use buildx to enable multi-platform builds
afg1 Nov 25, 2025
e46d229
Switch to multi-part build for rnacentral import pipeline
afg1 Nov 25, 2025
ea86885
Move rust utils build into their own container
afg1 Nov 26, 2025
168650a
Github workflows to build rust containers and make the main pipeline …
afg1 Nov 26, 2025
151eafb
Improved dockerignore file
afg1 Nov 26, 2025
d6dc3de
Fix broken copy line
afg1 Nov 26, 2025
979b207
Copy only the necessary local context
afg1 Nov 26, 2025
ca0a3ef
Use buildx for cross platform build in docker makefile
afg1 Nov 26, 2025
95549d9
No need to use python image as builder for tools with no python deps
afg1 Dec 2, 2025
8b8d902
Cleaner handling of rust build products
afg1 Dec 2, 2025
365b236
Don't pipe makefile tests to /dev/null so we can see what happened
afg1 Dec 2, 2025
cc5a1bb
Un-ignore some important bits of context for building in docker
afg1 Dec 2, 2025
e922d9b
Update .github/workflows/main.yaml
afg1 Dec 10, 2025
f033882
Use a smaller final image for the rust utils
afg1 Dec 10, 2025
8f71ae1
Merge branch 'docker-multi-part-build' of github.com:RNAcentral/rnace…
afg1 Dec 10, 2025
d4dc295
Include missing bzip2 executable for samtools build
afg1 Dec 10, 2025
1a4503b
Update samtools and fix dependencies
afg1 Dec 10, 2025
9f76f28
Update samtools version in makefile for tagging
afg1 Dec 10, 2025
de85af9
Use versioned and tagged CPAT
afg1 Dec 10, 2025
1ee028d
Update CPAT to latest version and use new python image
afg1 Dec 10, 2025
e81253c
Improve tagging of CPAT container with correct version
afg1 Dec 10, 2025
050b7cb
Modify pipeline to reflect new cpat commandline interface
afg1 Dec 10, 2025
0aeed93
Add explicit version use in main dockerfile
afg1 Dec 10, 2025
36f7606
Add version tracking files for pipeline tool containers
afg1 Dec 10, 2025
3c6eb42
Use version files in local Makefile
afg1 Dec 10, 2025
ac9f2a9
Update workflows for new version tagging
afg1 Dec 10, 2025
c63dac8
Don't need to copy Makefile for rust utils build
afg1 Dec 12, 2025
175c6b5
Final container shouldn't need the package managers, so remove them
afg1 Dec 12, 2025
4a9b8fb
Use samtools version in wget urls and pass as build option in makefile
afg1 Dec 12, 2025
cd00a78
Add version arg for samtools github build
afg1 Dec 12, 2025
2ceacae
Use force rebuild variable properly
afg1 Dec 12, 2025
7b5a66b
Increase polling times for iter-workflow synchronisation
afg1 Dec 12, 2025
f591a8e
Remove apt installed tabix
afg1 Dec 12, 2025
c86e903
Don't copy htslib headers
afg1 Dec 12, 2025
0fbb5b3
Verify bgzip works in samtools container
afg1 Dec 12, 2025
a0aabe2
Add `/bin` for pipeline binary path containing rust tools and other s…
afg1 Dec 12, 2025
9a1fee7
Update manual build with multi-stage synchronisation
afg1 Dec 12, 2025
c555c6c
Merge branch 'dev' into docker-multi-part-build
afg1 Dec 12, 2025
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
48 changes: 39 additions & 9 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,39 @@
*
!requirements.txt
!Cargo.toml
!Cargo.lock
!utils
!openssl
!uv.lock
!pyproject.toml
!Makefile
# Exclude build and development files
.git/
.github/
*.nf
workflows/
tests/
containers/
Dockerfile.old
.dockerignore
.gitignore
.pre-commit-config.yaml
pytest.ini
.python-version
RELEASE.rst
LICENSE
README.md
*.md

# Python artifacts
__pycache__/
*.py[cod]
*$py.class
.pytest_cache/
.coverage
htmlcov/
*.egg-info/
dist/
build/

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db
94 changes: 92 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,112 @@ jobs:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
MSG_MINIMAL: true

wait-for-rust-build:
runs-on: ubuntu-latest
outputs:
rust_changed: ${{ steps.check-rust.outputs.changed }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Check if Rust files changed
id: check-rust
run: |
if git diff --name-only HEAD^ HEAD | grep -qE '^(utils/|Cargo\.(toml|lock))'; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "Rust files changed, waiting for rust-container workflow..."
else
echo "changed=false" >> $GITHUB_OUTPUT
echo "No Rust changes, skipping wait"
fi

- name: Wait for Rust container build
if: steps.check-rust.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Waiting for rust-container workflow to complete..."
sleep 30 # Give workflow time to start

# Wait up to 30 minutes for rust-container workflow to complete
timeout=1800
elapsed=0
while [ $elapsed -lt $timeout ]; do
# Check for running or completed rust-container workflows for this commit
status=$(gh run list \
--workflow=rust-container.yaml \
--commit=${{ github.sha }} \
--json status,conclusion \
--jq '.[0] | "\(.status):\(.conclusion)"')

if [ -z "$status" ]; then
echo "Warning: rust-container workflow not found yet, waiting..."
sleep 10
elapsed=$((elapsed + 10))
continue
fi

workflow_status=$(echo "$status" | cut -d: -f1)
workflow_conclusion=$(echo "$status" | cut -d: -f2)

if [ "$workflow_status" = "completed" ]; then
if [ "$workflow_conclusion" = "success" ]; then
echo "✓ Rust container build completed successfully"
exit 0
else
echo "✗ Rust container build failed with conclusion: $workflow_conclusion"
exit 1
fi
fi

echo "Rust container build status: $workflow_status (elapsed: ${elapsed}s)"
sleep 30
elapsed=$((elapsed + 30))
done

echo "✗ Timeout waiting for rust-container workflow"
exit 1

create-docker-image:
needs: wait-for-rust-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Read versions
id: versions
run: |
echo "pipeline=$(cat VERSION)" >> $GITHUB_OUTPUT
echo "infernal=$(cat containers/infernal/VERSION)" >> $GITHUB_OUTPUT
echo "samtools=$(cat containers/samtools/VERSION)" >> $GITHUB_OUTPUT

RUST_VERSION=$(cat containers/rust-utils/VERSION)
if [ "$RUST_VERSION" = "auto" ]; then
RUST_VERSION=$(git rev-parse --short=8 HEAD)
fi
echo "rust=$RUST_VERSION" >> $GITHUB_OUTPUT

- name: docker login
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: docker login -u $DOCKER_USER -p $DOCKER_PASSWORD

- name: docker build
run: docker build -f Dockerfile -t rnacentral/rnacentral-import-pipeline:latest .
run: |
docker build \
--build-arg INFERNAL_VERSION=${{ steps.versions.outputs.infernal }} \
--build-arg SAMTOOLS_VERSION=${{ steps.versions.outputs.samtools }} \
--build-arg RUST_VERSION=${{ steps.versions.outputs.rust }} \
-t rnacentral/rnacentral-import-pipeline:${{ steps.versions.outputs.pipeline }} \
-t rnacentral/rnacentral-import-pipeline:latest \
-f Dockerfile .

- name: docker push
run: docker push rnacentral/rnacentral-import-pipeline:latest
run: |
docker push rnacentral/rnacentral-import-pipeline:${{ steps.versions.outputs.pipeline }}
docker push rnacentral/rnacentral-import-pipeline:latest

finished-notification:
needs:
Expand Down
94 changes: 92 additions & 2 deletions .github/workflows/manual_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,112 @@ jobs:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
MSG_MINIMAL: true

wait-for-rust-build:
runs-on: ubuntu-latest
outputs:
rust_changed: ${{ steps.check-rust.outputs.changed }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Check if Rust files changed
id: check-rust
run: |
if git diff --name-only HEAD^ HEAD | grep -qE '^(utils/|Cargo\.(toml|lock))'; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "Rust files changed, waiting for rust-container workflow..."
else
echo "changed=false" >> $GITHUB_OUTPUT
echo "No Rust changes, skipping wait"
fi

- name: Wait for Rust container build
if: steps.check-rust.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Waiting for rust-container workflow to complete..."
sleep 30 # Give workflow time to start

# Wait up to 30 minutes for rust-container workflow to complete
timeout=1800
elapsed=0
while [ $elapsed -lt $timeout ]; do
# Check for running or completed rust-container workflows for this commit
status=$(gh run list \
--workflow=rust-container.yaml \
--commit=${{ github.sha }} \
--json status,conclusion \
--jq '.[0] | "\(.status):\(.conclusion)"')

if [ -z "$status" ]; then
echo "Warning: rust-container workflow not found yet, waiting..."
sleep 10
elapsed=$((elapsed + 10))
continue
fi

workflow_status=$(echo "$status" | cut -d: -f1)
workflow_conclusion=$(echo "$status" | cut -d: -f2)

if [ "$workflow_status" = "completed" ]; then
if [ "$workflow_conclusion" = "success" ]; then
echo "✓ Rust container build completed successfully"
exit 0
else
echo "✗ Rust container build failed with conclusion: $workflow_conclusion"
exit 1
fi
fi

echo "Rust container build status: $workflow_status (elapsed: ${elapsed}s)"
sleep 30
elapsed=$((elapsed + 30))
done

echo "✗ Timeout waiting for rust-container workflow"
exit 1

create-docker-image:
needs: wait-for-rust-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Read versions
id: versions
run: |
echo "pipeline=$(cat VERSION)" >> $GITHUB_OUTPUT
echo "infernal=$(cat containers/infernal/VERSION)" >> $GITHUB_OUTPUT
echo "samtools=$(cat containers/samtools/VERSION)" >> $GITHUB_OUTPUT

RUST_VERSION=$(cat containers/rust-utils/VERSION)
if [ "$RUST_VERSION" = "auto" ]; then
RUST_VERSION=$(git rev-parse --short=8 HEAD)
fi
echo "rust=$RUST_VERSION" >> $GITHUB_OUTPUT

- name: docker login
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: docker login -u $DOCKER_USER -p $DOCKER_PASSWORD

- name: docker build
run: docker build -f Dockerfile -t rnacentral/rnacentral-import-pipeline:latest .
run: |
docker build \
--build-arg INFERNAL_VERSION=${{ steps.versions.outputs.infernal }} \
--build-arg SAMTOOLS_VERSION=${{ steps.versions.outputs.samtools }} \
--build-arg RUST_VERSION=${{ steps.versions.outputs.rust }} \
-t rnacentral/rnacentral-import-pipeline:${{ steps.versions.outputs.pipeline }} \
-t rnacentral/rnacentral-import-pipeline:latest \
-f Dockerfile .

- name: docker push
run: docker push rnacentral/rnacentral-import-pipeline:latest
run: |
docker push rnacentral/rnacentral-import-pipeline:${{ steps.versions.outputs.pipeline }}
docker push rnacentral/rnacentral-import-pipeline:latest

finished-notification:
needs:
Expand Down
94 changes: 94 additions & 0 deletions .github/workflows/rust-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# GitHub Actions workflow for building and pushing Rust utilities container
# Rebuilds when Rust code changes (utils/**, Cargo.toml, Cargo.lock)

name: Build Rust Utilities Container

on:
push:
branches: ['master', 'dev']
paths:
- 'utils/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'containers/rust-utils/**'
- '.github/workflows/rust-container.yaml'
workflow_dispatch:
inputs:
force_rebuild:
description: 'Force rebuild Rust utilities container'
required: false
type: boolean
default: false

jobs:
build-rust-utils:
runs-on: ubuntu-latest
env:
FORCE_REBUILD: ${{ github.event.inputs.force_rebuild || 'false' }}
steps:
- uses: actions/checkout@v3

- name: Calculate Rust version
id: rust-version
run: |
VERSION_FILE="containers/rust-utils/VERSION"
VERSION_CONTENT=$(cat $VERSION_FILE)

if [ "$VERSION_CONTENT" = "auto" ]; then
GIT_SHA=$(git rev-parse --short=8 HEAD)

# Check for uncommitted changes
if ! git diff-index --quiet HEAD --; then
GIT_SHA="${GIT_SHA}-dirty"
echo "⚠️ Warning: Building with uncommitted changes"
fi

VERSION=$GIT_SHA
else
VERSION=$VERSION_CONTENT
fi

echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "🔖 Building rust-utils:$VERSION"

- name: Docker login
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: docker login -u $DOCKER_USER -p $DOCKER_PASSWORD

- name: Build Rust utilities container
run: |
VERSION=${{ steps.rust-version.outputs.version }}
if [ "$FORCE_REBUILD" = "true" ]; then
docker build --no-cache \
--build-arg RUST_VERSION=${VERSION} \
-t rnacentral/rust-utils:${VERSION} \
-f containers/rust-utils/Dockerfile .
else
docker build \
--build-arg RUST_VERSION=${VERSION} \
-t rnacentral/rust-utils:${VERSION} \
-f containers/rust-utils/Dockerfile .
fi

- name: Tag as latest
run: |
VERSION=${{ steps.rust-version.outputs.version }}
docker tag rnacentral/rust-utils:${VERSION} rnacentral/rust-utils:latest

- name: Push versioned tag
run: |
VERSION=${{ steps.rust-version.outputs.version }}
docker push rnacentral/rust-utils:${VERSION}

- name: Push latest tag
run: docker push rnacentral/rust-utils:latest

- name: Slack notification
if: always()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_MESSAGE: 'Rust utilities ${{ steps.rust-version.outputs.version }} container built and pushed: ${{ job.status }}'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
MSG_MINIMAL: true
Loading