Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

fix: CI/CD issues (#3059)

Dennis Kuijs3125aa44c897
diff --git a/.ci_cd/ci_cd.json b/.ci_cd/ci_cd.json
index 1f368ccc8..3535ffa8f 100644
--- a/.ci_cd/ci_cd.json
+++ b/.ci_cd/ci_cd.json
@@ -1,24 +1,28 @@
{
- "push": {
- "master": {
- "distribute": {
- "docker": "develop-core",
- "npm": "$version-core-snapshot"
- },
- "deploy": {
- "managerTag": "develop-core",
- "environment": "staging"
- }
- }
- },
- "release": {
- "distribute": {
- "docker": "latest-core,$version-core",
- "npm": "$version-core"
- },
- "deploy": {
- "managerTag": "latest-core",
- "environment": "demo"
- }
- }
+ "push": {
+ "master": {
+ "distribute": {
+ "docker": "develop-core",
+ "npm": "$version-core-snapshot"
+ }
+ }
+ },
+ "workflow_dispatch": {
+ "deploy": {
+ "snapshot": {
+ "managerTag": "develop",
+ "environment": "staging"
+ },
+ "release": {
+ "managerTag": "latest",
+ "environment": "demo"
+ }
+ }
+ },
+ "release": {
+ "distribute": {
+ "docker": "latest-core,$version-core",
+ "npm": "$version-core"
+ }
+ }
}
diff --git a/.github/actions/process-cicd-json/action.yml b/.github/actions/process-cicd-json/action.yml
index aa6514775..53ff4a1bf 100644
--- a/.github/actions/process-cicd-json/action.yml
+++ b/.github/actions/process-cicd-json/action.yml
@@ -35,7 +35,7 @@ runs:
files: ".ci_cd/ci_cd.json"
- name: Process ci_cd.json file
- if: ${{ steps.check_cicd_json.outputs.files_exists == 'true' && (github.ref_type == 'tag' || (github.event_name != 'workflow_dispatch' && github.event_name != 'pull_request')) }}
+ if: ${{ steps.check_cicd_json.outputs.files_exists == 'true' && (github.ref_type == 'tag' || github.event_name != 'pull_request') }}
id: ci-cd-output
shell: python
run: |
@@ -54,30 +54,37 @@ runs:
dockerPublishTags = None
npmPublishTag = None
deployEnvironment = None
- eventConfig = ()
+ eventConfig = None
+ distributeConfig = None
f = open(".ci_cd/ci_cd.json")
data = json.load(f)
f.close()
- if isRelease:
- eventName = "release"
-
if data is not None and eventName in data:
eventConfig = data[eventName]
- if eventName == "push" and refType == "branch" and refName in eventConfig:
- eventConfig = eventConfig[refName]
-
+ if eventName == "push" and refType == "branch" and isinstance(eventConfig, dict):
+ eventConfig = eventConfig.get(refName)
+
if eventConfig is not None:
- deploys = eventConfig['deploy'] if 'deploy' in eventConfig else None
- if 'distribute' in eventConfig:
- if 'docker' in eventConfig['distribute']:
- dockerPublishTags = eventConfig['distribute']['docker']
- if 'npm' in eventConfig['distribute']:
- npmPublishTag = eventConfig['distribute']['npm']
-
- if isMainRepo and ((eventName == "release" and isRelease) or (eventName != "release" and not isRelease)):
+ deploys = eventConfig.get('deploy')
+
+ if eventName == "workflow_dispatch" and isinstance(deploys, dict):
+ deploys = deploys["release"] if isRelease else deploys["snapshot"]
+
+ if eventName == "workflow_dispatch" and isRelease:
+ distributeConfig = data.get("release")
+ else:
+ distributeConfig = eventConfig
+
+ if distributeConfig is not None and 'distribute' in distributeConfig:
+ if 'docker' in distributeConfig['distribute']:
+ dockerPublishTags = distributeConfig['distribute']['docker']
+ if 'npm' in distributeConfig['distribute']:
+ npmPublishTag = distributeConfig['distribute']['npm']
+
+ if isMainRepo:
if dockerPublishTags is not None:
dockerPublishTags = ",".join(map(lambda t: t.strip(), dockerPublishTags.split(",")))
diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml
index 90c1d5c29..016cbd715 100644
--- a/.github/workflows/staging.yml
+++ b/.github/workflows/staging.yml
@@ -5,21 +5,9 @@ on:
branches: [master]
tags:
- '[0-9]+.[0-9]+.[0-9]+'
+
workflow_dispatch:
- inputs:
- ENVIRONMENT:
- description: 'Environment to use (if any)'
- MANAGER_TAG:
- description: 'Manager docker tag to pull'
- CLEAN_INSTALL:
- description: 'Delete data before starting'
- type: boolean
- COMMIT:
- description: 'Repo branch or commit SHA to checkout'
- OR_HOSTNAME:
- description: 'Host to deploy to (e.g. demo.openremote.app)'
- OR_ADMIN_PASSWORD:
- description: 'Admin password override'
+
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -198,7 +186,7 @@ jobs:
extensions:
name: Extensions
- needs: [detect-changes, publish-maven, publish-npm]
+ needs: [detect-changes, build-manager-image, publish-maven]
if: ${{ !failure() && !cancelled() }}
uses: "./.github/workflows/extensions.yml"
with:
@@ -207,11 +195,3 @@ jobs:
secrets:
GH_EXTENSIONS_TOKEN: ${{ secrets._TEMP_GH_EXTENSIONS_TOKEN }}
- deployment:
- name: Deploy
- needs: [detect-changes, unit-tests, integration-tests, ui-check-outdated-translations, ui-component-tests, ui-app-tests]
- if: ${{ !failure() && !cancelled() }}
- uses: "./.github/workflows/deployment.yml"
- with:
- INPUTS: ${{ toJSON(inputs) }}
- secrets: inherit
diff --git a/manager/build.gradle b/manager/build.gradle
index e6f177955..d040cf955 100644
--- a/manager/build.gradle
+++ b/manager/build.gradle
@@ -13,6 +13,10 @@ application {
mainClass = "org.openremote.manager.Main"
}
+configurations {
+ demoExtension
+}
+
dependencies {
api project(":container")
@@ -57,6 +61,8 @@ dependencies {
implementation libs.sshdNetty
+ demoExtension "io.openremote.extension:openremote-demo-setup-extension:${project.version}"
+
testImplementation libs.groovyAll
testImplementation platform(libs.spockBom)
testImplementation libs.spockCore
@@ -66,6 +72,9 @@ dependencies {
}
sourceSets {
+ main {
+ runtimeClasspath += configurations.demoExtension
+ }
test {
groovy.srcDirs = ['test/src/groovy']
}
@@ -107,7 +116,6 @@ tasks.withType(Zip) {
distributions {
main {
contents {
- exclude("**/openremote-demo-setup-extension-*.jar", "**/openremote-energy-extension-*.jar")
from(project.projectDir) {
include("*Dockerfile", "entrypoint.sh", "heapdump-rename.sh")
}
@@ -197,13 +205,6 @@ publish.dependsOn(setVersionProperties)
processResources.dependsOn(setVersionProperties)
sourcesJar.dependsOn(setVersionProperties)
-configurations {
- demoExtension
-}
-
-dependencies {
- demoExtension api("io.openremote.extension:openremote-demo-setup-extension:${project.version}")
-}
tasks.named("run", JavaExec) {
def setupType = System.getenv("OR_SETUP_TYPE")