Developer Lightspeed in RHDH local #273
Workflow file for this run
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" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - 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: | |
| 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: "${{ matrix.tool }} compose - ${{ matrix.composeConfig.name }}" | |
| runs-on: ubuntu-latest | |
| env: | |
| # The default corporate proxy image is located on registry.redhat.io, which requires authentication. | |
| CORPORATE_PROXY_IMAGE: docker.io/ubuntu/squid:latest | |
| # To be able to call the "podman compose" wrapper using the "podman-compose" binary | |
| PODMAN_COMPOSE_PROVIDER: "podman-compose" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install tool | |
| if: ${{ matrix.tool == 'podman' }} | |
| env: | |
| PODMAN_COMPOSE_VERSION: "v1.3.0" | |
| run: | | |
| pip3 install podman-compose=="${PODMAN_COMPOSE_VERSION}" | |
| - name: Add user-specific configuration | |
| if: ${{ matrix.userConfig == 'true' }} | |
| run: | | |
| # Custom .env file | |
| cat <<EOF > .env | |
| LOG_LEVEL=debug | |
| 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=30 | |
| i=0 | |
| echo "Waiting for localhost to respond with status code 200..." | |
| until curl --head --fail http://localhost:7007; do | |
| i=$((i+1)) | |
| if [ "$i" -ge "$max" ]; then | |
| echo "Max retries reached. Exiting. Take a look at the logs in the step below." | |
| exit 1 | |
| fi | |
| echo "($i/$max)Waiting for http://localhost:7007 to return HTTP 200..." | |
| sleep 5 | |
| done | |
| echo "RHDH is ready!" | |
| curl -i --insecure http://localhost:7007 | |
| - name: Compose logs | |
| if: always() | |
| run: ${{ matrix.tool }} compose ${{ matrix.composeConfig.cliArgs }} logs | |
| - name: Tear down | |
| if: always() | |
| run: | | |
| ${{ matrix.tool }} compose ${{ matrix.composeConfig.cliArgs }} ps || true | |
| ${{ matrix.tool }} compose ${{ matrix.composeConfig.cliArgs }} down --volumes || true |