|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one or more |
| 2 | +# contributor license agreements. See the NOTICE file distributed with |
| 3 | +# this work for additional information regarding copyright ownership. |
| 4 | +# The ASF licenses this file to You under the Apache License, Version 2.0 |
| 5 | +# (the "License"); you may not use this file except in compliance with |
| 6 | +# the License. You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +name: Upgrade Ranger |
| 17 | + |
| 18 | +on: |
| 19 | + workflow_dispatch: |
| 20 | + inputs: |
| 21 | + build-branch: |
| 22 | + description: 'branch to checkout and build' |
| 23 | + required: true |
| 24 | + |
| 25 | +jobs: |
| 26 | + build: |
| 27 | + runs-on: ubuntu-22.04 |
| 28 | + timeout-minutes: 60 |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + ref: ${{ inputs.build-branch }} |
| 33 | + |
| 34 | + - name: Clean up Docker space |
| 35 | + run: docker system prune --all --force --volumes |
| 36 | + |
| 37 | + - name: Build Ranger from branch ${{ inputs.build-branch }} in Docker |
| 38 | + run: | |
| 39 | + cd dev-support/ranger-docker |
| 40 | + docker compose -f docker-compose.ranger-build.yml build |
| 41 | + docker compose -f docker-compose.ranger-build.yml up -d |
| 42 | +
|
| 43 | + # Get container ID of ranger-build |
| 44 | + CONTAINER_ID=$(docker ps -aqf "name=ranger-build") |
| 45 | +
|
| 46 | + docker logs -f $CONTAINER_ID & |
| 47 | +
|
| 48 | + # Wait for the container to exit |
| 49 | + docker wait $CONTAINER_ID |
| 50 | +
|
| 51 | + - name: Upload build artifacts |
| 52 | + uses: actions/upload-artifact@v4 |
| 53 | + with: |
| 54 | + name: ${{ inputs.build-branch }}-build-artifacts |
| 55 | + path: dev-support/ranger-docker/dist/* |
| 56 | + |
| 57 | + upgrade: |
| 58 | + needs: build |
| 59 | + strategy: |
| 60 | + fail-fast: false |
| 61 | + matrix: |
| 62 | + earlier-release: [2.6.0] |
| 63 | + db: [postgres, mysql, oracle] |
| 64 | + runs-on: ubuntu-22.04 |
| 65 | + timeout-minutes: 60 |
| 66 | + steps: |
| 67 | + - uses: actions/checkout@v4 |
| 68 | + with: |
| 69 | + ref: ${{ inputs.build-branch }} |
| 70 | + |
| 71 | + - name: Download previous build artifacts |
| 72 | + uses: actions/download-artifact@v4 |
| 73 | + with: |
| 74 | + name: ${{ inputs.build-branch }}-build-artifacts |
| 75 | + |
| 76 | + - name: Copy artifacts for docker build |
| 77 | + run: | |
| 78 | + cp ranger-*.tar.gz dev-support/ranger-docker/dist |
| 79 | + cp version dev-support/ranger-docker/dist |
| 80 | + ls -lrt dev-support/ranger-docker/dist/ |
| 81 | + |
| 82 | + - name: Run download-archives.sh |
| 83 | + run: | |
| 84 | + cd dev-support/ranger-docker |
| 85 | + ./download-archives.sh none |
| 86 | + |
| 87 | + - name: Bringing up Ranger ${{ matrix.earlier-release }} in Docker |
| 88 | + run: | |
| 89 | + cd dev-support/ranger-docker |
| 90 | + chmod +x download-ranger.sh && ./download-ranger.sh |
| 91 | + export RANGER_DB_TYPE=${{ matrix.db }} |
| 92 | + export RANGER_VERSION=${{ matrix.earlier-release }} |
| 93 | + docker compose -f docker-compose.ranger.yml build |
| 94 | + docker compose -f docker-compose.ranger.yml up -d |
| 95 | + sleep 30 |
| 96 | + docker logs ranger |
| 97 | +
|
| 98 | + - name: Upgrading to ${{ inputs.build-branch }} in Docker |
| 99 | + run: | |
| 100 | + cd dev-support/ranger-docker |
| 101 | + export RANGER_DB_TYPE=${{ matrix.db }} |
| 102 | + docker compose -f docker-compose.ranger.yml build |
| 103 | + docker compose -f docker-compose.ranger.yml up -d |
| 104 | + sleep 180 |
| 105 | + docker logs ranger |
| 106 | +
|
| 107 | + - name: Remove running containers |
| 108 | + run: | |
| 109 | + docker stop $(docker ps -q) && docker rm $(docker ps -aq) |
0 commit comments