diff --git a/.taskcluster.yml b/.taskcluster.yml index efc7161a3..bb53a1d66 100644 --- a/.taskcluster.yml +++ b/.taskcluster.yml @@ -41,6 +41,14 @@ tasks: else: ${event.ref[11:]} else: 'dev' + backend_url: + $if: 'tasks_for == "github-push"' + then: + $if: 'event.ref == "refs/heads/testing"' + then: 'https://api.coverage.testing.moz.tools' + else: 'https://api.coverage.moz.tools' + else: 'https://api.coverage.moz.tools' + taskboot_image: "mozilla/taskboot:0.1.9" in: - taskId: {$eval: as_slugid("check_lint")} @@ -226,6 +234,8 @@ tasks: payload: maxRunTime: 3600 image: node + env: + BACKEND_URL: "${backend_url}" command: - sh - -lxce diff --git a/frontend/src/common.js b/frontend/src/common.js index 3fda84781..f0d0c7e25 100644 --- a/frontend/src/common.js +++ b/frontend/src/common.js @@ -36,7 +36,7 @@ export async function main(load, display, opts) { // Coverage retrieval. -const COVERAGE_BACKEND_HOST = 'https://api.coverage.moz.tools'; +const COVERAGE_BACKEND_HOST = process.env.BACKEND_URL; function cache_get(cache, key) { if (key in cache) { diff --git a/frontend/webpack.common.js b/frontend/webpack.common.js index b0c6db5b1..164e15e69 100644 --- a/frontend/webpack.common.js +++ b/frontend/webpack.common.js @@ -1,4 +1,5 @@ const path = require('path'); +const webpack = require('webpack'); const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin') const MiniCssExtractPlugin = require('mini-css-extract-plugin'); @@ -18,6 +19,9 @@ module.exports = { new MiniCssExtractPlugin({ filename: 'coverage-[hash].css', }), + new webpack.EnvironmentPlugin({ + BACKEND_URL: 'http://localhost:8000', + }), ], module: { rules: [