Jenkins Builds - Mac (#1391)

* add jenkins mac builds

* update build agent

* add code signing detection in naming scheme

* remove length checks

* bugfixes, additional Jenkinsfiles
This commit is contained in:
Danny Skubak 2018-03-29 13:34:58 -04:00 committed by Daniel Ternyak
parent d21e4349ef
commit 8ac258eb89
6 changed files with 69 additions and 9 deletions

View File

@ -0,0 +1,24 @@
pipeline {
agent {
node {
label 'master'
}
}
stages {
stage('Build') {
environment {
ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES = 1
}
steps {
sh 'rm -rf node_modules'
sh 'npm install'
sh 'npm run jenkins:build:mac'
}
}
stage('Upload') {
steps {
sh 'npm run jenkins:upload'
}
}
}
}

View File

@ -3,7 +3,7 @@ pipeline {
dockerfile {
filename 'Dockerfile'
dir 'jenkins/Docker'
args '--env ETH_SIGNING_KEY=$ETH_SIGNING_KEY --env S3_BUCKET_NAME=$S3_BUCKET_NAME'
args '--env ETH_SIGNING_KEY=$ETH_SIGNING_KEY --env S3_BUCKET_NAME=$S3_BUCKET_NAME --env AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY'
}
}
stages {

View File

@ -0,0 +1,26 @@
pipeline {
agent {
dockerfile {
filename 'Dockerfile'
dir 'jenkins/Docker'
args '--env ETH_SIGNING_KEY=$ETH_SIGNING_KEY --env S3_BUCKET_NAME=$S3_BUCKET_NAME --env AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY --env CSC_LINK=$CSC_LINK --env CSC_KEY_PASSWORD=$CSC_KEY_PASSWORD'
}
}
stages {
stage('Build') {
environment {
ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES = 1
}
steps {
sh 'rm -rf node_modules'
sh 'npm install'
sh 'npm run jenkins:build:linux'
}
}
stage('Upload') {
steps {
sh 'npm run jenkins:upload'
}
}
}
}

View File

@ -4,7 +4,7 @@ const GIT_COMMIT_SHORT = GIT_COMMIT.substring(0, 7);
const JENKINS_BUILD_ID = process.env.BUILD_ID;
const LINUX_FILES = [`MyCrypto-${VERSION}-i386.AppImage`, `MyCrypto-${VERSION}-x86_64.AppImage`];
const WINDOWS_FILES = [`MyCrypto Setup ${VERSION}.exe`, `MyCrypto Setup ${VERSION}.exe.blockmap`];
const OSX_FILES = [];
const OSX_FILES = [`MyCrypto-${VERSION}-mac.zip`, `MyCrypto-${VERSION}.dmg`, `MyCrypto-${VERSION}.dmg.blockmap`];
const FLAVOR = (() => {
const { platform } = process;
@ -18,6 +18,7 @@ const FLAVOR = (() => {
})();
const S3_BUCKET = process.env.S3_BUCKET_NAME;
const ETH_SIGNING_KEY = process.env.ETH_SIGNING_KEY;
const IS_CODE_SIGNING = process.env.CSC_LINK && process.env.CSC_KEY_PASSWORD;
module.exports = {
VERSION,
@ -29,5 +30,6 @@ module.exports = {
OSX_FILES,
FLAVOR,
S3_BUCKET,
ETH_SIGNING_KEY
ETH_SIGNING_KEY,
IS_CODE_SIGNING
};

View File

@ -5,9 +5,15 @@ const { spawn } = require('child_process');
const { hashPersonalMessage, ecsign, toBuffer, addHexPrefix } = require('ethereumjs-util');
const genCommitFilename = (name, version, commit, buildId) => {
const genCommitFilename = (name, version, commit, buildId, isCodeSigning) => {
const winRegex = /exe$/;
const macRegex = /dmg$/;
const split = name.split(version);
return `${split[0]}${version}-${commit}-${buildId}${split[1]}`;
const signed = winRegex.test(name) || macRegex.test(name)
? isCodeSigning ? '-signed' : '-unsigned'
: '';
return `${split[0]}${version}-${commit}-${buildId}${signed}${split[1]}`;
};
const genFileList = (linux, windows, osx) => {
@ -70,10 +76,10 @@ const genSignatureFile = (manifestHash, pKeyString) => {
const genSignatureFilename = (flavor, version, commit, buildId) =>
`manifest.${flavor}.v${version}.${commit}.${buildId}.signature`;
const genManifest = (fileList, version, jenkinsBuildId, gitCommit, gitCommitShort, s3Bucket) =>
const genManifest = (fileList, version, jenkinsBuildId, gitCommit, gitCommitShort, s3Bucket, isCodeSigning) =>
fileList.map(filename => {
const fullPath = path.resolve('dist/electron-builds/', filename);
const commitFilename = genCommitFilename(filename, version, gitCommitShort, jenkinsBuildId);
const commitFilename = genCommitFilename(filename, version, gitCommitShort, jenkinsBuildId, isCodeSigning);
return {
fullPath,

View File

@ -11,7 +11,8 @@ const {
OSX_FILES,
S3_BUCKET,
JENKINS_BUILD_ID,
ETH_SIGNING_KEY
ETH_SIGNING_KEY,
IS_CODE_SIGNING
} = require('./constants');
const {
@ -35,7 +36,8 @@ const manifest = genManifest(
JENKINS_BUILD_ID,
GIT_COMMIT,
GIT_COMMIT_SHORT,
S3_BUCKET
S3_BUCKET,
IS_CODE_SIGNING
);
const manifestFile = genManifestFile(manifest);