[RHIDP-11652] Add BYOM Architecture for Lightspeed (#200) #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release-1.[0-9]+ | |
| pull_request: | |
| branches: | |
| - main | |
| - release-1.[0-9]+ | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Lint | |
| # Based on https://github.com/zavoloklom/docker-compose-linter/tree/main?tab=readme-ov-file | |
| run: | | |
| npx --yes dclint . | |
| test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-24.04 | |
| - ubuntu-24.04-arm | |
| tool: | |
| - docker | |
| - podman | |
| userConfig: | |
| - "false" | |
| - "true" | |
| composeConfig: | |
| - name: "default" | |
| cliArgs: "" | |
| - name: "corporate-proxy" | |
| cliArgs: "-f compose.yaml -f compose-with-corporate-proxy.yaml" | |
| - name: "dynamic-plugins-root" | |
| cliArgs: "-f compose.yaml -f compose-dynamic-plugins-root.yaml" | |
| - name: "orchestrator-workflow" | |
| cliArgs: "-f compose.yaml -f orchestrator/compose.yaml" | |
| - name: "developer-lightspeed" | |
| cliArgs: "-f compose.yaml -f developer-lightspeed/compose.yaml" | |
| name: "${{ matrix.tool }} compose - ${{ matrix.composeConfig.name }}${{ matrix.os != 'ubuntu-24.04' && format(' - {0}', matrix.os) || '' }}${{ matrix.userConfig == 'true' && ' - user config' || '' }}" | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| DOCKER_COMPOSE_VERSION: v5.0.1 | |
| PODMAN_IMAGE: quay.io/podman/stable:v5 | |
| # The default corporate proxy image is located on registry.redhat.io, which requires authentication. | |
| CORPORATE_PROXY_IMAGE: docker.io/ubuntu/squid:latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Remove conflicting packages | |
| run: | | |
| # Remove any previous installations of Podman and Docker | |
| for pkg in docker.io \ | |
| docker-doc \ | |
| docker-compose \ | |
| docker-compose-v2 \ | |
| podman-docker \ | |
| containerd \ | |
| crun \ | |
| runc \ | |
| buildah \ | |
| ; do | |
| sudo apt-get remove --purge -y $pkg || true | |
| done | |
| - name: Update Docker version | |
| # https://docs.docker.com/engine/install/ubuntu#install-using-the-repository | |
| # Docker is also needed for Podman tests (to run the Podman container) | |
| run: | | |
| # Add Docker's official GPG key: | |
| sudo apt-get update | |
| sudo apt-get install ca-certificates curl | |
| sudo install -m 0755 -d /etc/apt/keyrings | |
| sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc | |
| sudo chmod a+r /etc/apt/keyrings/docker.asc | |
| # Add the repository to Apt sources: | |
| echo \ | |
| "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ | |
| $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \ | |
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
| sudo apt-get update | |
| sudo apt-get install -y docker-ce \ | |
| docker-ce-cli \ | |
| containerd.io \ | |
| docker-buildx-plugin | |
| # Install standalone docker-compose for consistent version across docker/podman tests | |
| echo "Installing docker-compose $DOCKER_COMPOSE_VERSION..." | |
| sudo curl -fsSL "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-linux-$(uname -m)" \ | |
| -o /usr/local/bin/docker-compose | |
| sudo chmod +x /usr/local/bin/docker-compose | |
| # Also install as Docker CLI plugin | |
| sudo mkdir -p /usr/local/lib/docker/cli-plugins | |
| sudo ln -sf /usr/local/bin/docker-compose /usr/local/lib/docker/cli-plugins/docker-compose | |
| - name: Setup Podman container environment | |
| id: setup-podman | |
| if: ${{ matrix.tool == 'podman' }} | |
| uses: rm3l/setup-containerized-podman@7e2e9a2ddc2da87cbe754c0ed8975b7368388f56 # v2.0.0 | |
| with: | |
| podman-image: ${{ env.PODMAN_IMAGE }} | |
| compose-provider: docker-compose | |
| docker-compose-version: ${{ env.DOCKER_COMPOSE_VERSION }} | |
| env: | | |
| CORPORATE_PROXY_IMAGE=${{ env.CORPORATE_PROXY_IMAGE }} | |
| - name: Display container engine version | |
| run: | | |
| echo "*** ${{ matrix.tool }} version ***" | |
| ${{ matrix.tool }} version | |
| echo | |
| echo "*** ${{ matrix.tool }} compose version ***" | |
| ${{ matrix.tool }} compose version | |
| - name: ${{ matrix.tool }} info | |
| run: ${{ matrix.tool }} info | |
| - name: Compose config | |
| run: ${{ matrix.tool }} compose ${{ matrix.composeConfig.cliArgs }} config | |
| - name: Add user-specific configuration | |
| if: ${{ matrix.userConfig == 'true' }} | |
| env: | |
| # https://docs.github.com/en/actions/how-tos/monitor-workflows/enable-debug-logging#enabling-runner-diagnostic-logging | |
| LOG_LEVEL: ${{ vars.ACTIONS_RUNNER_DEBUG == 'true' && 'debug' || 'info' }} | |
| run: | | |
| # Custom .env file | |
| cat <<EOF > .env | |
| LOG_LEVEL=${{ env.LOG_LEVEL }} | |
| ROARR_LOG=true | |
| NODE_DEBUG=fetch | |
| GITHUB_APP_APP_ID=123456 | |
| GITHUB_APP_CLIENT_ID=MY_GITHUB_APP_CLIENT_ID | |
| GITHUB_APP_CLIENT_SECRET=MY_GITHUB_APP_CLIENT_SECRET | |
| GITHUB_APP_WEBHOOK_SECRET=MY_GITHUB_APP_WEBHOOK_SECRET | |
| GITHUB_APP_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nxxx\n-----END RSA PRIVATE KEY-----" # notsecret | |
| EOF | |
| # Custom dynamic-plugins.override.yaml | |
| cat <<EOF > configs/dynamic-plugins/dynamic-plugins.override.yaml | |
| includes: [dynamic-plugins.default.yaml] | |
| plugins: | |
| - package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import-backend-dynamic | |
| disabled: false | |
| - package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import | |
| disabled: false | |
| EOF | |
| # Custom extra files | |
| cp -vr configs/extra-files/github-app-credentials.example.yaml configs/extra-files/github-app-credentials.yaml | |
| # Custom app-config.local.yaml | |
| cp -vr configs/app-config/app-config.local.example.yaml configs/app-config/app-config.local.yaml | |
| # Custom users.override.yaml | |
| cp configs/catalog-entities/users.override.example.yaml configs/catalog-entities/users.override.yaml | |
| # Custom components.override.yaml | |
| cp configs/catalog-entities/components.override.example.yaml configs/catalog-entities/components.override.yaml | |
| - name: Create dynamic plugins directory | |
| if: ${{ matrix.composeConfig.name == 'dynamic-plugins-root' }} | |
| run: | | |
| mkdir -p dynamic-plugins-root | |
| - name: Start app | |
| run: | | |
| ${{ matrix.tool }} compose ${{ matrix.composeConfig.cliArgs }} up --detach --quiet-pull | |
| ${{ matrix.tool }} compose ${{ matrix.composeConfig.cliArgs }} ps | |
| - name: Wait for HTTP 200 response from homepage | |
| run: | | |
| max=50 | |
| i=0 | |
| echo "Waiting for localhost to respond with status code 200..." | |
| until curl -i --head --fail http://localhost:7007; do | |
| i=$((i+1)) | |
| if [ "$i" -ge "$max" ]; then | |
| echo "[$(date)] Max retries reached. Exiting. Take a look at the logs in the step below." | |
| exit 1 | |
| fi | |
| echo "($i/$max) [$(date)] Waiting for http://localhost:7007 to return HTTP 200..." | |
| sleep 10 | |
| done | |
| echo "[$(date)] RHDH is ready" | |
| curl -i --insecure http://localhost:7007 | |
| - name: curl from RHDH Container (for troubleshooting) | |
| if: failure() | |
| run: | | |
| ${{ matrix.tool }} exec rhdh curl -i --head --fail http://localhost:7007 | |
| - name: Compose logs | |
| if: always() | |
| run: | | |
| for svc in $(${{ matrix.tool }} compose ${{ matrix.composeConfig.cliArgs }} config --services | sort); do | |
| echo "*** $svc ***" | |
| ${{ matrix.tool }} compose ${{ matrix.composeConfig.cliArgs }} logs --timestamps "$svc" || true | |
| echo "************" | |
| echo | |
| done | |
| - name: Tear down | |
| if: always() | |
| run: | | |
| ${{ matrix.tool }} compose ${{ matrix.composeConfig.cliArgs }} ps || true | |
| ${{ matrix.tool }} compose ${{ matrix.composeConfig.cliArgs }} down --volumes || true | |
| - name: Cleanup Podman container environment | |
| if: ${{ always() && matrix.tool == 'podman' }} | |
| run: | | |
| docker container stop ${{ steps.setup-podman.outputs.container-name }} || true | |
| docker container rm ${{ steps.setup-podman.outputs.container-name }} || true |