Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into 962-refactor-and-test-timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsteinkogler authored Apr 22, 2024
2 parents 0ab59bd + 4bdb7ae commit f7285be
Show file tree
Hide file tree
Showing 31 changed files with 756 additions and 156 deletions.
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ body:
unfortunately `npm audit --omit=dev fix` does [too much and too little](https://overreacted.io/npm-audit-broken-by-design/),
`cargo deny check` seems to be more helpful
- [ ] check/improve reformatting
- [ ] check if all issues labelled `release critical` are fixed
- [ ] check if all issues labelled [`release critical`](https://issues.permaplant.net/?q=is%3Aopen+is%3Aissue+label%3A%22release+critical%22) are fixed
- [ ] update mergedDatasets.csv
- [ ] Merge PRs (@markus2330)
### Actual Release
- [ ] check if all preps are done
- [ ] manually test dev.permaplant.net according to protocol
- [ ] manually test [dev.permaplant.net](https://dev.permaplant.net/) according to protocol
- [ ] build <https://build.libelektra.org/job/PermaplanT-Release/>
- [ ] git tag -s vX.X.X
- [ ] git push --tags
- [ ] `git tag -s vX.X.X`
- [ ] `git push --tags`
### After Release
Expand Down
13 changes: 8 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ We will help you, but we cannot accept PRs that do not fulfill the basics.

<!--
For documentation fixes, spell checking, and similar none of these points below need to be checked.
Otherwise please check these points when getting a PR done:
Otherwise please check below points when getting a PR done.
If nothing is to be done, please check them, too.
-->

- [ ] I fully described what my PR does in the documentation
Expand Down Expand Up @@ -58,9 +59,11 @@ Also the checklist above can be used.
But also the PR creator should check these points when getting a PR done:
-->

- [ ] I've tested the code
- [ ] I've read through the whole code
- [ ] I've read through the whole documentation
- [ ] I've tested the code via issue description
- [ ] I've tested the code via requirements
- [ ] I've tested the code with concurrency (several browsers on the same map)
- [ ] I've read through the code
- [ ] I've read through the documentation
- [ ] I've checked conformity to guidelines
- [ ] I've checked conformity to requirements
- [ ] I've checked that the requirements are tested
- [ ] I've checked that the requirements are automatically tested
46 changes: 34 additions & 12 deletions backend/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "backend"
version = "0.3.7"
version = "0.4.0"
description = "The backend of PermaplanT"
repository = "https://github.com/ElektraInitiative/PermaplanT"
license = "BSD-3-Clause"
Expand Down
15 changes: 9 additions & 6 deletions backend/src/model/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ pub struct Plants {
pub soil_texture: Option<Vec<Option<SoilTexture>>>,

/*
/// - *Used* in hydrology layer.
/// - *NOT used* in hydrology layer
/// as it has poor quality and no additional data compared to water_requirement
/// - *Fill ratio:* 37%
/// - *Fetched from* PracticalPlants
/// - wet = drowned, (often) flooded or in general very moist, e.g. swamp
/// - moist = humid, can hold some water, e.g. flat bed with humus
/// - well drained = dry, low capacity to hold water, e.g. sandhill.
/// - *Fill ratio:* 37%
pub soil_water_retention: Option<Vec<Option<SoilWaterRetention>>>,
*/
/*
/// - Only informational.
/// - *Fetched from* PracticalPlants
/// - gives information about environmental conditions, such as drought or wind tolerance
Expand Down Expand Up @@ -258,7 +258,7 @@ pub struct Plants {
/// - *Fill ratio:* 100%
pub updated_at: NaiveDateTime,

/// - *Used* in hydrology layer.
/// - *Used* in watering layer.
/// - Fetched from PracticalPlants and merged with \`has_drought_tolerance\` of Permapeople.
/// - *Fill ratio:* 57%
pub has_drought_tolerance: Option<bool>,
Expand Down Expand Up @@ -318,7 +318,10 @@ pub struct Plants {

/// - *Used* in hydrology layer.
/// - *Fetched from* PracticalPlants and Permapeople (merged with `water` of PracticalPlants).
/// - water = completely aquatic; wet = drowned, (often) flooded or in general very moist, e.g. swamp; moist = humid, regular water supply, e.g. flat bed with humus; well drained = dry, little water input.
/// - water = completely aquatic;
/// - wet = drowned, (often) flooded or in general very moist, e.g. swamp;
/// - moist = humid, regular water supply, e.g. flat bed with humus;
/// - well drained = dry, little water input.
/// - *Fill ratio:* 88%
pub water_requirement: Option<Vec<Option<WaterRequirement>>>,

Expand Down
27 changes: 14 additions & 13 deletions ci/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
// Pipeline for PR's, master merges and production

import org.jenkinsci.plugins.pipeline.modeldefinition.Utils

// Function duplicated in `Jenkinsfile.release`
def node_info() {
echo "Running stage on ${env.NODE_NAME}"
}

def wait_for_db() {
retry(6) {
sleep(time: 5, unit: 'SECONDS')
sh '/usr/bin/pg_isready --host=db --username=ci --dbname=ci --timeout=60'
}
}

def wait_for_pr_db() {
retry(6) {
// groovylint-disable-next-line
// Function duplicated in `Jenkinsfile.release` without the command parameter
def wait_for_db(String command) {
retry(10) {
sleep(time: 5, unit: 'SECONDS')
sh 'curl --fail https://pr.permaplant.net/api/config'
sh "${command}"
}
}

Expand All @@ -39,6 +35,7 @@ def abortPreviousRunUnlessMaster() {
}
}

// function content duplicated in `Jenkinsfile.release`
/**
* This method runs a Docker container with a Postgres sidecar and executes the specified command inside the container.
*
Expand Down Expand Up @@ -66,7 +63,7 @@ def runDockerPostgresSidecar(String command, List<String> stashsrc = [], List<S
-e 'RUSTDOCFLAGS=-D warnings'"
) {
checkout scm
wait_for_db()
wait_for_db('/usr/bin/pg_isready --host=db --username=ci --dbname=ci --timeout=60')
sh './ci/build-scripts/build-schema.sh'
// Because in Deploy the path for /target is a
//env in permaplant-deploy.sh, we can only solve it with prepending cd backend
Expand All @@ -83,6 +80,7 @@ def runDockerPostgresSidecar(String command, List<String> stashsrc = [], List<S
}
}

// function content duplicated in `Jenkinsfile.release`
/**
* Run a script inside a desired docker image with custom docker arguments.
* @param command The command to be executed inside the Docker container.
Expand All @@ -107,6 +105,7 @@ def runDocker(String command, String dockerImage, String dockerBuildArgs, boolea
}
}

// mdbook build duplicated in `Jenkinsfile.release`
/**
* Test, Build and stash Mdbook inside permaplants docker image.
*
Expand Down Expand Up @@ -295,6 +294,7 @@ timeout(time: 2, unit: 'HOURS') {

if (env.BRANCH_NAME.startsWith('PR')){
lock("${env.NODE_NAME}-exclusive") {
// `Deploy PR` stage similar to `Deploy Dev` and `Jenkinsfile.release.Deploy Prod`
stage('Deploy PR') {
node('permaplant && pr') {
node_info()
Expand Down Expand Up @@ -347,7 +347,7 @@ lock("${env.NODE_NAME}-exclusive") {
}
try {
docker.build('permaplant-e2e:ci', './e2e').inside('-e E2E_URL=' + target) {
wait_for_pr_db()
wait_for_db('curl --fail https://pr.permaplant.net/api/config')
sh 'make test-e2e'
}
} catch (err) {
Expand All @@ -371,6 +371,7 @@ lock("${env.NODE_NAME}-exclusive") {
// Deploying to Dev only happens on branch "master"
if (env.BRANCH_NAME == 'master') {
try {
// `Deploy Dev` stage similar to `Deploy PR` and `Jenkinsfile.release.Deploy Prod`
stage('Deploy Dev') {
node('permaplant && dev') {
node_info()
Expand Down
11 changes: 10 additions & 1 deletion ci/Jenkinsfile.release
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// Pipeline for releases, which is manually triggered on the jenkins webapp

// Function duplicated in `Jenkinsfile`
def node_info() {
echo "Running stage on ${env.NODE_NAME}"
}

// Function duplicated in `Jenkinsfile` the command parameter
def wait_for_db() {
retry(6) {
sleep(time: 5, unit: 'SECONDS')
Expand Down Expand Up @@ -43,6 +47,7 @@ def copyDocumentation() {
}

stage('Build Schema') {
// duplicated in `Build in Docker` stage
node('docker') {
node_info()

Expand All @@ -68,6 +73,7 @@ stage('Build in Docker') {
def parallelBuild = [:]

parallelBuild['build-backend'] = {
// duplicated in `Build Schema` stage
node('docker') {
node_info()

Expand All @@ -85,14 +91,15 @@ stage('Build in Docker') {

stash includes: 'backend/target/release/backend', name: 'backend'

sh 'cargo doc --document-private-items'
sh 'cd backend && cargo doc --document-private-items'
stash includes: 'backend/target/doc/**/*', name: 'cargodoc'
}
}
}
}

parallelBuild['build-frontend'] = {
// duplicated in `Jenkinsfile.testAndBuildFrontend()`
node('docker') {
node_info()

Expand Down Expand Up @@ -121,6 +128,7 @@ stage('Build in Docker') {
}
}

// duplicated in `Jenkinsfile.release.testAndBuildMdbook()`
parallelBuild['build-mdbook'] = {
node('docker') {
node_info()
Expand All @@ -138,6 +146,7 @@ stage('Build in Docker') {
parallel(parallelBuild)
}

// similar to `Deploy PR/Dev` stage in `Jenkinsfile`
stage('Deploy Prod') {
node('permaplant && prod') {
checkout scm
Expand Down
3 changes: 2 additions & 1 deletion doc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
FROM rust:1.67.1-slim-bookworm AS builder

ENV MDBOOK_VERSION=0.4.23 \
MDBOOK_MERMAID_VERSION=0.12.6
MDBOOK_MERMAID_VERSION=0.12.6 \
CARGO_NET_RETRY=10

RUN apt-get update && \
apt-get install -y --no-install-recommends \
Expand Down
Loading

0 comments on commit f7285be

Please sign in to comment.