Skip to content

Commit

Permalink
Jenkins now store artifacts
Browse files Browse the repository at this point in the history
old version bumping method removed
code reformat
  • Loading branch information
Vitexus committed Oct 22, 2024
1 parent d77711b commit b3e2ca5
Show file tree
Hide file tree
Showing 23 changed files with 84 additions and 79 deletions.
40 changes: 23 additions & 17 deletions debian/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ String ver = ''
properties([
copyArtifactPermission('*')
])

node() {
ansiColor('xterm') {
stage('SCM Checkout') {
Expand All @@ -20,27 +19,25 @@ node() {
}
}

/**@
* Build all distributions
*/

distributions.each {
distribution = it

println 'Dist:' + distribution
println "Dist:" + distribution

dist = distribution.split(':')
// distroFamily = dist[0]
def dist = distribution.split(':')
distroCodename = dist[1]

buildImage = ''
def buildImage = ''

def artifacts = []

node('amd64') {
node {
ansiColor('xterm') {
stage('Checkout ' + distribution) {
checkout scm
buildImage = docker.image(vendor + '/' + distribution)
sh 'git checkout debian/changelog'
String version = sh(
def version = sh (
script: 'dpkg-parsechangelog --show-field Version',
returnStdout: true
).trim()
Expand All @@ -51,27 +48,36 @@ distributions.each {
sh 'dch -b -v ' + ver + ' "' + env.BUILD_TAG + '"'
sh 'sudo apt-get update --allow-releaseinfo-change'
sh 'sudo chown jenkins:jenkins ..'
sh 'sudo apt -y install composer'
sh 'composer --version'
sh 'sudo apt -y remove php8.1-common || true'
sh 'debuild-pbuilder -i -us -uc -b'
sh 'mkdir -p $WORKSPACE/dist/debian/ ; rm -rf $WORKSPACE/dist/debian/* ; for deb in $(cat debian/files | awk \'{print $1}\'); do mv "../$deb" $WORKSPACE/dist/debian/; done'
artifacts = sh (
script: "cat debian/files | awk '{print \$1}'",
returnStdout: true
).trim().split('\n')
}
}

stage('Test ' + distribution) {
buildImage.inside {
Integer debconfDebug = 0 //Set to "5" or "developer" to debug debconf
def debconf_debug = 0 //Set to "5" or "developer" to debug debconf
sh 'cd $WORKSPACE/dist/debian/ ; dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz; cd $WORKSPACE'
sh 'echo "deb [trusted=yes] file://///$WORKSPACE/dist/debian/ ./" | sudo tee /etc/apt/sources.list.d/local.list'
sh 'sudo apt-get update --allow-releaseinfo-change'
sh 'echo "INSTALATION"'
sh 'IFS="\n\b"; for package in `ls $WORKSPACE/dist/debian/ | grep .deb | awk -F_ \'{print \$1}\'` ; do echo -e "${GREEN} installing ${package} on `lsb_release -sc` ${ENDCOLOR} " ; sudo DEBIAN_FRONTEND=noninteractive apt-get -y install php-mbstring ; sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + debconfDebug + ' apt-get -y install $package ; done;'
stash includes: 'dist/**', name: 'dist-' + distroCodename
artifacts.each { deb_file ->
if (deb_file.endsWith('.deb')) {
sh 'echo -e "${GREEN} installing ' + deb_file + ' on `lsb_release -sc` ${ENDCOLOR} "'
sh 'sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + debconf_debug + ' apt-get -y install $WORKSPACE/dist/debian/' + deb_file
}
}
}
}
stage('Copy artifacts ' + distribution ) {
buildImage.inside {
artifacts.each { deb_file ->
println "Copying artifact: " + deb_file
archiveArtifacts artifacts: 'dist/debian/' + deb_file
}
sh 'mv $WORKSPACE/dist/debian/*.deb $WORKSPACE'
}
}
Expand Down
4 changes: 1 addition & 3 deletions debian/composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "deb/ease-core",
"description": "An Core of PHP Framework for Ease of writing Applications (debianized)",
"version": "1.44.0",
"authors": [
{
"name": "Vítězslav Dvořák",
Expand All @@ -25,6 +24,5 @@
},
"type": "library",
"homepage": "http://v.s.cz/ease.php",
"license": "GPL-2.0+",
"address": "1.11"
"license": "GPL-2.0+"
}
7 changes: 0 additions & 7 deletions debian/fixversion.sh

This file was deleted.

3 changes: 1 addition & 2 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ override_dh_auto_test:


override_dh_install:
jq '.version = "'`dpkg-parsechangelog | sed -n 's/^Version: //p'| sed 's/~.*//'`'"' debian/composer.json |sponge debian/composer.json
dh_install
./debian/fixversion.sh
echo "require_once 'Mail.php';" >> debian/php-vitexsoftware-ease-core/usr/share/php/EaseCore/Mailer.php
echo "require_once 'Mail/mime.php';" >> debian/php-vitexsoftware-ease-core/usr/share/php/EaseCore/Mailer.php
sed -i -e 's/..\/vendor/\/var\/lib\/php-vitexsoftware-ease-core/g' debian/php-vitexsoftware-ease-core-dev/usr/share/doc/php-vitexsoftware-ease-core-dev/SendTestMail.php
Expand All @@ -31,3 +29,4 @@ override_dh_install:
sed -i -e 's/tests\/.env/\/usr\/share\/php\/EaseCore\/Test\/.env/g' debian/php-vitexsoftware-ease-core-dev/usr/share/php/EaseCore/Test/Ease/SharedTest.php
sed -i -e 's/tests\/configtest.json/\/usr\/share\/php\/EaseCore\/Test\/configtest.json/g' debian/php-vitexsoftware-ease-core-dev/usr/share/php/EaseCore/Test/Ease/SharedTest.php
sed -i 's/vitexsoftware/deb/' debian/php-vitexsoftware-ease-core/usr/share/php/EaseCore/Logger/Logging.php
jq '.version = "'`dpkg-parsechangelog | sed -n 's/^Version: //p'| sed 's/~.*//'`'"' debian/composer.json |sponge debian/php-vitexsoftware-ease-core/usr/share/php/EaseCore/composer.json
10 changes: 5 additions & 5 deletions src/Ease/Anonym.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ class Anonym extends Brick implements Person
* User object name setting.
*
* @param string $objectName forced object name
*
* @return string
*/
public function setObjectName($objectName = null): string
{
Expand Down Expand Up @@ -88,8 +86,6 @@ public static function remoteToIdentity()

/**
* Anonymous has a level.
*
* @return int
*/
public function getUserLevel(): int
{
Expand Down Expand Up @@ -134,10 +130,14 @@ public function getSettingValue($settingName): ?string

/**
* Sets to: has no settings.
*
* @param mixed $settingName
* @param mixed $settingValue
*/
public function setSettingValue($settingName, $settingValue): bool
{
$this->settings[$settingName] = $settingValue;

return true;
}

Expand All @@ -156,7 +156,7 @@ public function getUserEmail(): string
*/
public function getPermission(string $permKeyword): ?string
{
return $permKeyword ? null : '' ;
return $permKeyword ? null : '';
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/Ease/Logger/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class Message
* @var string info|succes|warning|error|mail|debug|event
*/
public string $type;

public $caller;

/**
Expand Down
5 changes: 1 addition & 4 deletions src/Ease/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class Mailer extends Sand
* MIME Helper.
*/
public \Mail_mime $mimer;

public string $textBody = '';

/**
Expand All @@ -56,9 +55,7 @@ class Mailer extends Sand
* Line divider.
*/
public string $crLf = "\n";

public array $mailBody;

public bool $finalized = false;

/**
Expand Down Expand Up @@ -123,7 +120,7 @@ public function __construct(string $emailAddress, string $mailSubject, $emailCon
];

$this->mimer = new \Mail_mime($mimerParams);
$this->textBody = (string)$emailContents;
$this->textBody = (string) $emailContents;
$this->mimer->setTXTBody('');
$this->setObjectName();
}
Expand Down
15 changes: 12 additions & 3 deletions src/Ease/Molecule.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,26 +77,35 @@ public function setupProperty($options, $name, $constant = ''): void
$this->{$name} = $options[$constant];
} else { // If No values specified we must use constants or environment
$value = Functions::cfg($constant);

if ($constant && (empty($value) === false)) {
switch (gettype($this->{$name})) {
switch (\gettype($this->{$name})) {
case 'boolean':
switch (strtolower($value)) {
case 'true':
$this->{$name} = true;

break;
case 'false':
$this->{$name} = false;

break;

default:
$this->{$name} = (bool)Functions::cfg($constant);
$this->{$name} = (bool) Functions::cfg($constant);

break;
}

break;
case 'string':
$this->{$name} = (string)Functions::cfg($constant);
$this->{$name} = (string) Functions::cfg($constant);

break;

default:
$this->{$name} = Functions::cfg($constant);

break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Ease/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ public function getSettingValue(string $settingName): ?string;
* @param string $settingName klíčové slovo pro nastavení
* @param mixed $settingValue hodnota nastavení
*/
public function setSettingValue($settingName, $settingValue):bool;
public function setSettingValue($settingName, $settingValue): bool;

/**
* Anonym nemá mail.
*/
public function getUserEmail():string;
public function getUserEmail(): string;

/**
* Fake permissions.
Expand Down
33 changes: 17 additions & 16 deletions src/Ease/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class User extends Anonym

/**
* Pole uživatelských nastavení.
*
* @var array<string, mixed>
*/
public array $settings = [];
Expand Down Expand Up @@ -100,7 +101,7 @@ public function __construct($userID = null)
}

/**
* Prepare for serialization
* Prepare for serialization.
*
* @return array
*/
Expand All @@ -111,20 +112,18 @@ public function __sleep()

/**
* Give you user name.
*
* @return string
*/
public function getUserName(): string
{
return (string)$this->getDataValue($this->loginColumn);
return (string) $this->getDataValue($this->loginColumn);
}

/**
* Return user's mail address.
*/
public function getUserEmail(): string
{
return (string)$this->getDataValue($this->mailColumn);
return (string) $this->getDataValue($this->mailColumn);
}

/**
Expand Down Expand Up @@ -197,8 +196,6 @@ public function getIcon(): string
* Try to Sign in.
*
* @param array $formData pole dat z přihlaš. formuláře např. $_REQUEST
*
* @return bool
*/
public function tryToLogin(array $formData): bool
{
Expand Down Expand Up @@ -300,7 +297,7 @@ public function isAccountEnabled()
public function loginSuccess()
{
$this->userID = (int) $this->getMyKey();
$this->setUserLogin((string)$this->getDataValue($this->loginColumn));
$this->setUserLogin((string) $this->getDataValue($this->loginColumn));
$this->logged = true;
$this->addStatusMessage(sprintf(_('Signed in as %s'), $this->userLogin), 'success');
$this->setObjectName();
Expand Down Expand Up @@ -370,17 +367,17 @@ public function passwordChange(/** @scrutinizer ignore-unused */ $newPassword)
*
* @return int ID uživatele
*/
public function getUserID() : int
public function getUserID(): int
{
return isset($this->userID) ? (int) $this->userID : (int) $this->getMyKey();
}

/**
* Vrací login uživatele.
*/
public function getUserLogin() : string
public function getUserLogin(): string
{
return $this->userLogin ?? (string)$this->getDataValue($this->loginColumn);
return $this->userLogin ?? (string) $this->getDataValue($this->loginColumn);
}

/**
Expand All @@ -396,9 +393,9 @@ public function setUserLogin(string $login): bool
/**
* Set user's permission value.
*/
public function getPermission(string $permKeyword = null): ?string
public function getPermission(?string $permKeyword = null): ?string
{
return isset($this->permissions[$permKeyword]) ? $this->permissions[$permKeyword] : null ;
return $this->permissions[$permKeyword] ?? null;
}

/**
Expand All @@ -413,7 +410,9 @@ public function logout(): bool
}

/**
* Get Setting
* Get Setting.
*
* @param mixed $settingName
*/
public function getSettingValue($settingName): string
{
Expand All @@ -430,6 +429,7 @@ public function getSettingValue($settingName): string
public function setSettings($settings): bool
{
$this->settings = array_merge($this->settings, $settings);

return true;
}

Expand All @@ -442,6 +442,7 @@ public function setSettings($settings): bool
public function setSettingValue($settingName, $settingValue): bool
{
$this->settings[$settingName] = $settingValue;

return true;
}

Expand All @@ -456,8 +457,6 @@ public function loadPermissions()

/**
* Vrací jméno objektu uživatele.
*
* @return string
*/
public function getName(): string
{
Expand Down Expand Up @@ -488,6 +487,8 @@ public static function getGravatar($email, $size = 80, $default = 'mm', $maxRati

/**
* Nastavení jména objektu uživatele.
*
* @param null|mixed $objectName
*/
public function setObjectName($objectName = null): string
{
Expand Down
Loading

0 comments on commit b3e2ca5

Please sign in to comment.