Parcourir la source

[ci] remove the s3 indexer commands

We now have https://github.com/HaxeFoundation/build.haxe.org
Andy Li il y a 6 ans
Parent
commit
216e078360
3 fichiers modifiés avec 1 ajouts et 236 suppressions
  1. 1 25
      azure-pipelines.yml
  2. 0 112
      tests/Indexer.hx
  3. 0 99
      tests/runci/Deployment.hx

+ 1 - 25
azure-pipelines.yml

@@ -325,31 +325,7 @@ stages:
               AWS_SECRET_ACCESS_KEY: $(HXBUILDS_AWS_SECRET_ACCESS_KEY)
             condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'development'))
             displayName: Update "latest"
-          - script: |
-              set -ex
-              haxe --run runci.Indexer $(HXBUILDS_S3ADDR)/haxe/linux64
-              aws s3 cp index.html     $(HXBUILDS_S3ADDR)/haxe/linux64/
-              haxe --run runci.Indexer $(HXBUILDS_S3ADDR)/haxe/mac
-              aws s3 cp index.html     $(HXBUILDS_S3ADDR)/haxe/mac/
-              haxe --run runci.Indexer $(HXBUILDS_S3ADDR)/haxe/windows64
-              aws s3 cp index.html     $(HXBUILDS_S3ADDR)/haxe/windows64/
-              haxe --run runci.Indexer $(HXBUILDS_S3ADDR)/haxe/windows64-installer
-              aws s3 cp index.html     $(HXBUILDS_S3ADDR)/haxe/windows64-installer/
-              haxe --run runci.Indexer $(HXBUILDS_S3ADDR)/haxe/windows64-choco
-              aws s3 cp index.html     $(HXBUILDS_S3ADDR)/haxe/windows64-choco/
-              haxe --run runci.Indexer $(HXBUILDS_S3ADDR)/haxe/windows
-              aws s3 cp index.html     $(HXBUILDS_S3ADDR)/haxe/windows/
-              haxe --run runci.Indexer $(HXBUILDS_S3ADDR)/haxe/windows-installer
-              aws s3 cp index.html     $(HXBUILDS_S3ADDR)/haxe/windows-installer/
-              haxe --run runci.Indexer $(HXBUILDS_S3ADDR)/haxe/windows-choco
-              aws s3 cp index.html     $(HXBUILDS_S3ADDR)/haxe/windows-choco/
-              haxe --run runci.Indexer $(HXBUILDS_S3ADDR)/haxe
-              aws s3 cp index.html     $(HXBUILDS_S3ADDR)/haxe/
-            workingDirectory: $(Build.SourcesDirectory)/tests
-            env:
-              AWS_ACCESS_KEY_ID: $(HXBUILDS_AWS_ACCESS_KEY_ID)
-              AWS_SECRET_ACCESS_KEY: $(HXBUILDS_AWS_SECRET_ACCESS_KEY)
-            displayName: Update indices
+
       - job: ApiHaxeOrg
         condition: and(succeeded(), variables['GHP_USERNAME'], variables['GHP_EMAIL'])
         pool:

+ 0 - 112
tests/Indexer.hx

@@ -1,112 +0,0 @@
-import sys.io.*;
-using StringTools;
-
-class Indexer
-{
-	public static function index(s3path:String)
-	{
-		var spaceRegex = ~/[ \t]+/g,
-				s3pathRegex = ~/s3:\/\/([^\/]+)/;
-		if (!s3path.endsWith('/')) {
-			s3path = '$s3path/';
-		}
-
-		if (!s3pathRegex.match(s3path)) {
-			throw 'Invalid s3 path $s3path';
-		}
-
-		var basePath = 'http://' + s3pathRegex.matched(1) + '.s3-website-us-east-1.amazonaws.com' + s3pathRegex.matchedRight();
-		var proc = new Process('aws',['s3','ls',s3path,'--region','us-east-1']);
-		var records = [],
-				dirs = [];
-		try
-		{
-			var i = proc.stdout;
-			while(true)
-			{
-				var ln = spaceRegex.split(i.readLine());
-				// trace(ln);
-
-				inline function getPath(path:String)
-				{
-					return basePath + path;
-				}
-				switch(ln[1])
-				{
-					case 'PRE':
-						dirs.push(getPath(ln[2]));
-					case _:
-						var size = ln[2];
-						var path = ln[3];
-						path = getPath(path);
-						records.push({ date: ln[0] + ' ' + ln[1], size: ln[2], path: path, fname:haxe.io.Path.withoutDirectory(path) });
-				}
-			}
-		}
-		catch(e:haxe.io.Eof) {}
-
-		var maxSizes = { date:25, size:15, fname:0 };
-		for (r in records)
-		{
-			if (r.date.length > maxSizes.date)
-				maxSizes.date = r.date.length;
-			if (r.size.length > maxSizes.size)
-				maxSizes.size = r.size.length;
-			if (r.fname.length > maxSizes.fname)
-				maxSizes.fname = r.fname.length;
-		}
-		records.sort(function(v1,v2) return Reflect.compare(v2.date,v1.date));
-		var index = sys.io.File.write('index.html');
-
-		index.writeString(
-'
-<html>
-<head>
-<title>Haxe git builds</title>
-</head>
-<body>
-<!-- Google Tag Manager -->
-<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-M4JZKD"
-height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
-<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({"gtm.start":
-	new Date().getTime(),event:"gtm.js"});var f=d.getElementsByTagName(s)[0],
-	j=d.createElement(s),dl=l!="dataLayer"?"&l="+l:"";j.async=true;j.src=
-	"//www.googletagmanager.com/gtm.js?id="+i+dl;f.parentNode.insertBefore(j,f);
-})(window,document,"script","dataLayer","GTM-M4JZKD");</script>
-<!-- End Google Tag Manager -->
-	<div id="listing">
-	<pre>
-');
-
-		inline function data(date:String,size:String,key:String,path:String)
-		{
-			index.writeString(date.rpad(' ',maxSizes.date));
-			index.writeString(size.rpad(' ',maxSizes.size));
-			if (path != null && path != '')
-				index.writeString('<a href="$path">$key</a>\n');
-			else
-				index.writeString('$key\n');
-		}
-
-		data('Last Modified', 'Size', 'Path','');
-		for (i in 0...(maxSizes.date + maxSizes.size + maxSizes.fname + 5))
-			index.writeString('-');
-		index.writeString('\n\n');
-
-		for (dir in dirs)
-			data('','DIR',haxe.io.Path.withoutDirectory(dir.substr(0,dir.length-1)),dir);
-		for (r in records)
-			if (r.fname != 'index.html')
-				data(r.date,r.size,r.fname,r.path);
-
-		index.writeString(
-'
-</pre>
-</div>
-</body>
-</html>
-');
-
-		index.close();
-	}
-}

+ 0 - 99
tests/runci/Deployment.hx

@@ -197,72 +197,6 @@ class Deployment {
 		}
 	}
 
-	/**
-		Deploy source package to hxbuilds s3
-	*/
-	static function deployNightlies():Void {
-		changeDirectory(repoDir);
-
-		switch (systemName) {
-			case "Linux":
-				runCommand("make", ["-s", "package_unix"]);// source
-				for (file in sys.FileSystem.readDirectory('out')) {
-					if (file.startsWith('haxe') && file.endsWith('_src.tar.gz')) {
-						submitToS3("source", 'out/$file');
-						break;
-					}
-				}
-				for (file in sys.FileSystem.readDirectory('out')) {
-					if (file.startsWith('haxe')) {
-						if (file.endsWith('_bin.tar.gz')) {
-							submitToS3('linux64', 'out/$file');
-						}
-					}
-				}
-			case "Mac":
-				runCommand("make", ["-s", 'package_unix', 'package_installer_mac']);
-				for (file in sys.FileSystem.readDirectory('out')) {
-					if (file.startsWith('haxe')) {
-						if (file.endsWith('_bin.tar.gz')) {
-							submitToS3('mac', 'out/$file');
-						} else if (file.endsWith('_installer.tar.gz')) {
-							submitToS3('mac-installer', 'out/$file');
-						}
-					}
-				}
-			case "Windows":
-				var kind = switch (Sys.getEnv("ARCH")) {
-					case null:
-						throw "ARCH is not set";
-					case "32":
-						"windows";
-					case "64":
-						cleanup32BitDlls();
-						"windows64";
-					case _:
-						throw "unknown ARCH";
-				}
-
-				var cygRoot = Sys.getEnv("CYG_ROOT");
-				if (cygRoot != null) {
-					runCommand('$cygRoot/bin/bash', ['-lc', "cd \"$OLDPWD\" && make -s -f Makefile.win package_installer_win"]);
-				} else {
-					runCommand("make", ['-f', 'Makefile.win', "-s", 'package_installer_win']);
-				}
-				for (file in sys.FileSystem.readDirectory('out')) {
-					if (file.startsWith('haxe')) {
-						if (file.endsWith('_bin.zip')) {
-							submitToS3(kind, 'out/$file');
-						} else if (file.endsWith('_installer.zip')) {
-							submitToS3('${kind}-installer', 'out/$file');
-						}
-					}
-				}
-			case _:
-				throw "unknown system";
-		}
-	}
-
 	static function fileExtension(file:String) {
 		file = haxe.io.Path.withoutDirectory(file);
 		var idx = file.indexOf('.');
@@ -273,33 +207,6 @@ class Deployment {
 		}
 	}
 
-	static function submitToS3(kind:String, sourceFile:String) {
-		switch ([
-			Sys.getEnv("HXBUILDS_AWS_ACCESS_KEY_ID"),
-			Sys.getEnv("HXBUILDS_AWS_SECRET_ACCESS_KEY")
-		]) {
-			case [null, _] | [_, null]:
-				infoMsg("Missing HXBUILDS_AWS_*, skip submit to S3");
-			case [accessKeyId, secretAccessKey]:
-				var date = DateTools.format(Date.now(), '%Y-%m-%d');
-				var ext = fileExtension(sourceFile);
-				var fileName = 'haxe_${date}_${gitInfo.branch}_${gitInfo.commit.substr(0,7)}${ext}';
-
-				var changeLatest = gitInfo.branch == "development";
-				Sys.putEnv('AWS_ACCESS_KEY_ID', accessKeyId);
-				Sys.putEnv('AWS_SECRET_ACCESS_KEY', secretAccessKey);
-				runCommand('aws s3 cp --region us-east-1 "$sourceFile" "$S3_HXBUILDS_ADDR/$kind/$fileName"');
-				if (changeLatest) {
-					runCommand('aws s3 cp --region us-east-1 "$sourceFile" "$S3_HXBUILDS_ADDR/$kind/haxe_latest$ext"');
-				}
-				Indexer.index('$S3_HXBUILDS_ADDR/$kind/');
-				runCommand('aws s3 cp --region us-east-1 index.html "$S3_HXBUILDS_ADDR/$kind/index.html"');
-
-				Indexer.index('$S3_HXBUILDS_ADDR/');
-				runCommand('aws s3 cp --region us-east-1 index.html "$S3_HXBUILDS_ADDR/index.html"');
-		}
-	}
-
 	/**
 		Deploy source package to ppa:haxe/snapshots.
 	*/
@@ -394,11 +301,5 @@ class Deployment {
 		} else {
 			infoMsg("Not deploying API doc");
 		}
-
-		if (isDeployNightlies()) {
-			deployNightlies();
-		} else {
-			infoMsg("Not deploying nightlies");
-		}
 	}
 }