Merge branch 'master' into ux-initial-redesign
This commit is contained in:
Коммит
367d8017a8
|
@ -0,0 +1,20 @@
|
||||||
|
echo "Installing JQ for JSON parsing ..."
|
||||||
|
|
||||||
|
# mkdir /app/.local/share/jq/bin
|
||||||
|
# cd /app/.local/share/jq/bin
|
||||||
|
wget -O jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
|
||||||
|
chmod +x ./jq
|
||||||
|
|
||||||
|
# echo "Updating PATH to include jq ..."
|
||||||
|
export PATH=$PATH:/app
|
||||||
|
|
||||||
|
echo "Updating PATH to include Salesforce CLI ..."
|
||||||
|
export PATH=$PATH:/app/.local/share/sfdx/cli/bin/
|
||||||
|
|
||||||
|
echo "Updating Salesforce CLI plugin ..."
|
||||||
|
sfdx update
|
||||||
|
|
||||||
|
echo "Creating local resources ..."
|
||||||
|
mkdir /app/tmp
|
||||||
|
|
||||||
|
echo "Completed!"
|
29
app.js
29
app.js
|
@ -160,6 +160,18 @@ app.get('/oauth/callback', (req, res) => {
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
|
router.get('/test', (req, res) => {
|
||||||
|
|
||||||
|
const script = `jq --help`;
|
||||||
|
|
||||||
|
commands.run('test', script, (result) => {
|
||||||
|
res.json({
|
||||||
|
message: result
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
router.post('/deploying', (req, res) => {
|
router.post('/deploying', (req, res) => {
|
||||||
|
|
||||||
const command = req.body.command;
|
const command = req.body.command;
|
||||||
|
@ -173,6 +185,8 @@ router.post('/deploying', (req, res) => {
|
||||||
const startingDirectory = process.env.STARTINGDIRECTORY;
|
const startingDirectory = process.env.STARTINGDIRECTORY;
|
||||||
const directory = `${tokenName}-${timestamp}`;
|
const directory = `${tokenName}-${timestamp}`;
|
||||||
|
|
||||||
|
// const jqDirectory = '/app/.local/share/jq/bin/';
|
||||||
|
|
||||||
let script;
|
let script;
|
||||||
let sfdxurl;
|
let sfdxurl;
|
||||||
|
|
||||||
|
@ -182,7 +196,8 @@ router.post('/deploying', (req, res) => {
|
||||||
|
|
||||||
script = `${startingDirectory}mkdir ${directory};cd ${directory};git clone ${param} .`;
|
script = `${startingDirectory}mkdir ${directory};cd ${directory};git clone ${param} .`;
|
||||||
|
|
||||||
commands.run(command, script, () => {
|
commands.run(command, script, (result) => {
|
||||||
|
console.log('temp result', result);
|
||||||
res.json({
|
res.json({
|
||||||
message: `Successfully cloned ${param}`
|
message: `Successfully cloned ${param}`
|
||||||
});
|
});
|
||||||
|
@ -227,6 +242,18 @@ router.post('/deploying', (req, res) => {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'permset':
|
||||||
|
|
||||||
|
script = `${startingDirectory}cd ${directory};export FORCE_SHOW_SPINNER=;sfdx force:user:permset:assign -n ${param}`;
|
||||||
|
|
||||||
|
commands.run(command, script, (result) => {
|
||||||
|
res.json({
|
||||||
|
message: `Permset assigned:\n\t${result}`
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case 'test':
|
case 'test':
|
||||||
|
|
||||||
script = `${startingDirectory}cd ${directory};export FORCE_SHOW_SPINNER=;sfdx force:apex:test:run -r human --json | jq -r .result | jq -r .summary | jq -r .outcome`;
|
script = `${startingDirectory}cd ${directory};export FORCE_SHOW_SPINNER=;sfdx force:apex:test:run -r human --json | jq -r .result | jq -r .summary | jq -r .outcome`;
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"name": "Deploy to Salesforce DX",
|
||||||
|
"description": "An application that will deploy an SFDX project from a public Github repo",
|
||||||
|
"repository": "https://github.com/wadewegner/deploy-to-sfdx",
|
||||||
|
"logo": "",
|
||||||
|
"keywords": ["deploy", "sfdx", "salesforcedx"],
|
||||||
|
"image": "",
|
||||||
|
"scripts": {
|
||||||
|
"postdeploy": "bin/deploy"
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"CALLBACKURL": {
|
||||||
|
"description": "The callback URL for your Connected App",
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"CONSUMERKEY": {
|
||||||
|
"description": "The consumer key for your Connected App.",
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"CONSUMERSECRET": {
|
||||||
|
"description": "The consumer secret for your Connected App.",
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"STARTINGDIRECTORY": {
|
||||||
|
"description": "The base directory for the CLI",
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"buildpacks": [{
|
||||||
|
"url": "https://github.com/wadewegner/salesforce-cli-buildpack"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "heroku/nodejs"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
|
@ -4,6 +4,7 @@ const {
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
run: (command, commandScript, result) => {
|
run: (command, commandScript, result) => {
|
||||||
|
// console.log(command, commandScript);
|
||||||
exec(commandScript, (err, stdout, stderr) => {
|
exec(commandScript, (err, stdout, stderr) => {
|
||||||
if (stderr || err) {
|
if (stderr || err) {
|
||||||
console.log(`${command}:err`, err);
|
console.log(`${command}:err`, err);
|
||||||
|
|
|
@ -47,6 +47,7 @@ $(document).ready(() => {
|
||||||
const timestamp = new Date().getTime().toString();
|
const timestamp = new Date().getTime().toString();
|
||||||
|
|
||||||
const assignPermset = doc['assign-permset'];
|
const assignPermset = doc['assign-permset'];
|
||||||
|
const permsetName = doc['permset-name'];
|
||||||
const deleteScratchOrg = doc['delete-scratch-org'];
|
const deleteScratchOrg = doc['delete-scratch-org'];
|
||||||
const runApexTests = doc['run-apex-tests'];
|
const runApexTests = doc['run-apex-tests'];
|
||||||
const scratchOrgDef = doc['scratch-org-def'];
|
const scratchOrgDef = doc['scratch-org-def'];
|
||||||
|
@ -54,21 +55,29 @@ $(document).ready(() => {
|
||||||
|
|
||||||
update_status(`Parsed the following values from the yaml file:
|
update_status(`Parsed the following values from the yaml file:
|
||||||
\tassign-permset: ${assignPermset}
|
\tassign-permset: ${assignPermset}
|
||||||
|
\tpermset-name: ${permsetName}
|
||||||
\tdelete-scratch-org: ${deleteScratchOrg}
|
\tdelete-scratch-org: ${deleteScratchOrg}
|
||||||
\trun-apex-tests: ${runApexTests}
|
\trun-apex-tests: ${runApexTests}
|
||||||
\tscratch-org-def: ${scratchOrgDef}
|
\tscratch-org-def: ${scratchOrgDef}
|
||||||
\tshow-scratch-org-url: ${showScratchOrgUrl}`);
|
\tshow-scratch-org-url: ${showScratchOrgUrl}`);
|
||||||
|
|
||||||
return deployingApi('clone', timestamp, githubRepo)
|
return deployingApi('clone', timestamp, githubRepo)
|
||||||
.then(() => {
|
// .then(() => {
|
||||||
return deployingApi('auth', timestamp);
|
// return deployingApi('auth', timestamp);
|
||||||
})
|
// })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return deployingApi('create', timestamp, scratchOrgDef);
|
return deployingApi('create', timestamp, scratchOrgDef);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return deployingApi('push', timestamp);
|
return deployingApi('push', timestamp);
|
||||||
})
|
})
|
||||||
|
.then(() => {
|
||||||
|
if (permsetName) {
|
||||||
|
return deployingApi('permset', timestamp, permsetName);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return deployingApi('test', timestamp);
|
return deployingApi('test', timestamp);
|
||||||
})
|
})
|
||||||
|
@ -98,20 +107,14 @@ $(document).ready(() => {
|
||||||
commandData = {};
|
commandData = {};
|
||||||
commandData.command = 'clean';
|
commandData.command = 'clean';
|
||||||
commandData.timestamp = timestamp;
|
commandData.timestamp = timestamp;
|
||||||
|
|
||||||
// return deployingApi('clean', timestamp).then(() => {
|
|
||||||
|
|
||||||
// };
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
return deployingApi('clean', timestamp)
|
return deployingApi('clean', timestamp)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
||||||
message = `Finished. You have deploy the app to Salesforce DX!\n\n${message}`;
|
message = `Finished. You have deploy the app to Salesforce DX!\n\n${message}`;
|
||||||
$('textarea#status').val(message);
|
$('textarea#status').val(message);
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Загрузка…
Ссылка в новой задаче