diff --git a/.forgejo/README.md b/.forgejo/README.md index 7d6e026..a057e3f 100644 --- a/.forgejo/README.md +++ b/.forgejo/README.md @@ -7,85 +7,26 @@ This directory contains Forgejo Actions workflows for the Baktainer project. For ``` .forgejo/ ├── workflows/ -│ ├── ci.yml # Main CI pipeline (test + build) -│ ├── test.yml # Test-only workflow -│ ├── build.yml # Build-only workflow -│ └── docker.yml # Advanced Docker workflow +│ └── ci.yml # Complete CI/CD pipeline └── README.md # This file ``` -## Workflows +## Workflow -### 1. `ci.yml` - Main CI Pipeline -- **Triggers**: Push to main, tags, and pull requests -- **Jobs**: Test → Build → Notify -- **Container**: Ruby 3.3 Alpine with Node.js -- **Features**: - - Runs RSpec tests with full GitHub Actions support - - Builds and pushes Docker images to Docker Hub - - Provides status notifications - -### 2. `test.yml` - Test-Only Workflow -- **Triggers**: Push to main and pull requests -- **Jobs**: Test -- **Container**: Ruby 3.3 Alpine with Node.js -- **Features**: - - Runs unit and integration tests separately - - Generates coverage reports - - Uploads test artifacts - -### 3. `node-ruby.yml` - Node.js + Ruby Workflow -- **Triggers**: Push to main, tags, and pull requests -- **Jobs**: Test → Build → Notify -- **Container**: Node.js 18 Alpine with Ruby -- **Features**: - - Uses Node.js base image with Ruby installed - - Full GitHub Actions compatibility - - Optimized for actions requiring Node.js - -### 4. `simple.yml` - Simple Shell-Based Workflow -- **Triggers**: Push to main, tags, and pull requests -- **Jobs**: Test → Build → Notify -- **Container**: Ruby 3.3 Alpine -- **Features**: - - Uses basic shell commands instead of complex actions - - Manual git cloning and Docker operations - - Minimal dependencies - -### 5. `minimal.yml` - Minimal Test-Only Workflow -- **Triggers**: Push events -- **Jobs**: Test → Build -- **Container**: Ruby 3.3 Alpine -- **Features**: - - Extremely minimal setup - - Basic test execution - - No external action dependencies - -### 6. `shell-only.yml` - Pure Shell-Based Workflow -- **Triggers**: Push to main, tags, and pull requests +### `ci.yml` - Complete CI/CD Pipeline +- **Triggers**: + - Push to main branch → Test + Build + Deploy + - Version tags (v*.*.*) → Test + Build + Deploy with version tag + - Pull requests → Test only - **Jobs**: Test → Build → Notify - **Container**: Ruby 3.3 Alpine (with auto-detection) - **Features**: - - No GitHub Actions dependencies at all - - Auto-detects package manager (apk, apt-get, yum, dnf) - - Manual git cloning and Docker operations - - Most compatible with any Forgejo runner setup - -### 7. `build.yml` - Build-Only Workflow -- **Triggers**: Push to main and tags -- **Jobs**: Build → Notify -- **Features**: - - Builds Docker images after tests pass - - Supports versioned tags - - Provides build status notifications - -### 8. `docker.yml` - Advanced Docker Workflow -- **Triggers**: Push to main and tags -- **Jobs**: Test → Build -- **Features**: - - Uses Docker Buildx for advanced builds - - Implements Docker layer caching - - Automatic metadata extraction + - **Test Job**: Installs dependencies, runs RSpec tests + - **Build Job**: Builds Docker image, pushes to Docker Hub as `:latest` and `:version` (for tags) + - **Notify Job**: Reports pipeline status + - **Pure Shell Commands**: No GitHub Actions dependencies for maximum compatibility + - **Auto-Detection**: Supports multiple package managers (apk, apt-get, yum, dnf) + - **Robust**: Manual git cloning and Docker operations work with any Forgejo runner ## Key Differences from GitHub Actions @@ -136,34 +77,33 @@ Configure these secrets in your Forgejo repository settings: ## Workflow Features ### Testing -- **Ruby 3.3** with Alpine Linux -- **RSpec** test suite with JUnit XML output -- **Coverage reporting** with simplecov -- **Artifact upload** for test results +- **Ruby 3.3** with Alpine Linux +- **RSpec** test suite with progress format +- **Automatic dependency installation** with package manager detection -### Building -- **Multi-stage Docker builds** from Alpine Ruby base -- **Automatic tagging** with version tags +### Building +- **Docker builds** from Alpine Ruby base +- **Automatic tagging** with `:latest` and version tags (`:v1.2.3`) - **Docker Hub integration** with secure authentication -- **Build notifications** with status reporting +- **Build status reporting** -### Caching -- **Ruby gem caching** for faster builds -- **Docker layer caching** (in advanced workflow) -- **Dependency caching** between runs +### Compatibility +- **Pure shell commands** for maximum Forgejo runner compatibility +- **Package manager auto-detection** (apk, apt-get, yum, dnf) +- **No external action dependencies** ## Usage Examples ### Manual Workflow Trigger ```bash -# Push to main (triggers ci.yml) +# Push to main (triggers full CI/CD: test → build → deploy) git push origin main -# Create and push version tag (triggers build) +# Create and push version tag (triggers test → build → deploy with version tag) git tag v0.1.1 git push origin v0.1.1 -# Create pull request (triggers test.yml) +# Create pull request (triggers test only) git push origin feature-branch # Then create PR in Forgejo UI ``` @@ -185,11 +125,9 @@ git push origin feature-branch exec: "node": executable file not found in $PATH: unknown ``` **Solutions**: - - **Recommended**: Use `shell-only.yml` (pure shell, no actions, most compatible with any runner) - - **Fixed in main workflows**: `ci.yml`, `test.yml`, `build.yml`, and `docker.yml` now auto-detect package manager - - Alternative: Use `node-ruby.yml` (Node.js base image with Ruby) - - Alternative: Use `simple.yml` or `minimal.yml` (shell-based, limited actions) - - Check your Forgejo runner configuration and container image support + - **Current workflow uses pure shell commands** - no GitHub Actions dependencies + - **Auto-detects package manager** (apk, apt-get, yum, dnf) for maximum compatibility + - **If still experiencing issues**: Check your Forgejo runner configuration and container image support 2. **Working directory not found error** ``` @@ -198,9 +136,9 @@ git push origin feature-branch no such file or directory: unknown ``` **Solutions**: - - **Fixed**: All workflows now use explicit `cd app` commands instead of `working-directory` defaults + - **Fixed**: Workflow uses explicit `cd app` commands instead of `working-directory` defaults - The error occurred because `working-directory` was set before repository checkout - - Repository must be cloned/checked out before changing to subdirectories + - Repository must be cloned before changing to subdirectories 3. **Actions not running** - Check if Repository Actions are enabled @@ -218,9 +156,8 @@ git push origin feature-branch - Review test output in workflow logs 5. **GitHub Actions compatibility** - - Some actions require Node.js runtime - - Use `node-ruby.yml` for full GitHub Actions support - - Use `simple.yml` for shell-based alternatives + - **Not applicable**: Current workflow uses only shell commands + - **No external actions**: Maximum compatibility with any Forgejo runner ### Debugging Steps @@ -245,11 +182,19 @@ git push origin feature-branch ## Migration from GitHub Actions -The workflows in this directory are designed to be compatible with the existing GitHub Actions in `.github/workflows/`. Key adaptations made: +This workflow is designed to be compatible with the existing GitHub Actions in `.github/workflows/`. Key adaptations made: -1. **Runner specification**: Changed from `ubuntu-latest` to `docker` with container specification -2. **Dependency installation**: Added explicit Alpine package installation -3. **Simplified caching**: Adapted caching strategy for Forgejo environment -4. **Container-based execution**: Optimized for Docker container runtime +1. **Pure shell commands**: No external action dependencies for maximum compatibility +2. **Runner specification**: Uses `docker` with Ruby 3.3 Alpine container +3. **Package manager detection**: Auto-detects apk, apt-get, yum, or dnf +4. **Manual operations**: Git clone and Docker commands work with any runner setup -Both GitHub Actions and Forgejo Actions can coexist in the same repository, allowing for gradual migration or dual CI/CD setup. \ No newline at end of file +Both GitHub Actions and Forgejo Actions can coexist in the same repository, allowing for gradual migration or dual CI/CD setup. + +## Simplified Design + +This single workflow replaces multiple complex workflows with one simple, reliable pipeline that: +- **Tests** your Ruby application with RSpec +- **Builds** a Docker image +- **Deploys** by pushing to Docker Hub with proper tagging +- **Works** with any Forgejo runner configuration \ No newline at end of file diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml deleted file mode 100644 index 8611ee6..0000000 --- a/.forgejo/workflows/build.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: Build Docker Image - -on: - push: - branches: - - main - tags: - - 'v*.*.*' - -jobs: - build: - runs-on: docker - if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) - - steps: - - name: Install Node.js for actions - run: | - # Detect package manager and install Node.js - if command -v apk >/dev/null 2>&1; then - apk add --no-cache nodejs npm - elif command -v apt-get >/dev/null 2>&1; then - apt-get update && apt-get install -y nodejs npm - elif command -v yum >/dev/null 2>&1; then - yum install -y nodejs npm - elif command -v dnf >/dev/null 2>&1; then - dnf install -y nodejs npm - else - echo "Package manager not found. Installing Node.js manually..." - curl -fsSL https://deb.nodesource.com/setup_18.x | bash - - apt-get install -y nodejs || echo "Failed to install Node.js" - fi - - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Extract version tag - id: version - run: | - if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then - echo "VERSION_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT - fi - - - name: Set image tags - id: tags - run: | - IMAGE_NAME=${{ secrets.DOCKER_IMAGE_NAME }} - TAGS="${IMAGE_NAME}:latest" - if [ -n "${{ steps.version.outputs.VERSION_TAG }}" ]; then - TAGS="$TAGS,${IMAGE_NAME}:${{ steps.version.outputs.VERSION_TAG }}" - fi - echo "tags=$TAGS" >> $GITHUB_OUTPUT - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - push: true - tags: ${{ steps.tags.outputs.tags }} - - notify: - needs: build - runs-on: docker - if: always() - - steps: - - name: Notify build status - run: | - if [ "${{ needs.build.result }}" == "success" ]; then - echo "✅ Docker image built and pushed successfully" - echo "🏷️ Tags: ${{ needs.build.outputs.tags }}" - else - echo "❌ Docker image build failed" - exit 1 - fi \ No newline at end of file diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 2fec1a4..baecfb8 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -17,44 +17,33 @@ jobs: image: ruby:3.3-alpine steps: - - name: Install system dependencies including Node.js + - name: Install system dependencies run: | - # Detect package manager and install dependencies + # Detect OS and install dependencies if command -v apk >/dev/null 2>&1; then # Alpine Linux - apk add --no-cache build-base libffi-dev linux-headers postgresql-dev git curl tzdata nodejs npm + apk add --no-cache build-base libffi-dev linux-headers postgresql-dev git curl tzdata elif command -v apt-get >/dev/null 2>&1; then # Debian/Ubuntu - apt-get update && apt-get install -y build-essential libffi-dev libpq-dev git curl tzdata nodejs npm + apt-get update && apt-get install -y build-essential libffi-dev libpq-dev git curl tzdata elif command -v yum >/dev/null 2>&1; then # CentOS/RHEL - yum install -y gcc make libffi-devel postgresql-devel git curl tzdata nodejs npm + yum install -y gcc make libffi-devel postgresql-devel git curl tzdata elif command -v dnf >/dev/null 2>&1; then # Fedora - dnf install -y gcc make libffi-devel postgresql-devel git curl tzdata nodejs npm - else - echo "Package manager not found. Installing Node.js manually..." - # Try to install Node.js from NodeSource if available - curl -fsSL https://deb.nodesource.com/setup_18.x | bash - - apt-get install -y nodejs || echo "Failed to install Node.js" + dnf install -y gcc make libffi-devel postgresql-devel git curl tzdata fi - - name: Checkout repository - uses: actions/checkout@v4 + - name: Clone repository + run: | + git clone ${{ github.server_url }}/${{ github.repository }}.git . + git checkout ${{ github.sha }} - name: Install bundler run: | cd app gem install bundler -v 2.6.7 - - name: Cache Ruby gems - uses: actions/cache@v4 - with: - path: app/vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('app/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems- - - name: Install Ruby dependencies run: | cd app @@ -65,17 +54,16 @@ jobs: run: | cd app mkdir -p tmp - bundle exec rspec \ - --format progress \ - --format RspecJunitFormatter \ - --out tmp/rspec_results.xml + bundle exec rspec --format progress - - name: Upload test results - uses: actions/upload-artifact@v4 - if: always() - with: - name: rspec-results - path: app/tmp/rspec_results.xml + - name: Test status + run: | + if [ $? -eq 0 ]; then + echo "✅ All tests passed!" + else + echo "❌ Tests failed" + exit 1 + fi build: needs: test @@ -83,55 +71,52 @@ jobs: if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) steps: - - name: Install Node.js for actions + - name: Install Docker and git run: | - # Detect package manager and install Node.js if command -v apk >/dev/null 2>&1; then - apk add --no-cache nodejs npm + apk add --no-cache docker git elif command -v apt-get >/dev/null 2>&1; then - apt-get update && apt-get install -y nodejs npm + apt-get update && apt-get install -y docker.io git elif command -v yum >/dev/null 2>&1; then - yum install -y nodejs npm + yum install -y docker git elif command -v dnf >/dev/null 2>&1; then - dnf install -y nodejs npm - else - echo "Package manager not found. Installing Node.js manually..." - curl -fsSL https://deb.nodesource.com/setup_18.x | bash - - apt-get install -y nodejs || echo "Failed to install Node.js" + dnf install -y docker git fi - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Extract version tag - id: version + - name: Clone repository run: | + git clone ${{ github.server_url }}/${{ github.repository }}.git . + git checkout ${{ github.sha }} + + - name: Build Docker image + run: | + docker build -t baktainer-test . + + - name: Test Docker image + run: | + docker run --rm baktainer-test ruby --version + + - name: Login to Docker Hub + run: | + echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin + + - name: Tag and push image + run: | + IMAGE_NAME="${{ secrets.DOCKER_IMAGE_NAME }}" + + # Tag as latest + docker tag baktainer-test "${IMAGE_NAME}:latest" + docker push "${IMAGE_NAME}:latest" + + # Tag with version if it's a tag if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then - echo "VERSION_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + VERSION_TAG="${GITHUB_REF#refs/tags/}" + docker tag baktainer-test "${IMAGE_NAME}:${VERSION_TAG}" + docker push "${IMAGE_NAME}:${VERSION_TAG}" + echo "✅ Pushed ${IMAGE_NAME}:${VERSION_TAG}" fi - - - name: Set image tags - id: tags - run: | - IMAGE_NAME=${{ secrets.DOCKER_IMAGE_NAME }} - TAGS="${IMAGE_NAME}:latest" - if [ -n "${{ steps.version.outputs.VERSION_TAG }}" ]; then - TAGS="$TAGS,${IMAGE_NAME}:${{ steps.version.outputs.VERSION_TAG }}" - fi - echo "tags=$TAGS" >> $GITHUB_OUTPUT - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - push: true - tags: ${{ steps.tags.outputs.tags }} + + echo "✅ Docker image pushed successfully" notify: needs: [test, build] diff --git a/.forgejo/workflows/docker.yml b/.forgejo/workflows/docker.yml deleted file mode 100644 index 4a4a0d4..0000000 --- a/.forgejo/workflows/docker.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Build and Push Docker Image - -on: - push: - branches: - - main - tags: - - 'v*.*.*' - -jobs: - test: - runs-on: docker - container: - image: ruby:3.3-alpine - - steps: - - name: Install system dependencies including Node.js - run: | - # Detect package manager and install dependencies - if command -v apk >/dev/null 2>&1; then - # Alpine Linux - apk add --no-cache build-base libffi-dev linux-headers postgresql-dev git nodejs npm - elif command -v apt-get >/dev/null 2>&1; then - # Debian/Ubuntu - apt-get update && apt-get install -y build-essential libffi-dev libpq-dev git nodejs npm - elif command -v yum >/dev/null 2>&1; then - # CentOS/RHEL - yum install -y gcc make libffi-devel postgresql-devel git nodejs npm - elif command -v dnf >/dev/null 2>&1; then - # Fedora - dnf install -y gcc make libffi-devel postgresql-devel git nodejs npm - else - echo "Package manager not found. Installing Node.js manually..." - curl -fsSL https://deb.nodesource.com/setup_18.x | bash - - apt-get install -y nodejs || echo "Failed to install Node.js" - fi - - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install Ruby dependencies - run: | - cd app - gem install bundler -v 2.6.7 - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 - - - name: Run RSpec tests - run: | - cd app - mkdir -p tmp - bundle exec rspec \ - --format progress \ - --format RspecJunitFormatter \ - --out tmp/rspec_results.xml - - - name: Upload test results - uses: actions/upload-artifact@v4 - if: always() - with: - name: rspec-results - path: app/tmp/rspec_results.xml - - build: - needs: test - runs-on: docker - if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) - - steps: - - name: Install Node.js for actions - run: | - # Detect package manager and install Node.js - if command -v apk >/dev/null 2>&1; then - apk add --no-cache nodejs npm - elif command -v apt-get >/dev/null 2>&1; then - apt-get update && apt-get install -y nodejs npm - elif command -v yum >/dev/null 2>&1; then - yum install -y nodejs npm - elif command -v dnf >/dev/null 2>&1; then - dnf install -y nodejs npm - else - echo "Package manager not found. Installing Node.js manually..." - curl -fsSL https://deb.nodesource.com/setup_18.x | bash - - apt-get install -y nodejs || echo "Failed to install Node.js" - fi - - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Extract metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ secrets.DOCKER_IMAGE_NAME }} - tags: | - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=raw,value=latest,enable={{is_default_branch}} - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max \ No newline at end of file diff --git a/.forgejo/workflows/minimal.yml b/.forgejo/workflows/minimal.yml deleted file mode 100644 index db6714b..0000000 --- a/.forgejo/workflows/minimal.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Minimal CI - -on: [push] - -jobs: - test: - runs-on: docker - container: - image: ruby:3.3-alpine - - steps: - - name: Setup environment - run: | - apk add --no-cache git build-base libffi-dev linux-headers postgresql-dev - - - name: Clone repository - run: | - git clone ${{ github.server_url }}/${{ github.repository }}.git /workspace - cd /workspace - git checkout ${{ github.sha }} - - - name: Install dependencies - run: | - cd /workspace/app - gem install bundler -v 2.6.7 - bundle config path vendor/bundle - bundle install - - - name: Run tests - run: | - cd /workspace/app - bundle exec rspec - - - name: Success - run: echo "✅ Tests completed successfully" - - build: - needs: test - runs-on: docker - if: github.ref == 'refs/heads/main' - - steps: - - name: Setup environment - run: | - apk add --no-cache git docker - - - name: Clone repository - run: | - git clone ${{ github.server_url }}/${{ github.repository }}.git /workspace - cd /workspace - git checkout ${{ github.sha }} - - - name: Build image - run: | - cd /workspace - docker build -t test-image . - - - name: Success - run: echo "✅ Build completed successfully" \ No newline at end of file diff --git a/.forgejo/workflows/node-ruby.yml b/.forgejo/workflows/node-ruby.yml deleted file mode 100644 index dca25cd..0000000 --- a/.forgejo/workflows/node-ruby.yml +++ /dev/null @@ -1,121 +0,0 @@ -name: Node+Ruby CI Pipeline - -on: - push: - branches: - - main - tags: - - 'v*.*.*' - pull_request: - branches: - - main - -jobs: - test: - runs-on: docker - container: - image: node:18-alpine - defaults: - run: - working-directory: ./app - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install system dependencies - run: | - apk add --no-cache build-base libffi-dev linux-headers postgresql-dev git curl tzdata ruby ruby-dev ruby-bundler - - - name: Install bundler - run: gem install bundler -v 2.6.7 - - - name: Cache Ruby gems - uses: actions/cache@v4 - with: - path: app/vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('app/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems- - - - name: Install Ruby dependencies - run: | - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 - - - name: Run RSpec tests - run: | - mkdir -p tmp - bundle exec rspec \ - --format progress \ - --format RspecJunitFormatter \ - --out tmp/rspec_results.xml - - - name: Upload test results - uses: actions/upload-artifact@v4 - if: always() - with: - name: rspec-results - path: app/tmp/rspec_results.xml - - build: - needs: test - runs-on: docker - if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Extract version tag - id: version - run: | - if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then - echo "VERSION_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT - fi - - - name: Set image tags - id: tags - run: | - IMAGE_NAME=${{ secrets.DOCKER_IMAGE_NAME }} - TAGS="${IMAGE_NAME}:latest" - if [ -n "${{ steps.version.outputs.VERSION_TAG }}" ]; then - TAGS="$TAGS,${IMAGE_NAME}:${{ steps.version.outputs.VERSION_TAG }}" - fi - echo "tags=$TAGS" >> $GITHUB_OUTPUT - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - push: true - tags: ${{ steps.tags.outputs.tags }} - - notify: - needs: [test, build] - runs-on: docker - if: always() - - steps: - - name: Notify pipeline status - run: | - echo "📊 Pipeline Status Report:" - echo "🧪 Tests: ${{ needs.test.result }}" - if [ "${{ needs.build.result }}" != "skipped" ]; then - echo "🐳 Build: ${{ needs.build.result }}" - fi - - if [ "${{ needs.test.result }}" == "success" ]; then - echo "✅ All tests passed!" - else - echo "❌ Tests failed" - fi \ No newline at end of file diff --git a/.forgejo/workflows/shell-only.yml b/.forgejo/workflows/shell-only.yml deleted file mode 100644 index 359689a..0000000 --- a/.forgejo/workflows/shell-only.yml +++ /dev/null @@ -1,139 +0,0 @@ -name: Shell-Only CI (No Actions) - -on: - push: - branches: - - main - tags: - - 'v*.*.*' - pull_request: - branches: - - main - -jobs: - test: - runs-on: docker - container: - image: ruby:3.3-alpine - - steps: - - name: Install system dependencies - run: | - # Detect OS and install dependencies - if command -v apk >/dev/null 2>&1; then - # Alpine Linux - apk add --no-cache build-base libffi-dev linux-headers postgresql-dev git curl tzdata - elif command -v apt-get >/dev/null 2>&1; then - # Debian/Ubuntu - apt-get update && apt-get install -y build-essential libffi-dev libpq-dev git curl tzdata - elif command -v yum >/dev/null 2>&1; then - # CentOS/RHEL - yum install -y gcc make libffi-devel postgresql-devel git curl tzdata - elif command -v dnf >/dev/null 2>&1; then - # Fedora - dnf install -y gcc make libffi-devel postgresql-devel git curl tzdata - fi - - - name: Clone repository - run: | - git clone ${{ github.server_url }}/${{ github.repository }}.git . - git checkout ${{ github.sha }} - - - name: Install bundler - run: | - cd app - gem install bundler -v 2.6.7 - - - name: Install Ruby dependencies - run: | - cd app - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 - - - name: Run RSpec tests - run: | - cd app - mkdir -p tmp - bundle exec rspec --format progress - - - name: Test status - run: | - if [ $? -eq 0 ]; then - echo "✅ All tests passed!" - else - echo "❌ Tests failed" - exit 1 - fi - - build: - needs: test - runs-on: docker - if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) - - steps: - - name: Install Docker and git - run: | - if command -v apk >/dev/null 2>&1; then - apk add --no-cache docker git - elif command -v apt-get >/dev/null 2>&1; then - apt-get update && apt-get install -y docker.io git - elif command -v yum >/dev/null 2>&1; then - yum install -y docker git - elif command -v dnf >/dev/null 2>&1; then - dnf install -y docker git - fi - - - name: Clone repository - run: | - git clone ${{ github.server_url }}/${{ github.repository }}.git . - git checkout ${{ github.sha }} - - - name: Build Docker image - run: | - docker build -t baktainer-test . - - - name: Test Docker image - run: | - docker run --rm baktainer-test ruby --version - - - name: Login to Docker Hub - run: | - echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin - - - name: Tag and push image - run: | - IMAGE_NAME="${{ secrets.DOCKER_IMAGE_NAME }}" - - # Tag as latest - docker tag baktainer-test "${IMAGE_NAME}:latest" - docker push "${IMAGE_NAME}:latest" - - # Tag with version if it's a tag - if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then - VERSION_TAG="${GITHUB_REF#refs/tags/}" - docker tag baktainer-test "${IMAGE_NAME}:${VERSION_TAG}" - docker push "${IMAGE_NAME}:${VERSION_TAG}" - echo "✅ Pushed ${IMAGE_NAME}:${VERSION_TAG}" - fi - - echo "✅ Docker image pushed successfully" - - notify: - needs: [test, build] - runs-on: docker - if: always() - - steps: - - name: Notify pipeline status - run: | - echo "📊 Pipeline Status Report:" - echo "🧪 Tests: ${{ needs.test.result }}" - if [ "${{ needs.build.result }}" != "skipped" ]; then - echo "🐳 Build: ${{ needs.build.result }}" - fi - - if [ "${{ needs.test.result }}" == "success" ]; then - echo "✅ All tests passed!" - else - echo "❌ Tests failed" - fi \ No newline at end of file diff --git a/.forgejo/workflows/simple.yml b/.forgejo/workflows/simple.yml deleted file mode 100644 index 2e2d4b5..0000000 --- a/.forgejo/workflows/simple.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Simple CI Pipeline - -on: - push: - branches: - - main - tags: - - 'v*.*.*' - pull_request: - branches: - - main - -jobs: - test: - runs-on: docker - container: - image: ruby:3.3-alpine - defaults: - run: - working-directory: ./app - - steps: - - name: Checkout repository - run: | - apk add --no-cache git - git clone ${{ github.server_url }}/${{ github.repository }}.git . - git checkout ${{ github.sha }} - - - name: Install system dependencies - run: | - apk add --no-cache build-base libffi-dev linux-headers postgresql-dev curl tzdata - - - name: Install bundler - run: gem install bundler -v 2.6.7 - - - name: Install Ruby dependencies - run: | - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 - - - name: Run RSpec tests - run: | - mkdir -p tmp - bundle exec rspec --format progress - - - name: Test status - run: | - if [ $? -eq 0 ]; then - echo "✅ All tests passed!" - else - echo "❌ Tests failed" - exit 1 - fi - - build: - needs: test - runs-on: docker - if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) - - steps: - - name: Checkout repository - run: | - apk add --no-cache git - git clone ${{ github.server_url }}/${{ github.repository }}.git . - git checkout ${{ github.sha }} - - - name: Install Docker - run: | - apk add --no-cache docker - - - name: Build Docker image - run: | - docker build -t baktainer-test . - - - name: Test Docker image - run: | - docker run --rm baktainer-test ruby --version - - - name: Login to Docker Hub - run: | - echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin - - - name: Tag and push image - run: | - IMAGE_NAME="${{ secrets.DOCKER_IMAGE_NAME }}" - - # Tag as latest - docker tag baktainer-test "${IMAGE_NAME}:latest" - docker push "${IMAGE_NAME}:latest" - - # Tag with version if it's a tag - if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then - VERSION_TAG="${GITHUB_REF#refs/tags/}" - docker tag baktainer-test "${IMAGE_NAME}:${VERSION_TAG}" - docker push "${IMAGE_NAME}:${VERSION_TAG}" - echo "✅ Pushed ${IMAGE_NAME}:${VERSION_TAG}" - fi - - echo "✅ Docker image pushed successfully" - - notify: - needs: [test, build] - runs-on: docker - if: always() - - steps: - - name: Notify pipeline status - run: | - echo "📊 Pipeline Status Report:" - echo "🧪 Tests: ${{ needs.test.result }}" - if [ "${{ needs.build.result }}" != "skipped" ]; then - echo "🐳 Build: ${{ needs.build.result }}" - fi - - if [ "${{ needs.test.result }}" == "success" ]; then - echo "✅ All tests passed!" - else - echo "❌ Tests failed" - fi \ No newline at end of file diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml deleted file mode 100644 index 6174d7d..0000000 --- a/.forgejo/workflows/test.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: Run Tests - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - test: - runs-on: docker - container: - image: ruby:3.3-alpine - - steps: - - name: Install system dependencies including Node.js - run: | - # Detect package manager and install dependencies - if command -v apk >/dev/null 2>&1; then - # Alpine Linux - apk add --no-cache build-base libffi-dev linux-headers postgresql-dev git curl tzdata nodejs npm - elif command -v apt-get >/dev/null 2>&1; then - # Debian/Ubuntu - apt-get update && apt-get install -y build-essential libffi-dev libpq-dev git curl tzdata nodejs npm - elif command -v yum >/dev/null 2>&1; then - # CentOS/RHEL - yum install -y gcc make libffi-devel postgresql-devel git curl tzdata nodejs npm - elif command -v dnf >/dev/null 2>&1; then - # Fedora - dnf install -y gcc make libffi-devel postgresql-devel git curl tzdata nodejs npm - else - echo "Package manager not found. Installing Node.js manually..." - curl -fsSL https://deb.nodesource.com/setup_18.x | bash - - apt-get install -y nodejs || echo "Failed to install Node.js" - fi - - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install bundler - run: | - cd app - gem install bundler -v 2.6.7 - - - name: Cache Ruby gems - uses: actions/cache@v4 - with: - path: app/vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('app/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems- - - - name: Install Ruby dependencies - run: | - cd app - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 - - - name: Run unit tests - run: | - cd app - echo "🧪 Running unit tests..." - bundle exec rspec spec/unit/ --format documentation - - - name: Run integration tests - run: | - cd app - echo "🧪 Running integration tests..." - bundle exec rspec spec/integration/ --format documentation - - - name: Generate coverage report - run: | - cd app - echo "📊 Generating coverage report..." - COVERAGE=true bundle exec rspec --format progress - - - name: Upload coverage results - uses: actions/upload-artifact@v4 - if: always() - with: - name: coverage-report - path: app/coverage/ \ No newline at end of file diff --git a/app/spec/examples.txt b/app/spec/examples.txt index c6b47ae..93a3614 100644 --- a/app/spec/examples.txt +++ b/app/spec/examples.txt @@ -1,123 +1,123 @@ example_id | status | run_time | ------------------------------------------------- | ------ | --------------- | -./spec/integration/backup_workflow_spec.rb[1:1:1] | passed | 0.00171 seconds | -./spec/integration/backup_workflow_spec.rb[1:1:2] | passed | 0.00195 seconds | -./spec/integration/backup_workflow_spec.rb[1:2:1] | passed | 0.00881 seconds | -./spec/integration/backup_workflow_spec.rb[1:2:2] | passed | 0.00956 seconds | -./spec/integration/backup_workflow_spec.rb[1:3:1] | passed | 0.00764 seconds | -./spec/integration/backup_workflow_spec.rb[1:3:2] | passed | 0.00261 seconds | -./spec/integration/backup_workflow_spec.rb[1:4:1] | passed | 0.00831 seconds | -./spec/integration/backup_workflow_spec.rb[1:4:2] | passed | 0.00211 seconds | -./spec/integration/backup_workflow_spec.rb[1:5:1] | passed | 0.52977 seconds | -./spec/integration/backup_workflow_spec.rb[1:5:2] | passed | 0.52801 seconds | -./spec/integration/backup_workflow_spec.rb[1:5:3] | passed | 0.10974 seconds | -./spec/integration/backup_workflow_spec.rb[1:6:1] | passed | 0.00171 seconds | -./spec/integration/backup_workflow_spec.rb[1:6:2] | passed | 0.00694 seconds | -./spec/integration/backup_workflow_spec.rb[1:7:1] | passed | 0.52673 seconds | -./spec/unit/backup_command_spec.rb[1:1:1] | passed | 0.00024 seconds | -./spec/unit/backup_command_spec.rb[1:1:2] | passed | 0.00026 seconds | -./spec/unit/backup_command_spec.rb[1:2:1] | passed | 0.00023 seconds | -./spec/unit/backup_command_spec.rb[1:3:1] | passed | 0.00022 seconds | -./spec/unit/backup_command_spec.rb[1:3:2] | passed | 0.00022 seconds | -./spec/unit/backup_command_spec.rb[1:4:1] | passed | 0.00069 seconds | -./spec/unit/backup_command_spec.rb[1:5:1] | passed | 0.00024 seconds | -./spec/unit/backup_command_spec.rb[1:5:2] | passed | 0.00022 seconds | -./spec/unit/backup_command_spec.rb[1:6:1] | passed | 0.00023 seconds | -./spec/unit/backup_command_spec.rb[1:7:1] | passed | 0.00026 seconds | -./spec/unit/backup_command_spec.rb[1:7:2] | passed | 0.00022 seconds | -./spec/unit/backup_command_spec.rb[1:8:1] | passed | 0.00022 seconds | -./spec/unit/backup_command_spec.rb[1:8:2] | passed | 0.00024 seconds | -./spec/unit/backup_command_spec.rb[1:8:3] | passed | 0.00022 seconds | -./spec/unit/backup_command_spec.rb[1:8:4] | passed | 0.00024 seconds | -./spec/unit/backup_command_spec.rb[1:8:5:1] | passed | 0.00039 seconds | -./spec/unit/backup_command_spec.rb[1:8:5:2] | passed | 0.00023 seconds | -./spec/unit/backup_command_spec.rb[1:8:5:3] | passed | 0.00024 seconds | -./spec/unit/backup_command_spec.rb[1:8:5:4] | passed | 0.00027 seconds | -./spec/unit/backup_command_spec.rb[1:8:5:5] | passed | 0.00026 seconds | -./spec/unit/backup_encryption_spec.rb[1:1:1] | passed | 0.00085 seconds | -./spec/unit/backup_encryption_spec.rb[1:1:2:1] | passed | 0.00067 seconds | -./spec/unit/backup_encryption_spec.rb[1:2:1:1] | passed | 0.00461 seconds | -./spec/unit/backup_encryption_spec.rb[1:2:1:2] | passed | 0.0043 seconds | -./spec/unit/backup_encryption_spec.rb[1:2:1:3] | passed | 0.00355 seconds | -./spec/unit/backup_encryption_spec.rb[1:2:2:1] | passed | 0.00081 seconds | -./spec/unit/backup_encryption_spec.rb[1:3:1:1] | passed | 0.00449 seconds | -./spec/unit/backup_encryption_spec.rb[1:3:1:2] | passed | 0.0051 seconds | -./spec/unit/backup_encryption_spec.rb[1:3:1:3] | passed | 0.00573 seconds | -./spec/unit/backup_encryption_spec.rb[1:3:2:1] | passed | 0.00437 seconds | -./spec/unit/backup_encryption_spec.rb[1:4:1:1] | passed | 0.0035 seconds | +./spec/integration/backup_workflow_spec.rb[1:1:1] | passed | 0.00318 seconds | +./spec/integration/backup_workflow_spec.rb[1:1:2] | passed | 0.00332 seconds | +./spec/integration/backup_workflow_spec.rb[1:2:1] | passed | 0.00772 seconds | +./spec/integration/backup_workflow_spec.rb[1:2:2] | passed | 0.00195 seconds | +./spec/integration/backup_workflow_spec.rb[1:3:1] | passed | 0.00807 seconds | +./spec/integration/backup_workflow_spec.rb[1:3:2] | passed | 0.00176 seconds | +./spec/integration/backup_workflow_spec.rb[1:4:1] | passed | 0.00917 seconds | +./spec/integration/backup_workflow_spec.rb[1:4:2] | passed | 0.00357 seconds | +./spec/integration/backup_workflow_spec.rb[1:5:1] | passed | 0.52901 seconds | +./spec/integration/backup_workflow_spec.rb[1:5:2] | passed | 0.52794 seconds | +./spec/integration/backup_workflow_spec.rb[1:5:3] | passed | 0.1106 seconds | +./spec/integration/backup_workflow_spec.rb[1:6:1] | passed | 0.00659 seconds | +./spec/integration/backup_workflow_spec.rb[1:6:2] | passed | 0.00855 seconds | +./spec/integration/backup_workflow_spec.rb[1:7:1] | passed | 0.52686 seconds | +./spec/unit/backup_command_spec.rb[1:1:1] | passed | 0.00056 seconds | +./spec/unit/backup_command_spec.rb[1:1:2] | passed | 0.00049 seconds | +./spec/unit/backup_command_spec.rb[1:2:1] | passed | 0.00033 seconds | +./spec/unit/backup_command_spec.rb[1:3:1] | passed | 0.00034 seconds | +./spec/unit/backup_command_spec.rb[1:3:2] | passed | 0.00029 seconds | +./spec/unit/backup_command_spec.rb[1:4:1] | passed | 0.00058 seconds | +./spec/unit/backup_command_spec.rb[1:5:1] | passed | 0.00028 seconds | +./spec/unit/backup_command_spec.rb[1:5:2] | passed | 0.00029 seconds | +./spec/unit/backup_command_spec.rb[1:6:1] | passed | 0.00028 seconds | +./spec/unit/backup_command_spec.rb[1:7:1] | passed | 0.00058 seconds | +./spec/unit/backup_command_spec.rb[1:7:2] | passed | 0.00062 seconds | +./spec/unit/backup_command_spec.rb[1:8:1] | passed | 0.00031 seconds | +./spec/unit/backup_command_spec.rb[1:8:2] | passed | 0.00035 seconds | +./spec/unit/backup_command_spec.rb[1:8:3] | passed | 0.00033 seconds | +./spec/unit/backup_command_spec.rb[1:8:4] | passed | 0.00032 seconds | +./spec/unit/backup_command_spec.rb[1:8:5:1] | passed | 0.00032 seconds | +./spec/unit/backup_command_spec.rb[1:8:5:2] | passed | 0.00029 seconds | +./spec/unit/backup_command_spec.rb[1:8:5:3] | passed | 0.0003 seconds | +./spec/unit/backup_command_spec.rb[1:8:5:4] | passed | 0.00029 seconds | +./spec/unit/backup_command_spec.rb[1:8:5:5] | passed | 0.00032 seconds | +./spec/unit/backup_encryption_spec.rb[1:1:1] | passed | 0.00139 seconds | +./spec/unit/backup_encryption_spec.rb[1:1:2:1] | passed | 0.00134 seconds | +./spec/unit/backup_encryption_spec.rb[1:2:1:1] | passed | 0.0678 seconds | +./spec/unit/backup_encryption_spec.rb[1:2:1:2] | passed | 0.00836 seconds | +./spec/unit/backup_encryption_spec.rb[1:2:1:3] | passed | 0.00863 seconds | +./spec/unit/backup_encryption_spec.rb[1:2:2:1] | passed | 0.00101 seconds | +./spec/unit/backup_encryption_spec.rb[1:3:1:1] | passed | 0.0058 seconds | +./spec/unit/backup_encryption_spec.rb[1:3:1:2] | passed | 0.00739 seconds | +./spec/unit/backup_encryption_spec.rb[1:3:1:3] | passed | 0.00706 seconds | +./spec/unit/backup_encryption_spec.rb[1:3:2:1] | passed | 0.00177 seconds | +./spec/unit/backup_encryption_spec.rb[1:4:1:1] | passed | 0.00528 seconds | ./spec/unit/backup_encryption_spec.rb[1:4:1:2] | passed | 0.04324 seconds | -./spec/unit/backup_encryption_spec.rb[1:4:1:3] | passed | 0.04267 seconds | -./spec/unit/backup_encryption_spec.rb[1:4:2:1] | passed | 0.00067 seconds | -./spec/unit/backup_encryption_spec.rb[1:5:1:1] | passed | 0.04521 seconds | -./spec/unit/backup_encryption_spec.rb[1:5:2:1] | passed | 0.00691 seconds | -./spec/unit/backup_encryption_spec.rb[1:5:3:1] | passed | 0.00497 seconds | -./spec/unit/backup_encryption_spec.rb[1:6:1] | passed | 0.00245 seconds | -./spec/unit/backup_rotation_spec.rb[1:1:1] | passed | 0.00051 seconds | -./spec/unit/backup_rotation_spec.rb[1:1:2] | passed | 0.00073 seconds | -./spec/unit/backup_rotation_spec.rb[1:2:1:1] | passed | 0.00136 seconds | -./spec/unit/backup_rotation_spec.rb[1:2:1:2] | passed | 0.00146 seconds | -./spec/unit/backup_rotation_spec.rb[1:2:2:1] | passed | 0.00146 seconds | -./spec/unit/backup_rotation_spec.rb[1:2:2:2] | passed | 0.00181 seconds | -./spec/unit/backup_rotation_spec.rb[1:2:3:1] | passed | 0.0019 seconds | -./spec/unit/backup_rotation_spec.rb[1:2:4:1] | passed | 0.00583 seconds | -./spec/unit/backup_rotation_spec.rb[1:2:4:2] | passed | 0.00633 seconds | -./spec/unit/backup_rotation_spec.rb[1:3:1] | passed | 0.00255 seconds | -./spec/unit/backup_rotation_spec.rb[1:3:2] | passed | 0.00145 seconds | -./spec/unit/baktainer_spec.rb[1:1:1] | passed | 0.00125 seconds | -./spec/unit/baktainer_spec.rb[1:1:2] | passed | 0.00128 seconds | -./spec/unit/baktainer_spec.rb[1:1:3] | passed | 0.00131 seconds | -./spec/unit/baktainer_spec.rb[1:1:4] | passed | 0.49121 seconds | -./spec/unit/baktainer_spec.rb[1:1:5] | passed | 0.00133 seconds | -./spec/unit/baktainer_spec.rb[1:2:1] | passed | 0.00253 seconds | -./spec/unit/baktainer_spec.rb[1:2:2] | passed | 0.00184 seconds | -./spec/unit/baktainer_spec.rb[1:2:3] | passed | 0.00259 seconds | -./spec/unit/baktainer_spec.rb[1:3:1] | passed | 0.00182 seconds | -./spec/unit/baktainer_spec.rb[1:3:2] | passed | 0.00171 seconds | -./spec/unit/baktainer_spec.rb[1:3:3] | passed | 0.00189 seconds | -./spec/unit/baktainer_spec.rb[1:3:4] | passed | 0.00673 seconds | -./spec/unit/baktainer_spec.rb[1:4:1:1] | passed | 0.00201 seconds | -./spec/unit/baktainer_spec.rb[1:4:2:1] | passed | 0.27045 seconds | -./spec/unit/container_spec.rb[1:1:1] | passed | 0.00145 seconds | -./spec/unit/container_spec.rb[1:2:1] | passed | 0.00128 seconds | -./spec/unit/container_spec.rb[1:2:2] | passed | 0.00089 seconds | -./spec/unit/container_spec.rb[1:3:1] | passed | 0.00078 seconds | -./spec/unit/container_spec.rb[1:3:2] | passed | 0.00084 seconds | -./spec/unit/container_spec.rb[1:4:1] | passed | 0.00086 seconds | -./spec/unit/container_spec.rb[1:5:1] | passed | 0.00109 seconds | -./spec/unit/container_spec.rb[1:5:2] | passed | 0.00088 seconds | -./spec/unit/container_spec.rb[1:6:1] | passed | 0.00096 seconds | -./spec/unit/container_spec.rb[1:7:1] | passed | 0.00083 seconds | -./spec/unit/container_spec.rb[1:8:1] | passed | 0.0009 seconds | -./spec/unit/container_spec.rb[1:9:1:1] | passed | 0.00124 seconds | -./spec/unit/container_spec.rb[1:9:2:1] | passed | 0.00095 seconds | -./spec/unit/container_spec.rb[1:9:3:1] | passed | 0.00073 seconds | -./spec/unit/container_spec.rb[1:9:4:1] | passed | 0.00119 seconds | -./spec/unit/container_spec.rb[1:9:5:1] | passed | 0.00151 seconds | -./spec/unit/container_spec.rb[1:9:6:1] | passed | 0.00097 seconds | -./spec/unit/container_spec.rb[1:10:1] | passed | 0.00125 seconds | -./spec/unit/container_spec.rb[1:10:2] | passed | 0.00112 seconds | -./spec/unit/container_spec.rb[1:10:3] | passed | 0.00119 seconds | -./spec/unit/container_spec.rb[1:11:1] | passed | 0.00098 seconds | -./spec/unit/container_spec.rb[1:11:2] | passed | 0.00139 seconds | -./spec/unit/container_spec.rb[1:11:3] | passed | 0.00109 seconds | +./spec/unit/backup_encryption_spec.rb[1:4:1:3] | passed | 0.04443 seconds | +./spec/unit/backup_encryption_spec.rb[1:4:2:1] | passed | 0.00081 seconds | +./spec/unit/backup_encryption_spec.rb[1:5:1:1] | passed | 0.04693 seconds | +./spec/unit/backup_encryption_spec.rb[1:5:2:1] | passed | 0.00543 seconds | +./spec/unit/backup_encryption_spec.rb[1:5:3:1] | passed | 0.0056 seconds | +./spec/unit/backup_encryption_spec.rb[1:6:1] | passed | 0.00104 seconds | +./spec/unit/backup_rotation_spec.rb[1:1:1] | passed | 0.00072 seconds | +./spec/unit/backup_rotation_spec.rb[1:1:2] | passed | 0.00056 seconds | +./spec/unit/backup_rotation_spec.rb[1:2:1:1] | passed | 0.00149 seconds | +./spec/unit/backup_rotation_spec.rb[1:2:1:2] | passed | 0.00151 seconds | +./spec/unit/backup_rotation_spec.rb[1:2:2:1] | passed | 0.00182 seconds | +./spec/unit/backup_rotation_spec.rb[1:2:2:2] | passed | 0.00202 seconds | +./spec/unit/backup_rotation_spec.rb[1:2:3:1] | passed | 0.00213 seconds | +./spec/unit/backup_rotation_spec.rb[1:2:4:1] | passed | 0.00553 seconds | +./spec/unit/backup_rotation_spec.rb[1:2:4:2] | passed | 0.00519 seconds | +./spec/unit/backup_rotation_spec.rb[1:3:1] | passed | 0.00282 seconds | +./spec/unit/backup_rotation_spec.rb[1:3:2] | passed | 0.00133 seconds | +./spec/unit/baktainer_spec.rb[1:1:1] | passed | 0.00138 seconds | +./spec/unit/baktainer_spec.rb[1:1:2] | passed | 0.00142 seconds | +./spec/unit/baktainer_spec.rb[1:1:3] | passed | 0.00135 seconds | +./spec/unit/baktainer_spec.rb[1:1:4] | passed | 0.26515 seconds | +./spec/unit/baktainer_spec.rb[1:1:5] | passed | 0.00123 seconds | +./spec/unit/baktainer_spec.rb[1:2:1] | passed | 0.00213 seconds | +./spec/unit/baktainer_spec.rb[1:2:2] | passed | 0.00345 seconds | +./spec/unit/baktainer_spec.rb[1:2:3] | passed | 0.00271 seconds | +./spec/unit/baktainer_spec.rb[1:3:1] | passed | 0.00177 seconds | +./spec/unit/baktainer_spec.rb[1:3:2] | passed | 0.00193 seconds | +./spec/unit/baktainer_spec.rb[1:3:3] | passed | 0.00191 seconds | +./spec/unit/baktainer_spec.rb[1:3:4] | passed | 0.00255 seconds | +./spec/unit/baktainer_spec.rb[1:4:1:1] | passed | 0.00216 seconds | +./spec/unit/baktainer_spec.rb[1:4:2:1] | passed | 0.35042 seconds | +./spec/unit/container_spec.rb[1:1:1] | passed | 0.00112 seconds | +./spec/unit/container_spec.rb[1:2:1] | passed | 0.00086 seconds | +./spec/unit/container_spec.rb[1:2:2] | passed | 0.00088 seconds | +./spec/unit/container_spec.rb[1:3:1] | passed | 0.00091 seconds | +./spec/unit/container_spec.rb[1:3:2] | passed | 0.00097 seconds | +./spec/unit/container_spec.rb[1:4:1] | passed | 0.00088 seconds | +./spec/unit/container_spec.rb[1:5:1] | passed | 0.00088 seconds | +./spec/unit/container_spec.rb[1:5:2] | passed | 0.00094 seconds | +./spec/unit/container_spec.rb[1:6:1] | passed | 0.0009 seconds | +./spec/unit/container_spec.rb[1:7:1] | passed | 0.00102 seconds | +./spec/unit/container_spec.rb[1:8:1] | passed | 0.00142 seconds | +./spec/unit/container_spec.rb[1:9:1:1] | passed | 0.00101 seconds | +./spec/unit/container_spec.rb[1:9:2:1] | passed | 0.00097 seconds | +./spec/unit/container_spec.rb[1:9:3:1] | passed | 0.0008 seconds | +./spec/unit/container_spec.rb[1:9:4:1] | passed | 0.00132 seconds | +./spec/unit/container_spec.rb[1:9:5:1] | passed | 0.00163 seconds | +./spec/unit/container_spec.rb[1:9:6:1] | passed | 0.00138 seconds | +./spec/unit/container_spec.rb[1:10:1] | passed | 0.00183 seconds | +./spec/unit/container_spec.rb[1:10:2] | passed | 0.00127 seconds | +./spec/unit/container_spec.rb[1:10:3] | passed | 0.00606 seconds | +./spec/unit/container_spec.rb[1:11:1] | passed | 0.00107 seconds | +./spec/unit/container_spec.rb[1:11:2] | passed | 0.00147 seconds | +./spec/unit/container_spec.rb[1:11:3] | passed | 0.00129 seconds | ./spec/unit/label_validator_spec.rb[1:1:1:1] | passed | 0.00039 seconds | -./spec/unit/label_validator_spec.rb[1:1:1:2] | passed | 0.0003 seconds | -./spec/unit/label_validator_spec.rb[1:1:2:1] | passed | 0.00037 seconds | -./spec/unit/label_validator_spec.rb[1:1:3:1] | passed | 0.00035 seconds | -./spec/unit/label_validator_spec.rb[1:1:4:1] | passed | 0.00245 seconds | -./spec/unit/label_validator_spec.rb[1:1:5:1] | passed | 0.00036 seconds | -./spec/unit/label_validator_spec.rb[1:1:6:1] | passed | 0.00033 seconds | -./spec/unit/label_validator_spec.rb[1:2:1] | passed | 0.00031 seconds | -./spec/unit/label_validator_spec.rb[1:2:2] | passed | 0.00026 seconds | -./spec/unit/label_validator_spec.rb[1:3:1] | passed | 0.00126 seconds | -./spec/unit/label_validator_spec.rb[1:3:2] | passed | 0.00112 seconds | -./spec/unit/label_validator_spec.rb[1:4:1] | passed | 0.00093 seconds | -./spec/unit/label_validator_spec.rb[1:4:2] | passed | 0.00034 seconds | -./spec/unit/notification_system_spec.rb[1:1:1:1] | passed | 0.00046 seconds | -./spec/unit/notification_system_spec.rb[1:1:2:1] | passed | 0.00055 seconds | -./spec/unit/notification_system_spec.rb[1:2:1] | passed | 0.00089 seconds | -./spec/unit/notification_system_spec.rb[1:3:1] | passed | 0.00095 seconds | -./spec/unit/notification_system_spec.rb[1:4:1] | passed | 0.001 seconds | -./spec/unit/notification_system_spec.rb[1:5:1] | passed | 0.02489 seconds | -./spec/unit/notification_system_spec.rb[1:6:1] | passed | 0.00487 seconds | -./spec/unit/notification_system_spec.rb[1:6:2] | passed | 0.00057 seconds | +./spec/unit/label_validator_spec.rb[1:1:1:2] | passed | 0.00036 seconds | +./spec/unit/label_validator_spec.rb[1:1:2:1] | passed | 0.00035 seconds | +./spec/unit/label_validator_spec.rb[1:1:3:1] | passed | 0.00042 seconds | +./spec/unit/label_validator_spec.rb[1:1:4:1] | passed | 0.00039 seconds | +./spec/unit/label_validator_spec.rb[1:1:5:1] | passed | 0.00044 seconds | +./spec/unit/label_validator_spec.rb[1:1:6:1] | passed | 0.00134 seconds | +./spec/unit/label_validator_spec.rb[1:2:1] | passed | 0.0022 seconds | +./spec/unit/label_validator_spec.rb[1:2:2] | passed | 0.00105 seconds | +./spec/unit/label_validator_spec.rb[1:3:1] | passed | 0.00068 seconds | +./spec/unit/label_validator_spec.rb[1:3:2] | passed | 0.00117 seconds | +./spec/unit/label_validator_spec.rb[1:4:1] | passed | 0.00032 seconds | +./spec/unit/label_validator_spec.rb[1:4:2] | passed | 0.00032 seconds | +./spec/unit/notification_system_spec.rb[1:1:1:1] | passed | 0.00106 seconds | +./spec/unit/notification_system_spec.rb[1:1:2:1] | passed | 0.00358 seconds | +./spec/unit/notification_system_spec.rb[1:2:1] | passed | 0.03763 seconds | +./spec/unit/notification_system_spec.rb[1:3:1] | passed | 0.00117 seconds | +./spec/unit/notification_system_spec.rb[1:4:1] | passed | 0.00228 seconds | +./spec/unit/notification_system_spec.rb[1:5:1] | passed | 0.00097 seconds | +./spec/unit/notification_system_spec.rb[1:6:1] | passed | 0.00058 seconds | +./spec/unit/notification_system_spec.rb[1:6:2] | passed | 0.00062 seconds | diff --git a/app/spec/unit/container_spec.rb b/app/spec/unit/container_spec.rb index 3e15711..8b4cf54 100644 --- a/app/spec/unit/container_spec.rb +++ b/app/spec/unit/container_spec.rb @@ -51,7 +51,10 @@ RSpec.describe Baktainer::Container do allow(docker_container).to receive(:info).and_return( container_info.merge('State' => nil) ) - expect(container.state).to be_nil + allow(docker_container).to receive(:json).and_return( + 'State' => { 'Status' => 'unknown' } + ) + expect(container.state).to eq('unknown') end end