workhorse done and nixpkgs-fmt
This commit is contained in:
parent
87be340dfa
commit
fc33e57a54
124 changed files with 3142 additions and 2590 deletions
nixos/library
|
@ -1,7 +1,10 @@
|
|||
{ pkgs, lib, ... }: {
|
||||
desktopFile = bin:
|
||||
{ comment ? "No Comment", longName ? "Script"
|
||||
, command ? "${bin}/bin/${bin.name}", ... }:
|
||||
{ comment ? "No Comment"
|
||||
, longName ? "Script"
|
||||
, command ? "${bin}/bin/${bin.name}"
|
||||
, ...
|
||||
}:
|
||||
pkgs.writeTextFile {
|
||||
name = "${bin.name}.desktop";
|
||||
destination = "/share/applications/${bin.name}.desktop";
|
||||
|
|
|
@ -7,79 +7,90 @@ with builtins;
|
|||
{
|
||||
# source container url and credentialsId
|
||||
job = name:
|
||||
{ url, credentialsId, branch ? "master",
|
||||
# https://docs.openstack.org/infra/jenkins-job-builder/triggers.html
|
||||
triggers ? [{
|
||||
pollscm = {
|
||||
cron = "H/30 * * * *";
|
||||
ignore-post-commit-hooks = true;
|
||||
};
|
||||
}], ... }:
|
||||
{ url
|
||||
, credentialsId
|
||||
, branch ? "master"
|
||||
, # https://docs.openstack.org/infra/jenkins-job-builder/triggers.html
|
||||
triggers ? [{
|
||||
pollscm = {
|
||||
cron = "H/30 * * * *";
|
||||
ignore-post-commit-hooks = true;
|
||||
};
|
||||
}]
|
||||
, ...
|
||||
}:
|
||||
config: {
|
||||
job = {
|
||||
inherit name triggers;
|
||||
sandbox = true;
|
||||
project-type = "pipeline";
|
||||
dsl = let
|
||||
stage = elem:
|
||||
let
|
||||
stageName = head (attrNames elem);
|
||||
stateScripts = map (stage:
|
||||
lib.getAttr (typeOf stage) {
|
||||
string = ''
|
||||
withEnv(['PATH=/run/current-system/sw/bin/','NIX_PATH=/var/src/']) {
|
||||
sh '${toString stage}'
|
||||
}'';
|
||||
set = let
|
||||
script = ''
|
||||
withEnv(['PATH=/run/current-system/sw/bin/','NIX_PATH=/var/src/']) {
|
||||
sh '${toString stage.script}'
|
||||
}
|
||||
'';
|
||||
in if (stage.credentialsId != null) then ''
|
||||
sshagent(['${stage.credentialsId}']) { ${script} }
|
||||
'' else
|
||||
script;
|
||||
}) (getAttr stageName elem);
|
||||
in ''
|
||||
stage('${stageName}') {
|
||||
steps {
|
||||
${concatStringsSep "\n" stateScripts}
|
||||
dsl =
|
||||
let
|
||||
stage = elem:
|
||||
let
|
||||
stageName = head (attrNames elem);
|
||||
stateScripts = map
|
||||
(stage:
|
||||
lib.getAttr (typeOf stage) {
|
||||
string = ''
|
||||
withEnv(['PATH=/run/current-system/sw/bin/','NIX_PATH=/var/src/']) {
|
||||
sh '${toString stage}'
|
||||
}'';
|
||||
set =
|
||||
let
|
||||
script = ''
|
||||
withEnv(['PATH=/run/current-system/sw/bin/','NIX_PATH=/var/src/']) {
|
||||
sh '${toString stage.script}'
|
||||
}
|
||||
'';
|
||||
in
|
||||
if (stage.credentialsId != null) then ''
|
||||
sshagent(['${stage.credentialsId}']) { ${script} }
|
||||
'' else
|
||||
script;
|
||||
})
|
||||
(getAttr stageName elem);
|
||||
in
|
||||
''
|
||||
stage('${stageName}') {
|
||||
steps {
|
||||
${concatStringsSep "\n" stateScripts}
|
||||
}
|
||||
}
|
||||
'';
|
||||
stages = map stage config;
|
||||
in
|
||||
''
|
||||
pipeline {
|
||||
agent any
|
||||
post {
|
||||
failure {
|
||||
mattermostSend channel: 'notification', color: '#FF0000', message: "Failed to build : [''${env.JOB_NAME}-''${env.BUILD_NUMBER}](''${env.BUILD_URL})"
|
||||
}
|
||||
success {
|
||||
mattermostSend channel: 'jenkins', color: '#00FF00', message: "Successfully build : [''${env.JOB_NAME}-''${env.BUILD_NUMBER}](''${env.JOB_URL})"
|
||||
}
|
||||
}
|
||||
'';
|
||||
stages = map stage config;
|
||||
in ''
|
||||
pipeline {
|
||||
agent any
|
||||
post {
|
||||
failure {
|
||||
mattermostSend channel: 'notification', color: '#FF0000', message: "Failed to build : [''${env.JOB_NAME}-''${env.BUILD_NUMBER}](''${env.BUILD_URL})"
|
||||
}
|
||||
success {
|
||||
mattermostSend channel: 'jenkins', color: '#00FF00', message: "Successfully build : [''${env.JOB_NAME}-''${env.BUILD_NUMBER}](''${env.JOB_URL})"
|
||||
}
|
||||
}
|
||||
stages{
|
||||
stage('Pull') {
|
||||
steps {
|
||||
checkout(
|
||||
[$class: 'GitSCM'
|
||||
, branches: [[name: '*/${branch}']]
|
||||
, doGenerateSubmoduleConfigurations: false
|
||||
, extensions: [[$class: 'LocalBranch', localBranch: 'master']]
|
||||
, submoduleCfg: []
|
||||
, userRemoteConfigs:
|
||||
[[ credentialsId: '${credentialsId}'
|
||||
, url: '${url}']]
|
||||
]
|
||||
)
|
||||
stages{
|
||||
stage('Pull') {
|
||||
steps {
|
||||
checkout(
|
||||
[$class: 'GitSCM'
|
||||
, branches: [[name: '*/${branch}']]
|
||||
, doGenerateSubmoduleConfigurations: false
|
||||
, extensions: [[$class: 'LocalBranch', localBranch: 'master']]
|
||||
, submoduleCfg: []
|
||||
, userRemoteConfigs:
|
||||
[[ credentialsId: '${credentialsId}'
|
||||
, url: '${url}']]
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
${concatStringsSep "\n" stages}
|
||||
}
|
||||
${concatStringsSep "\n" stages}
|
||||
}
|
||||
}
|
||||
'';
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue