Tools for Tuleap. For instance Tuleap functions for automatic updates of artifacts. Inspired by https://github.com/Enalean/tuleap-function-examples
- Operating System: Linux or WSL (already tested on OpenSUSE16)
Required libraries, SDKs, or tools:
- NIX (package manager for Unix like systems)
From a terminal, as normal user, do
sh <(curl -L https://nixos.org/nix/install) --no-daemonTo have NIX available, you need to source the profile file. Beware, the NIX environment will only be available in the terminal in which you perform the source command.
source ~/.nix-profile/etc/profile.d/nix.shIf you want to avoid having to source the file everytime, then add the source of the profile file to the bashrc
vim ~/.bashrcAnd add the following line at the end.
source ~/.nix-profile/etc/profile.d/nix.sh- Clone the repository:
git clone [repository-url]
cd artifact-post-action/compute_riskLaunch a NIX shell with necessary packages
nix-shell --pure shell.nixBuild the function
cargo build --target wasm32-wasip1 --releaseThe filesystem of the compute_risk is the following
compute_risk/ - src/main.rs - Cargo.lock - Cargo.toml - Makefile - shell.nix
The main.rs file contains the function source code in Rust, supported by WASI Preview 1 (WebAssembly). This is where you will edit the behavior of your artefacts.
The shell.nix specifies the necessary packages to install in the NIX environment to build, convert files in WebAssembly. For instance cargo and make.
Upload the binary result file (target/wasm32-wasip1/release/post-action-compute-risk.wasm) to your Tracker administration (Administration > Workflow > Tuleap Functions).
When downloading NIX or its packages listed in the shell.nix you can encounter an error indicating that certificates could not be found. Example of message: "Problem with the SSL CA cert"
First check if SSL certificates are installed
sudo zypper install ca-certificates ca-certificates-mozillaIf already installed, check if the following file exists /etc/ssl/certs/ca-certificates.crt If not then create it with a concatenation of all the certificate files in the /etc/ssl/certs/ folder.
sudo cat /etc/ssl/certs/*.pem > /etc/ssl/certs/ca-certificates.crtThen retry your NIX command
When running the shell.nix file, if you find an error "bash: symbol lookup error: bash: undefined symbol: rl_completion_rewrite_hook" that means that there is a conflict between absh and the readline library of your system and the one required by NIX.
Ensure that you run the nix-shell with the pure parameter to avoid using your system bash environment.
nix-shell --pure