diff --git a/build.sbt b/build.sbt index e91f3db4e55..3c701a739d3 100644 --- a/build.sbt +++ b/build.sbt @@ -1,4 +1,3 @@ -import com.gu.riffraff.artifact.RiffRaffArtifact.autoImport._ import play.sbt.routes.RoutesKeys import com.typesafe.sbt.web.SbtWeb.autoImport._ import com.gu.Dependencies._ @@ -238,32 +237,6 @@ val main = root() preview, rss, ) - .settings( - riffRaffUploadArtifactBucket := Some( - System.getenv().getOrDefault("RIFF_RAFF_ARTIFACT_BUCKET", "aws-frontend-teamcity"), - ), - riffRaffUploadManifestBucket := Some( - System.getenv().getOrDefault("RIFF_RAFF_BUILD_BUCKET", "aws-frontend-teamcity"), - ), - riffRaffManifestProjectName := "dotcom:all", - riffRaffArtifactResources := Seq( - (admin / Universal / packageBin).value -> s"${(admin / name).value}/${(admin / Universal / packageBin).value.getName}", - (applications / Universal / packageBin).value -> s"${(applications / name).value}/${(applications / Universal / packageBin).value.getName}", - (archive / Universal / packageBin).value -> s"${(archive / name).value}/${(archive / Universal / packageBin).value.getName}", - (article / Universal / packageBin).value -> s"${(article / name).value}/${(article / Universal / packageBin).value.getName}", - (commercial / Universal / packageBin).value -> s"${(commercial / name).value}/${(commercial / Universal / packageBin).value.getName}", - (diagnostics / Universal / packageBin).value -> s"${(diagnostics / name).value}/${(diagnostics / Universal / packageBin).value.getName}", - (discussion / Universal / packageBin).value -> s"${(discussion / name).value}/${(discussion / Universal / packageBin).value.getName}", - (identity / Universal / packageBin).value -> s"${(identity / name).value}/${(identity / Universal / packageBin).value.getName}", - (facia / Universal / packageBin).value -> s"${(facia / name).value}/${(facia / Universal / packageBin).value.getName}", - (faciaPress / Universal / packageBin).value -> s"${(faciaPress / name).value}/${(faciaPress / Universal / packageBin).value.getName}", - (onward / Universal / packageBin).value -> s"${(onward / name).value}/${(onward / Universal / packageBin).value.getName}", - (preview / Universal / packageBin).value -> s"${(preview / name).value}/${(preview / Universal / packageBin).value.getName}", - (rss / Universal / packageBin).value -> s"${(rss / name).value}/${(rss / Universal / packageBin).value.getName}", - (sport / Universal / packageBin).value -> s"${(sport / name).value}/${(sport / Universal / packageBin).value.getName}", - baseDirectory.value / "riff-raff.yaml" -> "riff-raff.yaml", - ), - ) val badgeHash = inputKey[Unit]("Generate special badge salts and hashes") badgeHash := { import java.math.BigInteger diff --git a/common/app/common/configuration.scala b/common/app/common/configuration.scala index 36894e7883b..bdb27ffa5d5 100644 --- a/common/app/common/configuration.scala +++ b/common/app/common/configuration.scala @@ -339,11 +339,6 @@ class GuardianConfiguration extends GuLogging { lazy val token = configuration.getStringProperty("github.token") } - object teamcity { - lazy val host = configuration.getMandatoryStringProperty("teamcity.host") - lazy val internalHost = configuration.getMandatoryStringProperty("teamcity.internalhost") - } - object ajax { lazy val url = configuration.getStringProperty("ajax.url").getOrElse("") lazy val nonSecureUrl = diff --git a/common/conf/env/DEVINFRA.properties b/common/conf/env/DEVINFRA.properties index ad00849acd4..def8a454103 100644 --- a/common/conf/env/DEVINFRA.properties +++ b/common/conf/env/DEVINFRA.properties @@ -17,7 +17,6 @@ weather.api.key=none images.signature-salt=none -teamcity.host= riffraff.url= #general @@ -106,8 +105,6 @@ weather.api.key=none # Radiator riffraff.url=https://localhost riffraff.apikey=none -teamcity.host=http://localhost -teamcity.internalhost=http://localhost facebook.graphApi.accessToken=fake-access-token diff --git a/dev/post-integration-test-hook.sh b/dev/post-integration-test-hook.sh deleted file mode 100755 index 9c79ebcd338..00000000000 --- a/dev/post-integration-test-hook.sh +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash - -set -o xtrace -set -o nounset -set -o errexit - - -################################################################################ -# -# Continuous Integration post integration-test hook. -# -# Available environment variables: -# ${TRIGGERING_BUILD_NUMBER}: Currently staged build number -# ${TEAMCITY_BUILDCONF_NAME}: e.g. admin-integration-tests -# $(TEAMCITY_API_URL): Includes HTTP Authentication -# $(DEPLOY_API_URL) -# ${DEPLOY_API_KEY} -# -################################################################################ - -function currentStaged { - local URL="${DEPLOY_API_URL}/history?key=${DEPLOY_API_KEY}&pageSize=1&status=Completed&stage=CODE&projectName=frontend::$1&task=Deploy" - curl "$URL" | sed 's/.*build":"//g' | sed 's/".*//g' -} - -function tag { - echo "Tagging $1 build $2 for PROD." - - ############################################################################## - # - # On update to TeamCity 8 replace the following with: - # local URL="${TEAMCITY_API_URL}/app/rest/builds/project:frontend,buildType:(name:$1),number:$2/tags" - # - ##START####################################################################### - case "$1" in - admin) - local BUILD_TYPE="bt1127" - ;; - applications) - local BUILD_TYPE="bt1125" - ;; - article) - local BUILD_TYPE="bt1128" - ;; - core-navigation) - local BUILD_TYPE="bt1130" - ;; - diagnostics) - local BUILD_TYPE="bt1131" - ;; - discussion) - local BUILD_TYPE="bt1132" - ;; - facia) - local BUILD_TYPE="bt1140" - ;; - football) - local BUILD_TYPE="bt1134" - ;; - front) - local BUILD_TYPE="bt1135" - ;; - identity) - local BUILD_TYPE="bt1158" - ;; - image) - local BUILD_TYPE="bt1136" - ;; - interactive) - local BUILD_TYPE="bt1144" - ;; - porter) - local BUILD_TYPE="bt1151" - ;; - router) - local BUILD_TYPE="bt1137" - ;; - sport) - local BUILD_TYPE="bt1147" - ;; - *) - local URL="(project:frontend,name:$1)" - ;; - esac - - local URL="${TEAMCITY_API_URL}/app/rest/builds/buildType:${BUILD_TYPE},number:$2/tags" - ##END######################################################################### - - curl --header "Content-Type: text/plain" -XPOST -d "PROD" "$URL" -} - - -################################################################################ -# -# Mark for production deployment following integration testing if not preempted. -# -################################################################################ - -if [ "${TRIGGERING_BUILD_NUMBER-unset}" == "unset" ] -then - echo "Tests not triggered by continuous deployment." - exit 0 -fi - -PROJECT=${TEAMCITY_BUILDCONF_NAME%-integration-tests} -CURRENT=$(currentStaged "${PROJECT}") - -if [ "${CURRENT}" != "${TRIGGERING_BUILD_NUMBER}" ] -then - # The tests passed, just not on a stable build. Another attempt will follow. - echo "Tests preempted by staging deployment for ${PROJECT} build ${CURRENT}." - exit 0 -fi - -tag "${PROJECT}" "${CURRENT}" - diff --git a/dev/teamcity/dist-assetmonitor-tc b/dev/teamcity/dist-assetmonitor-tc deleted file mode 100755 index c6bf41b4f5f..00000000000 --- a/dev/teamcity/dist-assetmonitor-tc +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -set -o xtrace -set -o nounset -set -o errexit - -node ./tools/asset-monitor - -exit 0 #always ignore a failure diff --git a/dev/teamcity/dist-assets-tc b/dev/teamcity/dist-assets-tc deleted file mode 100755 index 52b772eac59..00000000000 --- a/dev/teamcity/dist-assets-tc +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -set -o xtrace -set -o nounset -set -o errexit - -set +x -. ~/.nvm/nvm.sh -nvm install -set -x - -echo "Asset compilation" - -cd static/src/javascripts - -set +x -echo "Moved to flow root directory $PWD" -set -x - -$(npm bin)/flow stop - -set +x -echo "Stopped flow server" -set -x - -cd - - -set +x -echo "Returned to directory $PWD" -set -x - -set +x -echo "##teamcity[progressStart 'asset validation and tests']" -set -x - -./tools/task-runner/runner validate test --teamcity - -set +x -echo "##teamcity[progressFinish 'asset validation and tests']" - -echo "##teamcity[progressStart 'asset dist']" -set -x -./tools/task-runner/runner compile --teamcity - -set +x -echo "##teamcity[progressFinish 'asset dist']" -set -x - -set +x -echo "Exit " -set -x \ No newline at end of file diff --git a/dev/teamcity/dist-npm-tc b/dev/teamcity/dist-npm-tc deleted file mode 100755 index c1295f26fcf..00000000000 --- a/dev/teamcity/dist-npm-tc +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -set -o xtrace -set -o nounset -set -o errexit - -set +x -. ~/.nvm/nvm.sh -nvm install -set -x - -echo "Install dependencies" - -make reinstall diff --git a/dev/teamcity/dist-publish-assets-tc b/dev/teamcity/dist-publish-assets-tc deleted file mode 100755 index 32be3dd6d2c..00000000000 --- a/dev/teamcity/dist-publish-assets-tc +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -set -o xtrace -set -o nounset -set -o errexit - -echo "Asset publish" - -set +x -echo "##teamcity[progressStart 'asset publish']" -set -x - -static_folder="static/riffraff" -rm -rf $static_folder - -mkdir -p "$static_folder/packages/frontend-static" - -cp -r static/hash/* "$static_folder/packages/frontend-static" - -echo "Uploading artifact and build manifest to S3" - -set +u -if [[ -z $BUILD_NUMBER ]]; then - BUILD_NUMBER=0 -fi -if [[ -z $RIFF_RAFF_ARTIFACT_BUCKET ]]; then - RIFF_RAFF_ARTIFACT_BUCKET=aws-frontend-teamcity -fi -if [[ -z $RIFF_RAFF_BUILD_BUCKET ]]; then - RIFF_RAFF_BUILD_BUCKET=aws-frontend-teamcity -fi -set -u - -# upload static files for the build - it is critical that this is done before the main sbt-riffraff-artifact plugin runs -aws s3 cp --acl bucket-owner-full-control --region=eu-west-1 --recursive $static_folder/packages/frontend-static s3://$RIFF_RAFF_ARTIFACT_BUCKET/dotcom:all/$BUILD_NUMBER/frontend-static - -set +x -echo "##teamcity[progressFinish 'asset publish']" -set -x diff --git a/dev/teamcity/test-root-tc b/dev/teamcity/test-root-tc deleted file mode 100755 index 85ed3eb2c56..00000000000 --- a/dev/teamcity/test-root-tc +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -o xtrace -set -o nounset -set -o errexit - -./dev/teamcity/sbt-tc "project root" compile assets test -exitcode=$? - -echo "Tested everything." -exit $exitcode \ No newline at end of file diff --git a/docs/03-dev-howtos/10-testing-platform.md b/docs/03-dev-howtos/10-testing-platform.md index 42897d8c5f5..073d099420e 100644 --- a/docs/03-dev-howtos/10-testing-platform.md +++ b/docs/03-dev-howtos/10-testing-platform.md @@ -28,8 +28,4 @@ The simplest way to do that is to spin up a new Auto scaling Group in environmen 1. delete the ASG and Launch config ## Building a branch with frontend -1. click the ... icon next to Run in [dotcom frontend](https://teamcity.gutools.co.uk/viewType.html?buildTypeId=dotcom_master) build -1. change the BranchName in the parameters screen to your branch -1. run the build - it will create the build and upload to riffraff -1. deploy the build with riffraff to TEST - +1. deploy the build of your branch with riffraff to TEST diff --git a/package.json b/package.json index 14d74062310..0b26936b3b5 100644 --- a/package.json +++ b/package.json @@ -123,7 +123,6 @@ "jest": "^26.6.3", "jest-environment-jsdom": "^26.6.2", "jest-environment-jsdom-global": "^2.0.4", - "jest-teamcity-reporter": "^0.6.2", "listr": "^0.14.3", "lodash.merge": "^4.6.2", "lodash.takewhile": "^4.6.0", @@ -207,7 +206,6 @@ "ophan/ng": "ophan-tracker-js", "ophan/embed": "ophan-tracker-js/build/ophan.embed" }, - "testResultsProcessor": "jest-teamcity-reporter", "setupFilesAfterEnv": [ "/dev/jest.setupTestFrameworkScriptFile.js" ], diff --git a/project/ProjectSettings.scala b/project/ProjectSettings.scala index 033b8a5b8bf..13b219cdb44 100644 --- a/project/ProjectSettings.scala +++ b/project/ProjectSettings.scala @@ -4,8 +4,6 @@ import com.gu.versioninfo.VersionInfo import com.typesafe.sbt.packager.universal.UniversalPlugin import sbt._ import sbt.Keys._ -import com.gu.riffraff.artifact.{BuildInfo, RiffRaffArtifact} -import com.gu.riffraff.artifact.RiffRaffArtifact.autoImport._ import com.gu.Dependencies._ import play.sbt.{PlayAkkaHttpServer, PlayNettyServer, PlayScala} import com.typesafe.sbt.SbtNativePackager.Universal @@ -89,35 +87,17 @@ object ProjectSettings { ) val testAll = taskKey[Unit]("test all aggregate projects") - val upload = taskKey[Unit]("upload riff-raff artifact from root project") - val testThenUpload = - taskKey[Unit]("Conditional task that uploads to riff raff only if tests pass") def frontendRootSettings: Seq[Def.Setting[Task[Unit]]] = List( testAll := (Test / test) .all(ScopeFilter(inAggregates(ThisProject, includeRoot = false))) .value, - upload := (LocalRootProject / riffRaffUpload).value, - testThenUpload := Def - .taskDyn({ - testAll.result.value match { - case Inc(inc) => - Def.task[Unit] { - println("Tests failed, no riff raff upload will be performed.") - throw inc - } - case Value(_) => - println("Tests passed, uploading artifact to riff raff.") - upload.toTask - } - }) - .value, ) def root(): Project = Project("root", base = file(".")) - .enablePlugins(PlayScala, RiffRaffArtifact, PlayNettyServer) + .enablePlugins(PlayScala, PlayNettyServer) .disablePlugins(PlayAkkaHttpServer) .settings(frontendCompilationSettings) .settings(frontendRootSettings) @@ -139,10 +119,9 @@ object ProjectSettings { buildInfoPackage := buildInfoPackageName, buildInfoOptions += BuildInfoOption.Traits("app.FrontendBuildInfo"), buildInfoKeys := { - lazy val buildInfo = BuildInfo(baseDirectory.value) Seq[BuildInfoKey]( - "buildNumber" -> buildInfo.buildIdentifier, - "gitCommitId" -> buildInfo.revision, + "buildNumber" -> sys.env.get("GITHUB_RUN_NUMBER").getOrElse("unknown"), + "gitCommitId" -> sys.env.get("GITHUB_SHA").getOrElse("unknown"), "buildTime" -> System.currentTimeMillis, ) }, diff --git a/project/plugins.sbt b/project/plugins.sbt index a54b30080b7..b7623366013 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -18,8 +18,6 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.1") addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.3.3") -addSbtPlugin("com.gu" % "sbt-riffraff-artifact" % "1.1.18") - addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.3") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0") diff --git a/scripts/ci b/scripts/ci deleted file mode 100755 index a5a73c80458..00000000000 --- a/scripts/ci +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# Main Continuous Integration Script - -export JDK_HOME=${JDK_11} -export JAVA_HOME=${JDK_HOME} - -echo "##teamcity[progressMessage 'sbt clean compile assets scalafmtCheckAll test riffRaffUpload']" - -echo "********** Java version **********" -${JAVA_HOME}/bin/java -version -echo "**********************************" - -cat /dev/null | ${JDK_HOME}/bin/java \ - -Xmx6144M \ - -XX:ReservedCodeCacheSize=128m \ - -Dsbt.log.noformat=true \ - -XX:+UseParallelGC \ - -DAPP_SECRET="fake_secret" \ - -Duser.timezone=Australia/Sydney \ - -jar ./bin/sbt-launch.jar clean compile assets scalafmtCheckAll test riffRaffUpload - -SBT_EXIT=$? - -if [ $SBT_EXIT == "0" ]; then - exit 0 -else - exit 1 -fi diff --git a/tools/task-runner/README.md b/tools/task-runner/README.md index 7ba752434b7..28a5eea4479 100644 --- a/tools/task-runner/README.md +++ b/tools/task-runner/README.md @@ -26,7 +26,7 @@ You can pass a `--dev` flag to prefer a dev version, if it exists (suffix the ta ### Modes -Tasks can be run with `--verbose` and `--teamcity` flags for fuller output, but this shouldn't usually be needed (hopefully). +Tasks can be run with `--verbose` flag for fuller output, but this shouldn't usually be needed (hopefully). ### Options diff --git a/tools/task-runner/run-task-tc-formater.js b/tools/task-runner/run-task-tc-formater.js deleted file mode 100644 index 2b17ecfd9d1..00000000000 --- a/tools/task-runner/run-task-tc-formater.js +++ /dev/null @@ -1,71 +0,0 @@ -const figures = require('figures'); -const chalk = require('chalk'); - -const render = tasks => { - // eslint-disable-next-line no-restricted-syntax - for (const task of tasks) { - task.subscribe(event => { - if (event.type === 'SUBTASKS') { - render(task.subtasks); - return; - } - if (event.type === 'STATE') { - if (task.isPending()) { - console.log(`##teamcity[blockOpened name='${task.title}']`); - } - if (task.hasFailed()) { - console.log( - `##teamcity[message text='|'${ - task.title - }|' failed' status='ERROR']` - ); - console.log( - `##teamcity[buildProblem description='|'${ - task.title - }|' failed']` - ); - } - if (task.isSkipped()) { - console.log(task.output); - } - if ( - task.isCompleted() && - !task.hasFailed() && - !task.isSkipped() - ) { - console.log( - `##teamcity[message text='${chalk.green( - figures.tick - )} ${task.title}']` - ); - console.log(`##teamcity[blockClosed name='${task.title}']`); - } - } - if (event.type === 'DATA') { - console.log(event.data); - } - }); - } -}; - -class TeamCityRenderer { - constructor(tasks) { - // eslint-disable-next-line no-underscore-dangle - this._tasks = tasks; - } - - // eslint-disable-next-line class-methods-use-this - get nonTTY() { - return true; - } - - render() { - // eslint-disable-next-line no-underscore-dangle - render(this._tasks); - } - - // eslint-disable-next-line class-methods-use-this - end() {} -} - -module.exports = TeamCityRenderer; diff --git a/tools/task-runner/runner b/tools/task-runner/runner index bb808e74f4b..fa0d25d8e43 100755 --- a/tools/task-runner/runner +++ b/tools/task-runner/runner @@ -18,19 +18,13 @@ const uniq = require('lodash.uniq'); const tasksDirectory = '__tasks__'; // use yargs to get a useful CLI -const { dev: IS_DEV, teamcity: IS_TEAMCITY, debug: IS_DEBUG, verbose: IS_VERBOSE, stdout: IS_STDOUT, _: TASKS } = yargs +const { dev: IS_DEV, debug: IS_DEBUG, verbose: IS_VERBOSE, stdout: IS_STDOUT, _: TASKS } = yargs .option('dev', { demand: false, describe: 'Prefer the dev version of the task, if it exits.', type: 'boolean', nargs: 0, }) - .option('teamcity', { - demand: false, - describe: 'Output the tasks formatted for teamcity.', - type: 'boolean', - nargs: 0, - }) .option('debug', { demand: false, describe: 'Log everything there is to log.', @@ -61,7 +55,7 @@ const { dev: IS_DEV, teamcity: IS_TEAMCITY, debug: IS_DEBUG, verbose: IS_VERBOSE .argv; // if this is true, we log as much as we can -const VERBOSE = IS_VERBOSE || IS_TEAMCITY || IS_DEBUG; +const VERBOSE = IS_VERBOSE || IS_DEBUG; // look here for tasks that come in from yargs const taskSrc = path.resolve(__dirname, '..', tasksDirectory); @@ -133,7 +127,6 @@ function listrify(steps, { concurrent = false } = {}) { }); let renderer = 'default'; - if (IS_TEAMCITY) renderer = require('./run-task-tc-formater'); if (IS_VERBOSE) renderer = require('./run-task-verbose-formater'); return new Listr(listrTasks, { diff --git a/yarn.lock b/yarn.lock index 5ea7a034431..b24ddecf6b7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8362,11 +8362,6 @@ jest-snapshot@^26.6.2: pretty-format "^26.6.2" semver "^7.3.2" -jest-teamcity-reporter@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/jest-teamcity-reporter/-/jest-teamcity-reporter-0.6.2.tgz#a71e350cc994186d3c6fbb6c3d7895e547026365" - integrity sha512-og4J9jhkMOcBTtZFZywTs5yXled2ziM46G+No6lTlZThwlx6FQ0lzCMDdKR6zZeRFBgJOU2EzdCDb21n/JaP3A== - jest-util@^26.1.0, jest-util@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz#907535dbe4d5a6cb4c47ac9b926f6af29576cbc1"