Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/pip/ds-streamlit/files/streamli…
Browse files Browse the repository at this point in the history
…t-1.30.0
  • Loading branch information
BraisVQ authored Feb 1, 2024
2 parents e68a8b8 + ce9e879 commit dbfbdb4
Show file tree
Hide file tree
Showing 89 changed files with 1,417 additions and 90 deletions.
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ updates:
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
labels:
- "dependencies"
- "skip changelog"
16 changes: 16 additions & 0 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,22 @@ jobs:
run: |
docker build --tag agent-python-test-ubi8 --file Dockerfile.ubi8 .
jenkins-agent-rust-ubi8:
name: Jenkins agent Rust (UBI8)
runs-on: ubuntu-22.04
steps:
-
name: Checkout repository
uses: actions/[email protected]
-
name: Build docker image
working-directory: common/jenkins-agents/rust/docker
run: |
docker build --tag agent-rust-test-ubi8 --file Dockerfile.ubi8 \
--build-arg rustVersion=1.75.0 \
--build-arg rustToolchain=x86_64-unknown-linux-gnu \
.
jenkins-agent-terraform-ubi8:
name: Jenkins agent Terraform (UBI8)
runs-on: ubuntu-22.04
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
# Changelog

### Added
- Rust Quickstarter with Axum web framework simple boilerplate ([#980](https://github.com/opendevstack/ods-quickstarters/issues/980))
- Update gateway-Nginx quickstarter ([#983](https://github.com/opendevstack/ods-quickstarters/pull/983))
- Added secret scanning in docker plain ([#963](https://github.com/opendevstack/ods-quickstarters/pull/963))
- Added Nodejs20 agent ([#962](https://github.com/opendevstack/ods-quickstarters/issues/962))
- Update Streamlit and Python quickstarters and agent ([#968](https://github.com/opendevstack/ods-quickstarters/issues/968)) & ([#982](https://github.com/opendevstack/ods-quickstarters/pull/982))
- Added java 21 to jdk agent, updated Springboot and Spock quickstarters ([#962](https://github.com/opendevstack/ods-quickstarters/issues/962))
- Update release manager readme ([#969](https://github.com/opendevstack/ods-quickstarters/issues/969))

### Modified
- Remove nodejs12 form the code ([#936](https://github.com/opendevstack/ods-quickstarters/issues/936))
- Rust Quickstarter Jenkins Agent CICD tools with fixed versions ([#988](https://github.com/opendevstack/ods-quickstarters/issues/988))

### Fixed
- Maintenance for Golang Agent and QuickStarter ([#955](https://github.com/opendevstack/ods-quickstarters/issues/955))
- jenkins agents can not import private keys into gpg keyring to use with helm secrets ([#945](https://github.com/opendevstack/ods-quickstarters/issues/945))
- Streamlit quickstarter build fails to import nexus host certificates into truststore ([#951](https://github.com/opendevstack/ods-quickstarters/issues/951))
- Update Angular, TypeScript, Cypress and Ionic quickstarters ([#962](https://github.com/opendevstack/ods-quickstarters/issues/962))

## [4.3.0] - 2023-07-13

Expand Down
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/be-golang-plain/ @michaelsauter @henrjk
/be-java-springboot/ @stitakis @renedupont
/be-python-flask/ @buegelbeatz @henrjk @gerardcl
/be-rust-axum/ @gerardcl @flightlama
/be-scala-play/ @oalyman
/be-typescript-express/ @sino92
/docker-plain/ @michaelsauter
Expand Down
24 changes: 22 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,32 @@ start-jenkins-agent-jdk-build:
install-jenkins-agent-nodejs: apply-jenkins-agent-nodejs16-build apply-jenkins-agent-nodejs18-build apply-jenkins-agent-nodejs20-build start-jenkins-agent-nodejs16-build start-jenkins-agent-nodejs18-build start-jenkins-agent-nodejs20-build
.PHONY: install-jenkins-agent-nodejs

## Update OpenShift resources related to Jenkins Node agent image.
## Update OpenShift resources related to Jenkins Node 16 agent image.
apply-jenkins-agent-nodejs16-build:
cd common/jenkins-agents/nodejs16/ocp-config && tailor apply --namespace $(ODS_NAMESPACE)
.PHONY: apply-jenkins-agent-nodejs16-build

## Update OpenShift resources related to Jenkins Node 18 agent image.
apply-jenkins-agent-nodejs18-build:
cd common/jenkins-agents/nodejs18/ocp-config && tailor apply --namespace $(ODS_NAMESPACE)
.PHONY: apply-jenkins-agent-nodejs18-build

## Update OpenShift resources related to Jenkins Node 20 agent image.
apply-jenkins-agent-nodejs20-build:
cd common/jenkins-agents/nodejs20/ocp-config && tailor apply --namespace $(ODS_NAMESPACE)
.PHONY: apply-jenkins-agent-nodejs20-build

## Start build of BuildConfig "jenkins-agent-nodejs*".
## Start build of BuildConfig "jenkins-agent-nodejs16".
start-jenkins-agent-nodejs16-build:
oc -n $(ODS_NAMESPACE) start-build jenkins-agent-nodejs16 --follow
.PHONY: start-jenkins-agent-nodejs16-build

## Start build of BuildConfig "jenkins-agent-nodejs18".
start-jenkins-agent-nodejs18-build:
oc -n $(ODS_NAMESPACE) start-build jenkins-agent-nodejs18 --follow
.PHONY: start-jenkins-agent-nodejs18-build

## Start build of BuildConfig "jenkins-agent-nodejs20".
start-jenkins-agent-nodejs20-build:
oc -n $(ODS_NAMESPACE) start-build jenkins-agent-nodejs20 --follow
.PHONY: start-jenkins-agent-nodejs20-build
Expand All @@ -99,6 +103,22 @@ start-jenkins-agent-python-build:
.PHONY: start-jenkins-agent-python-build


# JENKINS AGENT RUST
## Install or update Jenkins Rust agent resources.
install-jenkins-agent-rust: apply-jenkins-agent-rust-build start-jenkins-agent-rust-build
.PHONY: install-jenkins-agent-rust

## Update OpenShift resources related to Jenkins Rust agent image.
apply-jenkins-agent-rust-build:
cd common/jenkins-agents/rust/ocp-config && tailor apply --namespace $(ODS_NAMESPACE)
.PHONY: apply-jenkins-agent-rust-build

## Start build of BuildConfig "jenkins-agent-rust".
start-jenkins-agent-rust-build:
oc -n $(ODS_NAMESPACE) start-build jenkins-agent-rust --follow
.PHONY: start-jenkins-agent-rust-build


# JENKINS AGENT SCALA
## Install or update Jenkins Scala agent resources.
install-jenkins-agent-scala: apply-jenkins-agent-scala-build start-jenkins-agent-scala-build
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This repository contains quickstarters, which are basically boilerplates that he

## Documentation

See [OpenDevStack Quickstarters](https://www.opendevstack.org/ods-documentation/opendevstack/2.x/quickstarters/index.html) for details.
See [OpenDevStack Quickstarters](https://www.opendevstack.org/ods-documentation/opendevstack/latest/quickstarters/index.html) for details.

The source of this documentation is located in the antora folder at https://github.com/opendevstack/ods-quickstarters/tree/master/docs/modules/quickstarters/pages.

Expand Down
2 changes: 1 addition & 1 deletion be-gateway-nginx/files/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# https://github.com/openresty/docker-openresty
FROM openresty/openresty:1.21.4.1-rocky
FROM openresty/openresty:1.25.3.1-1-rocky

ENV LANG=C.UTF-8

Expand Down
2 changes: 1 addition & 1 deletion be-gateway-nginx/files/metadata.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: nginx
description: "Enhanced nginx with Lua embeded. nginx [engine x] is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server. Technologies: OpenResty/nginx 1.19.3.2"
description: "Enhanced nginx with Lua embeded. nginx [engine x] is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server. Technologies: OpenResty/nginx 1.25.3.1-1"
supplier: https://openresty.org
version: 4.x
type: ods-service
4 changes: 2 additions & 2 deletions be-java-springboot/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ odsQuickstarterPipeline(

stage('Build spring project') {
dir(context.targetDir) {
def springBootVersion = '3.0.5'
def springBootVersion = '3.2.0'
echo "--- create spring boot (v${springBootVersion}) project via spring initializr ---"

sh "curl https://start.spring.io/starter.tgz \
Expand All @@ -29,7 +29,7 @@ odsQuickstarterPipeline(
-d dependencies='web,data-rest,data-jpa,h2,security,devtools' \
-d platformVersion=${springBootVersion} \
-d packaging=jar \
-d jvmVersion=17 \
-d jvmVersion=21 \
-d groupId=${context.projectId} \
-d artifactId=${context.componentId} \
-d name=${context.componentId} \
Expand Down
2 changes: 1 addition & 1 deletion be-java-springboot/Jenkinsfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def stageBuild(def context) {
}
stage('Build and Unit Test') {
withEnv(["TAGVERSION=${context.tagversion}", "NEXUS_HOST=${context.nexusHost}", "NEXUS_USERNAME=${context.nexusUsername}", "NEXUS_PASSWORD=${context.nexusPassword}", "JAVA_OPTS=${javaOpts}","GRADLE_TEST_OPTS=${gradleTestOpts}","ENVIRONMENT=${springBootEnv}"]) {
def status = sh(script: "source use-j17.sh && ./gradlew clean build --stacktrace --no-daemon && source use-j11.sh", returnStatus: true)
def status = sh(script: "source use-j21.sh && ./gradlew clean build --stacktrace --no-daemon && source use-j11.sh", returnStatus: true)
if (status != 0) {
error "Build failed!"
}
Expand Down
2 changes: 1 addition & 1 deletion be-java-springboot/files/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.access.redhat.com/ubi9/openjdk-17
FROM registry.access.redhat.com/ubi9/openjdk-21

# Enforce runtime protection for log4j2 CVE-2021-44228 (affected version from 2.0 to 2.14.1) in the affected vesion is used.
# This applies for version from 2.10 and not below.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion be-java-springboot/files/metadata.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: OpenJDK
description: "OpenJDK is a free and open-source implementation of the Java Platform, Standard Edition. Technologies: Spring Boot 2.1, OpenJDK 17"
description: "OpenJDK is a free and open-source implementation of the Java Platform, Standard Edition. Technologies: Spring Boot 3.2.0, OpenJDK 21"
supplier: https://openjdk.java.net/
version: 4.x
type: ods
38 changes: 38 additions & 0 deletions be-rust-axum/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
def odsNamespace = ''
def odsGitRef = ''
def odsImageTag = ''
def sharedLibraryRef = ''
def agentImageTag = ''

node {
odsNamespace = env.ODS_NAMESPACE ?: 'ods'
odsGitRef = env.ODS_GIT_REF ?: 'master'
odsImageTag = env.ODS_IMAGE_TAG ?: 'latest'
sharedLibraryRef = env.SHARED_LIBRARY_REF ?: odsImageTag
agentImageTag = env.AGENT_IMAGE_TAG ?: odsImageTag
}

library("ods-jenkins-shared-library@${sharedLibraryRef}")

odsQuickstarterPipeline(
imageStreamTag: "${odsNamespace}/jenkins-agent-rust:${agentImageTag}",
) { context ->

// https://cargo-generate.github.io/cargo-generate/index.html
stage('Cargo Generate project') {
sh(
script: "cargo generate --path ${context.sourceDir}/rust-template --name ${context.projectId}-${context.componentId}",
label: "Process Rust template"
)
sh(
script: "mv ${context.projectId}-${context.componentId} ${context.sourceDir}/files",
label: "Create files folder"
)
}

odsQuickstarterStageCopyFiles(context)

odsQuickstarterStageRenderJenkinsfile(context)

odsQuickstarterStageRenderSonarProperties(context)
}
73 changes: 73 additions & 0 deletions be-rust-axum/Jenkinsfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// See https://www.opendevstack.org/ods-documentation/ for usage and customization.

@Library('ods-jenkins-shared-library@@shared_library_ref@') _

odsComponentPipeline(
imageStreamTag: '@ods_namespace@/jenkins-agent-rust:@agent_image_tag@',
branchToEnvironmentMapping: [
'master': 'dev',
// 'release/': 'test'
]
) { context ->
odsComponentFindOpenShiftImageOrElse(context) {
stageTest(context)
odsComponentStageScanWithSonar(context)
stageBuild(context)
odsComponentStageBuildOpenShiftImage(context)
}
odsComponentStageRolloutOpenShiftDeployment(
context, [
'selector': "app=${context.componentId}",
// uncomment this to use values.<ENV>.yaml files to override defaults on values.yaml
// 'helmEnvBasedValuesFiles': ["values.env.yaml"],
]
)
}

def stageBuild(def context) {
stage('Cargo Build') {
sh "cargo build --release"
sh "cp -r target/release/${context.projectId}-${context.componentId} docker/app"
}
}

def stageTest(def context) {
stage('Cargo Check') {
sh """
cargo check --all-targets
"""
}
stage('Cargo Format') {
sh """
cargo fmt --all -- --check
"""
}
stage('Cargo Clippy') {
sh """
cargo clippy --all-features

# Clippy reports for SonarQube
mkdir -p build/test-results/clippy
cargo clippy --message-format=json &> build/test-results/clippy/report.json
"""
}
stage('Cargo Test') {
sh """
# create report folders
mkdir -p build/test-results/test
mkdir -p build/test-results/coverage

# Tests with JUnit XML report as defined in .config/nextest.toml
cargo nextest run --profile ci

# Coverage with LLVM lcov report from tests
# generate the lcov.info report
cargo llvm-cov --lcov --output-path ./build/test-results/coverage/lcov.info
# generate the html report
cargo llvm-cov report --html

cp -r target/nextest/ci/results.xml build/test-results/test
cp -r target/llvm-cov/html/ build/test-results/coverage
"""
}
}
7 changes: 7 additions & 0 deletions be-rust-axum/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Rust Axum Quickstarter (be-rust-axum)

Documentation is located in our [official documentation](https://www.opendevstack.org/ods-documentation/ods-quickstarters/latest/index.html)

Please update documentation in the [antora page directory](https://github.com/opendevstack/ods-quickstarters/tree/master/docs/modules/ROOT/pages)

Tested thru [automated tests](../tests/be-rust-axum)
4 changes: 4 additions & 0 deletions be-rust-axum/ocp.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MEMORY_LIMIT=128Mi
MEMORY_REQUEST=64Mi
CPU_LIMIT=100m
CPU_REQUEST=50m
4 changes: 4 additions & 0 deletions be-rust-axum/rust-template/.config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[profile.ci.junit]
path = "results.xml"
store-success-output = true
store-failure-output = true
14 changes: 14 additions & 0 deletions be-rust-axum/rust-template/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
5 changes: 5 additions & 0 deletions be-rust-axum/rust-template/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/target
/build
.vscode
.DS_Store
.env
5 changes: 5 additions & 0 deletions be-rust-axum/rust-template/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.16.1
hooks:
- id: gitleaks
43 changes: 43 additions & 0 deletions be-rust-axum/rust-template/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[package]
# Here the project-name (Rust project) is your ODS component name
name = "{{project-name}}"
version = "0.1.0"
edition = "2021"
description = "{{project-name}} - from the OpenDevStack Rust QuickStarter."
license = "MIT OR Apache-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# one can add more dependencies via cargo to Cargo.toml as shown next: cargo add axum -F axum/http2
axum = { version = "0.7", features = ["http2"] }
tokio = { version = "1.35", features = ["rt-multi-thread", "macros", "signal"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
http = "1.0"
http-body-util = "0.1"
bytes = "1.5"
thiserror = "1.0"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["tracing", "env-filter"] }
lazy_static = "1.4"

# Nice HTTP middlewares from Tower crate, to be added to router.rs.
# Uncomment as per need, check official docs.
# tower-http = { version = "0.5", features = [
# "trace",
# "compression-br",
# "propagate-header",
# "sensitive-headers",
# "cors",
# ] }

# SQLx is the recommended safe and performant package to work with relational DBs like PostgreSQL; check official docs
# sqlx = { version = "0.7", features = [ "runtime-tokio", "tls-rustls", "postgres", "uuid", "json", "time", "macros", "migrate" ] }

# One can use envy crate for more automated env vars management, see docs.
# envy = "*"
# One can use dotenvy crate for automating ingestion of env vars from .env file.
# dotenvy = "*"

[dev-dependencies]
tower = { version = "0.4", features = ["util"] }
Loading

0 comments on commit dbfbdb4

Please sign in to comment.