Silent build-upload automation?

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
olaplanche
Messages: 178
Registration: January 26, 2017 - 11:11

December 17, 2018 - 4:18 PM

- Installed WAPT version: 1.6.2.7
- Server OS: Debian Stretch
- Administration/package creation machine OS: Windows 10

Hello,

I would like to know if it's possible to silently script the creation and upload of a package?
My idea is to completely automate package updates if possible...

When I use the following command: wapt-get.exe build-upload mypackagepath, it prompts me for my private key password. I suspect this behavior is intended, but is there another way to do it?

Thank you
- Installed WAPT version: 2.6.0.16795 Enterprise
- Server OS: Linux / Debian Bookworm
- Administration/package creation machine OS: Windows 10
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

December 17, 2018 - 10:27 PM

Example code that edits a package, performs the package update, and then rebuilds the package to maturity VALIDITY-WAIT

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
from waptpackage import *
from common import *

devrep = makepath('c:','waptdev')
packagename='smp-firefox-esr'
repcomplet=makepath(devrep,packagename)
myWapt = Wapt(config_filename=makepath(r'C:\Users\Administrateur\AppData\Local\waptconsole\waptconsole.ini'))
if isdir(repcomplet):
    remove_tree(repcomplet)
myWapt.edit_package(packagename,target_directory=repcomplet)
thepackage = PackageEntry(waptfile=repcomplet)
thepackage.call_setup_hook('update_package',wapt_context=myWapt)
myWapt.build_upload(repcomplet,private_key_passwd=ur'passwordkey',wapt_server_user='admin',wapt_server_passwd=ur'passwordserver',set_maturity='VALIDITY-WAIT')
olaplanche
Messages: 178
Registration: January 26, 2017 - 11:11

December 18, 2018 - 11:48

I'd like to comment on the code to make sure I've understood it correctly:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
from waptpackage import *
from common import *

# Défini la variable devrep avec le chemin "c:\waptdev"
devrep = makepath('c:','waptdev')
# Défini la variable packagname avec le nom du paquet "smp-firefox-esr"
packagename='smp-firefox-esr'
# Défini la variable repcomplet avec la concaténation des variables devrep et packagename
repcomplet=makepath(devrep,packagename)
# Défini la variable myWapt avec le chemin du fichier de conf local de ma console
myWapt = Wapt(config_filename=makepath(r'C:\Users\Administrateur\AppData\Local\waptconsole\waptconsole.ini'))
# Supprimer le dossier local du package si il existe
if isdir(repcomplet):
    remove_tree(repcomplet)
# Télécharger et extraire le package depuis le repository wapt dans le dossier "repcomlet"
myWapt.edit_package(packagename,target_directory=repcomplet)
# Défini la variable thepackage avec les infos récupérées depuis le dossier local du package
thepackage = PackageEntry(waptfile=repcomplet)
# Appel de la fonction update_package du paquet en question
thepackage.call_setup_hook('update_package',wapt_context=myWapt)
# build et upload du paquet mis à jour sur le repository wapt
myWapt.build_upload(repcomplet,private_key_passwd=ur'passwordkey',wapt_server_user='admin',wapt_server_passwd=ur'passwordserver',set_maturity='VALIDITY-WAIT')
If I'm not mistaken, you then need to add the update_package function to the desired package and then save the above customized Python script for the desired package and run it in a scheduled task, for example?!

THANKS
- Installed WAPT version: 2.6.0.16795 Enterprise
- Server OS: Linux / Debian Bookworm
- Administration/package creation machine OS: Windows 10
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

December 18, 2018 - 1:38 PM

That's it
olaplanche
Messages: 178
Registration: January 26, 2017 - 11:11

December 19, 2018 - 2:54 PM

Good morning,

I get the following error when running my Python script:

Code: Select all

wapt-wAdministratif_8.4-64_all.wapt[================================] 26555304/26555304 - 00:00:00
No handlers could be found for logger "root"
Traceback (most recent call last):
  File "e:\update_package_wapt-wAdministratif.py", line 23, in <module>
    myWapt.edit_package(packagename,target_directory=repcomplet)
  File "C:\wapt\common.py", line 6228, in edit_package
    raise Exception(u'Unable to unzip package in %s' % target_directory)
Exception: Unable to unzip package in c:\waptdev\wapt-wAdministratif
I'm running it as administrator, but it seems it can't decompress the package...

Any ideas?

Edit: Actually, it's not downloading the package at all, and I can't access it through the console either when I click on "edit package"...

THANKS
- Installed WAPT version: 2.6.0.16795 Enterprise
- Server OS: Linux / Debian Bookworm
- Administration/package creation machine OS: Windows 10
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

December 22, 2018 - 11:34

Does waptdev exist?
olaplanche
Messages: 178
Registration: January 26, 2017 - 11:11

January 8, 2019 - 09:17

Hello,

Yes, the c:\waptdev folder does exist.

PS: I wish the whole team a very happy 2019 and thank you again for this fabulous tool!
- Installed WAPT version: 2.6.0.16795 Enterprise
- Server OS: Linux / Debian Bookworm
- Administration/package creation machine OS: Windows 10
olaplanche
Messages: 178
Registration: January 26, 2017 - 11:11

January 15, 2019 - 2:42 PM

I've just revisited this problem and I can't reproduce the error mentioned earlier...
Instead, I'm seeing a new, strange behavior:

In my waptdev folder, my package folder is named "wapt-wAdministratif-wapt", and the package name in its control file and in the console is "wapt-wAdministratif". When I run the Python script above, the wapt-wAdministratif folder is created in my waptdev folder...
okay, that makes sense, I understand that much. Currently, the script crashes on the package's update function.
The strangest thing is that when I edit my package c:\waptdev\wapt-wAdministratif-wapt (to edit the update function, for example) and then run a build-upload, my package is successfully generated and uploaded to the server. I deleted the old one from the console and ran the Python script above again. It downloaded the wapt-wAdministratif package to the c:\waptdev\wapt-wAdministratif folder, but the contents don't match the latest version of the package I edited, generated, and uploaded previously. It seems I only have one version of the package on the server, so I don't understand how this is possible.

I'll keep looking, but if anyone has any ideas, please let me know!

Thanks
- Installed WAPT version: 2.6.0.16795 Enterprise
- Server OS: Linux / Debian Bookworm
- Administration/package creation machine OS: Windows 10
Locked