]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Add recettes website
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Sat, 14 Mar 2020 17:27:26 +0000 (18:27 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Sat, 14 Mar 2020 17:27:26 +0000 (18:27 +0100)
modules/private/buildbot/projects/immaeEu/__init__.py
modules/private/websites/immae/production.nix

index ad295315cbe02ea7c24a5ec5b0bfc1ccb629ad2c..cf64ad91966642ff2bc5324c882ecc2dd9a83ed2 100644 (file)
@@ -16,6 +16,7 @@ class E():
     XMPP_RECIPIENTS = os.environ["BUILDBOT_XMPP_RECIPIENTS"].split(" ")
 
     IMMAE_EU_GIT_URL   = "gitolite@git.immae.eu:perso/Immae/Sites/Blog"
+    RECETTES_GIT_URL   = "gitolite@git.immae.eu:perso/Immae/Sites/Recettes"
     COURS_GIT_URL      = "gitolite@git.immae.eu:perso/Immae/Sites/Cours"
     NORMALESUP_GIT_URL = "gitolite@git.immae.eu:perso/Immae/Projets/Sites/Normalesup"
 
@@ -23,6 +24,7 @@ class E():
     COURS_TARBALL_PATH      = "/var/lib/ftp/release.immae.eu/cours"
     COURS_TARBALL_URL       = "https://release.immae.eu/cours"
     IMMAE_EU_RELEASE_PATH   = "/var/lib/buildbot/outputs/immaeEu"
+    RECETTES_RELEASE_PATH   = "/var/lib/buildbot/outputs/recettes"
     NORMALESUP_RELEASE_PATH = "/var/lib/buildbot/outputs/recherche"
     GSMCELLS_RELEASE_PATH   = "/var/lib/ftp/release.immae.eu/gsm_cells"
     GSMCELLS_RELEASE_URL    = "https://release.immae.eu/gsm_cells"
@@ -63,10 +65,11 @@ def configure(c):
     c['schedulers'].append(hook_scheduler("ImmaeEu", timer=1))
     c['schedulers'].append(hook_scheduler("Normalesup", timer=1))
     c['schedulers'].append(hook_scheduler("Cours", timer=1))
+    c['schedulers'].append(hook_scheduler("Recettes", timer=1))
     c['schedulers'].append(schedulers.Nightly(name="GSMCells-weekly",
         builderNames=["GSMCells_build"], dayOfWeek=6, hour=3))
     c['schedulers'].append(force_scheduler("force_immae_eu", [
-        "ImmaeEu_build", "Normalesup_build", "Cours_build",
+        "ImmaeEu_build", "Normalesup_build", "Cours_build", "Recettes_build"
         ]))
     c['schedulers'].append(schedulers.ForceScheduler(
         name="GSMCells-force", label="Force build",
@@ -88,23 +91,43 @@ def configure(c):
     c['builders'].append(normalesup_factory())
     c['builders'].append(cours_factory())
     c['builders'].append(gsm_cells_factory())
+    c['builders'].append(recettes_factory())
 
     c['services'].append(SlackStatusPush(
         name="slack_status_immae_eu_project",
         builders=[
             "ImmaeEu_build", "Normalesup_build", "Cours_build",
-            "GSMCells_build"
+            "GSMCells_build", "Recettes_build"
             ],
         serverUrl=open(E.SECRETS_FILE + "/slack_webhook", "r").read().rstrip()))
     c['services'].append(XMPPStatusPush(
         name="xmpp_status_immae_eu_project",
         builders=[
             "ImmaeEu_build", "Normalesup_build", "Cours_build",
-            "GSMCells_build"
+            "GSMCells_build", "Recettes_build"
             ],
         recipients=E.XMPP_RECIPIENTS,
         password=open(E.SECRETS_FILE + "/notify_xmpp_password", "r").read().rstrip()))
 
+def recettes_factory():
+    path_env = {
+            "PATH": os.environ["BUILDBOT_PATH_Recettes"] + ":${PATH}"
+            }
+    factory = util.BuildFactory()
+    factory.addStep(steps.Git(logEnviron=False, repourl=E.RECETTES_GIT_URL,
+        submodules=True, sshPrivateKey=open(E.SSH_KEY_PATH).read().rstrip(),
+        sshHostKey=E.SSH_HOST_KEY, mode="full", method="copy"))
+    factory.addStep(steps.ShellCommand(name="build website",
+        logEnviron=False, haltOnFailure=True, workdir="source",
+        env=path_env, command=["jekyll", "build", "--baseurl", "/recettes"]))
+    factory.addStep(steps.MasterShellCommand(command="rm -rf {}".format(E.RECETTES_RELEASE_PATH)))
+    factory.addStep(steps.DirectoryUpload(workersrc="../source/_site",
+        masterdest=E.RECETTES_RELEASE_PATH,
+        url="https://www.immae.eu/recettes"))
+    factory.addStep(steps.MasterShellCommand(command="chmod -R a+rX {}".format(E.RECETTES_RELEASE_PATH)))
+
+    return util.BuilderConfig(name="Recettes_build", workernames=["generic-worker-immae-eu"], factory=factory)
+
 def immae_eu_factory():
     path_env = {
             "PATH": os.environ["BUILDBOT_PATH_ImmaeEu"] + ":${PATH}"
index 3d76b8611c77dd3626bd5aee4fe8c3a2c118b725..dff105363b77923fe215fef58160af7f7793066c 100644 (file)
@@ -4,6 +4,7 @@ let
   varDir = "/var/lib/buildbot/outputs/immaeEu";
   coursDir = "/var/lib/buildbot/outputs/cours";
   rechercheDir = "/var/lib/buildbot/outputs/recherche";
+  recettesDir = "/var/lib/buildbot/outputs/recettes";
   env = config.myEnv.websites.immae;
 in {
   options.myServices.websites.immae.production.enable = lib.mkEnableOption "enable Immae's website";
@@ -55,6 +56,14 @@ in {
           AllowOverride All
           Require all granted
         </Directory>
+
+        Alias /recettes ${recettesDir}
+        <Directory ${recettesDir}>
+          DirectoryIndex index.htm index.html
+          Options Indexes FollowSymLinks MultiViews Includes
+          AllowOverride All
+          Require all granted
+        </Directory>
         ''
       ];
     };