Skip to content
Snippets Groups Projects
Unverified Commit 8456a5cb authored by Cam Saul's avatar Cam Saul Committed by GitHub
Browse files

Mega release script improvements :exploding_head: (#13795)

* Mega build script improvements 2

* Fix Circle
parent 5e8c0e69
No related branches found
No related tags found
No related merge requests found
Showing
with 66 additions and 13 deletions
......@@ -13,11 +13,14 @@
;; Disable caching of our template files for easier REPL debugging, we're only rendering them once anyways
(stencil.loader/set-cache (cache/ttl-cache-factory {} :ttl 0))
(def ^:private release-template-filename
(u/assert-file-exists (u/filename c/root-directory "bin" "release" "src" "release" "draft_release" "release-template.md")))
(defn- generate-draft-changelog []
(u/step "Generate draft changelog"
(let [pre-release? (c/pre-release-version?)
{bugs :bug, enhancements :enhancement} (group-by github/issue-type (github/milestone-issues))]
(stencil/render-file (u/assert-file-exists "release/draft_release/release-template.md")
(stencil/render-file release-template-filename
{:enhancements enhancements
:bug-fixes bugs
:docker-tag (c/docker-tag)
......
......@@ -23,7 +23,7 @@
(def ^:private eb-extensions-source
"Source location of the .ebextensions directory"
(u/assert-file-exists (u/filename c/root-directory "bin" "release" "release" "elastic_beanstalk" ".ebextensions")))
(u/assert-file-exists (u/filename c/root-directory "bin" "release" "src" "release" "elastic_beanstalk" ".ebextensions")))
(def ^:private archive-temp-dir
"Path where we'll put the contents of the ZIP file before we create it."
......@@ -81,14 +81,17 @@
(u/sh {:dir archive-temp-dir} "zip" "--recurse-paths" archive-path ".")
(u/assert-file-exists archive-path))))
(def ^:private launch-template-filename
(u/assert-file-exists (u/filename c/root-directory "bin" "release" "src" "release" "elastic_beanstalk" "launch-aws-eb.html.template")))
(defn- create-html-file! []
(u/step (format "Create launch-aws-eb.html for Docker image %s" (c/docker-tag))
(u/delete-file-if-exists! html-file-path)
(spit html-file-path
(stencil/render-file (u/assert-file-exists "release/elastic_beanstalk/launch-aws-eb.html.template")
{:url (java.net.URLEncoder/encode (c/artifact-download-url "metabase-aws-eb.zip")
"UTF-8")}))
(u/assert-file-exists html-file-path)))
(u/delete-file-if-exists! html-file-path)
(spit html-file-path
(stencil/render-file launch-template-filename
{:url (java.net.URLEncoder/encode (c/artifact-download-url "metabase-aws-eb.zip")
"UTF-8")}))
(u/assert-file-exists html-file-path)))
(defn- upload-artifacts! []
(u/step "Upload Elastic Beanstalk artifacts"
......
......@@ -26,6 +26,9 @@
(= (c/edition) :ee)
(u/announce "EE build -- not updating Herkou buildpack")
(not (c/latest-version?))
(u/announce "Not the latest version -- not updating Heroku buildpack")
:else
(do
(u/step (format "Clone Herkou Buildpack repo %s to %s" heroku-repo dir)
......
......@@ -19,7 +19,8 @@
(defn- validate-uberjar []
(u/step "Validate uberjar(s) on downloads.metabase.com"
(doseq [url [(c/artifact-download-url "metabase.jar")
(when (= (c/edition) :ee)
(when (and (= (c/edition) :ee)
(c/latest-version?))
(c/artifact-download-url "latest" "metabase.jar"))]
:when url]
(u/step (format "Validate %s" url)
......@@ -38,7 +39,18 @@
(u/step "Upload uberjar and validate"
(u/step (format "Upload uberjar to %s" (c/artifact-download-url "metabase.jar"))
(upload/upload-artifact! c/uberjar-path "metabase.jar"))
(when (= (c/edition) :ee)
(u/step (format "Upload uberjar to %s" (c/artifact-download-url "latest" "metabase.jar"))
(upload/upload-artifact! c/uberjar-path "latest" "metabase.jar")))
(let [latest-download-url (c/artifact-download-url "latest" "metabase.jar")]
(cond
(not= (c/edition) :ee)
(u/announce "Not EE build -- not uploading %s" latest-download-url)
(c/pre-release-version?)
(u/announce "Pre release version -- not uploading %s" latest-download-url)
(not (c/latest-version?))
(u/announce "Not latest version -- not uploading %s" latest-download-url)
:else
(u/step (format "Upload uberjar to %s" latest-download-url)
(upload/upload-artifact! c/uberjar-path "latest" "metabase.jar"))))
(validate-uberjar)))
......@@ -92,6 +92,9 @@
(= (c/edition) :ee)
(u/announce "EE build -- not updating Metabase docs")
(not (c/latest-version?))
(u/announce "Not the latest version -- not updating Metabase docs")
:else
(do
(update-website!*)
......
......@@ -33,7 +33,7 @@
(defn- generate-version-info! []
(u/step "Generate version-info.json"
(u/step (format "Generate %s" tmp-version-info-filename)
(u/delete-file! tmp-version-info-filename)
(u/delete-file-if-exists! tmp-version-info-filename)
(let [{:keys [latest], :as info} (current-version-info)]
(spit tmp-version-info-filename (-> info
;; move the current `:latest` to the beginning of `:older`
......@@ -80,5 +80,8 @@
(= (c/edition) :ee)
(u/announce "Enterprise Edition release, not updating version-info.json")
(not (c/latest-version?))
(u/announce "Not the latest version, not updating version-info.json")
:else
(update-version-info!*))))
(ns release.common-test
(:require [clojure.test :refer :all]
[release.common :as c]))
(deftest version-greater-than-test
(doseq [[x y expected] [["1.37.0" "1.36.0" true]
["1.36.1" "1.36.0" true]
["1.36.0" "1.36.0" false]
["1.37.0" "1.36.9" true]
["1.37.0" "1.36.9" true]
["1.37.0.1" "1.37.0" true]
["1.37.1.1" "1.37.0.2" true]
["1.37.10" "1.37.2" true]
["1.37.0.0" "1.37.0" false]]]
(testing (str (pr-str (list 'version-greater-than x y)) " => " (pr-str expected))
(doseq [x [x (str "v" x)]
y [y (str "v" y)]]
(is (= expected
(c/version-greater-than x y)))
(when expected
(is (= (not expected)
(c/version-greater-than y x))))))))
(deftest most-recent-tag-test
(is (= "v1.37.0.1"
(#'c/most-recent-tag (shuffle ["v1.37.0.0" "v1.37.0.1" "v1.36.0" "v1.36.8.9"])))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment