100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Remove secrets processing from inputs-and-secrets step (#2738)
Koen0341fbf1b36c
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.ymlindex 1418a157f..738164c02 100644--- a/.github/workflows/ci_cd.yml+++ b/.github/workflows/ci_cd.yml@@ -110,8 +110,8 @@ jobs:runs-on: ubuntu-lateststeps:- - name: Get inputs and secrets- id: inputs-and-secrets+ - name: Process inputs+ id: process-inputsshell: pythonrun: |import os@@ -120,13 +120,10 @@ jobs:# Overlay all inputs and secrets onto this jobs outputscallerInputs = os.getenv("CALLER_INPUTS")inputs = os.getenv("INPUTS")- secrets = os.getenv("SECRETS")eventName = os.getenv("GITHUB_EVENT_NAME")if inputs is not None and inputs != '':inputs = json.loads(inputs)- if secrets is not None and secrets != '':- secrets = json.loads(secrets)if eventName == 'workflow_call' and callerInputs is not None and callerInputs != 'null':os.system(f"echo 'Processing caller inputs'")inputs = json.loads(callerInputs)@@ -134,24 +131,11 @@ jobs:if inputs is not None and 'INPUTS' in inputs:os.system("echo 'Processing inputs from caller'")inputs = json.loads(inputs['INPUTS'])- if 'SECRETS' in secrets:- os.system("echo 'Processing secrets from caller'")- secrets = json.loads(secrets['SECRETS'])- # Iterate over secrets then inputs and assign them as outputs on this step-- if secrets is not None and secrets != 'null':- for key, value in secrets.items():- print(f"::add-mask::{value}")- lines = len(value.split("\n"))- if lines > 1:- os.system(f"echo '{key}<<EEOOFF\n{value}\nEEOOFF' >> $GITHUB_OUTPUT")- else:- os.system(f"echo '{key}={value}' >> $GITHUB_OUTPUT")+ # Iterate over inputs and assign them as outputs on this stepif inputs is not None and inputs != 'null':for key, value in inputs.items():- print(f"::add-mask::{value}")os.system(f"echo 'Outputting input: {key}'")lines = len(value.split("\n"))if lines > 1:@@ -161,7 +145,6 @@ jobs:env:CALLER_INPUTS: ${{ toJSON(inputs) }}- SECRETS: ${{ toJSON(secrets) }}INPUTS: ${{ toJSON(github.event.inputs) }}- name: Public IP@@ -189,7 +172,7 @@ jobs:uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2with:# This will only be available when run by workflow_dispatch otherwise will checkout branch/commit that triggered the workflow- ref: ${{ steps.inputs-and-secrets.outputs.COMMIT }}+ ref: ${{ steps.process-inputs.outputs.COMMIT }}submodules: recursivefetch-depth: 200lfs: 'true'@@ -467,9 +450,9 @@ jobs:IS_MAIN_REPO: ${{ steps.is_main_repo.outputs.value }}MANAGER_VERSION: ${{ steps.is_main_repo.outputs.ref }}DEPLOYMENTS: ${{ steps.ci-cd-output.outputs.deploys }}- INPUT_ENVIRONMENT: ${{ steps.inputs-and-secrets.outputs.ENVIRONMENT }}- INPUT_MANAGER_TAG: ${{steps.inputs-and-secrets.outputs.MANAGER_TAG }}- INPUT_PUSH_SNAPSHOT: ${{ steps.inputs-and-secrets.outputs.PUSH_SNAPSHOT }}+ INPUT_ENVIRONMENT: ${{ steps.process-inputs.outputs.ENVIRONMENT }}+ INPUT_MANAGER_TAG: ${{steps.process-inputs.outputs.MANAGER_TAG }}+ INPUT_PUSH_SNAPSHOT: ${{ steps.process-inputs.outputs.PUSH_SNAPSHOT }}- name: Define backend test commandid: test-backend-command@@ -505,7 +488,7 @@ jobs:echo "managerDockerImage=openremote/manager:$FIRST_MANAGER_TAG" >> $GITHUB_OUTPUTelseif [ "$PUSH_SNAPSHOT" == "true" ]; then- command="docker build --push --build-arg GIT_COMMIT=$commitSha --platform linux/amd64,linux/aarch64 -t ${{ steps.inputs-and-secrets.outputs.OR_AWS_DEVELOPERS_ACCOUNT_ID }}.dkr.ecr.eu-west-1.amazonaws.com/openremote/manager:SNAPSHOT-$commitShaShort $buildPath && docker build --build-arg GIT_COMMIT=$commitSha --platform ${PLATFORM:-linux/amd64} --load -t openremote/manager:$commitShaShort $buildPath"+ command="docker build --push --build-arg GIT_COMMIT=$commitSha --platform linux/amd64,linux/aarch64 -t ${{ secrets.OR_AWS_DEVELOPERS_ACCOUNT_ID }}.dkr.ecr.eu-west-1.amazonaws.com/openremote/manager:SNAPSHOT-$commitShaShort $buildPath && docker build --build-arg GIT_COMMIT=$commitSha --platform ${PLATFORM:-linux/amd64} --load -t openremote/manager:$commitShaShort $buildPath"elsecommand="docker build --build-arg GIT_COMMIT=$commitSha --platform ${PLATFORM:-linux/amd64} --load -t openremote/manager:$commitShaShort $buildPath && docker build --build-arg GIT_COMMIT=$commitSha --platform ${OTHER_PLATFORM:-linux/aarch64} -t openremote/manager:$commitShaShort $buildPath"fi@@ -531,10 +514,10 @@ jobs:echo "value=$command" >> $GITHUB_OUTPUTenv:MAVEN_TAG: ${{ steps.ci-cd-output.outputs.mavenTag }}- MAVEN_SIGNING_PASSWORD: ${{ steps.inputs-and-secrets.outputs._TEMP_MAVEN_SIGNING_PASSWORD }}- MAVEN_SIGNING_KEY: ${{ steps.inputs-and-secrets.outputs._TEMP_MAVEN_SIGNING_KEY }}- MAVEN_USERNAME: ${{ steps.inputs-and-secrets.outputs._TEMP_MAVEN_USERNAME }}- MAVEN_PASSWORD: ${{ steps.inputs-and-secrets.outputs._TEMP_MAVEN_PASSWORD }}+ MAVEN_SIGNING_PASSWORD: ${{ secrets._TEMP_MAVEN_SIGNING_PASSWORD }}+ MAVEN_SIGNING_KEY: ${{ secrets._TEMP_MAVEN_SIGNING_KEY }}+ MAVEN_USERNAME: ${{ secrets._TEMP_MAVEN_USERNAME }}+ MAVEN_PASSWORD: ${{ secrets._TEMP_MAVEN_PASSWORD }}- name: Define maven release commandid: maven-release-command@@ -544,8 +527,8 @@ jobs:command="./gradlew findSonatypeStagingRepository closeAndReleaseSonatypeStagingRepository -PpublishUsername=$MAVEN_USERNAME -PpublishPassword=$MAVEN_PASSWORD"echo "value=$command" >> $GITHUB_OUTPUTenv:- MAVEN_USERNAME: ${{ steps.inputs-and-secrets.outputs._TEMP_MAVEN_USERNAME }}- MAVEN_PASSWORD: ${{ steps.inputs-and-secrets.outputs._TEMP_MAVEN_PASSWORD }}+ MAVEN_USERNAME: ${{ secrets._TEMP_MAVEN_USERNAME }}+ MAVEN_PASSWORD: ${{ secrets._TEMP_MAVEN_PASSWORD }}- name: Define deployment docker build commandid: deployment-docker-command@@ -590,15 +573,15 @@ jobs:if: ${{ steps.manager-docker-command.outputs.pushToDockerHub == 'true' }}uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0with:- username: ${{ steps.inputs-and-secrets.outputs._TEMP_DOCKERHUB_USER }}- password: ${{ steps.inputs-and-secrets.outputs._TEMP_DOCKERHUB_PASSWORD }}+ username: ${{ secrets._TEMP_DOCKERHUB_USER }}+ password: ${{ secrets._TEMP_DOCKERHUB_PASSWORD }}- name: Configure AWS Credentialsif: ${{ steps.deployments.outputs.pushSnapshot == 'true' }}uses: aws-actions/configure-aws-credentials@ec61189d14ec14c8efccab744f656cffd0e33f37 # v6.1.0with:aws-region: eu-west-1- role-to-assume: "arn:aws:iam::${{ steps.inputs-and-secrets.outputs.OR_AWS_DEVELOPERS_ACCOUNT_ID }}:role/${{ steps.inputs-and-secrets.outputs.OR_GH_AWS_ECR_PUSH_ROLE }}"+ role-to-assume: "arn:aws:iam::${{ secrets.OR_AWS_DEVELOPERS_ACCOUNT_ID }}:role/${{ secrets.OR_GH_AWS_ECR_PUSH_ROLE }}"- name: Login to private ECRif: ${{ steps.deployments.outputs.pushSnapshot == 'true' }}@@ -776,40 +759,9 @@ jobs:- name: Run install distif: steps.install-command.outputs.value != ''- shell: python- run: |- import json- import os- import sys- import subprocess-- inputsAndSecrets = json.loads(os.getenv("INPUTS_AND_SECRETS"))-- # Output inputs and secrets as environment variables for build- for key, value in inputsAndSecrets.items():- if "." in key:- continue-- # Look for temp and env prefixed keys- if key.startswith("_"):- if key.startswith("_TEMP_"):- key = key.replace("_TEMP_", "")- else:- continue-- os.system(f"echo 'Setting environment variable {key}...'")- os.putenv(key, value)-- buildCmd = os.getenv("CMD")- result = subprocess.run(f"{buildCmd}", shell=True)-- if result.returncode != 0:- os.system("echo 'installDist failed'")- sys.exit(result.returncode)-+ run: ${{ steps.install-command.outputs.value }}env:- CMD: ${{ steps.install-command.outputs.value }}- INPUTS_AND_SECRETS: ${{ toJSON(steps.inputs-and-secrets.outputs) }}+ GFE_PASSWORD: ${{ secrets._TEMP_GFE_PASSWORD }}timeout-minutes: 20- name: Run NPM publish dry run@@ -915,7 +867,7 @@ jobs:yarn workspaces foreach --all --no-private --topological npm publish --tag $TAGenv:- NPM_AUTH_TOKEN: ${{ steps.inputs-and-secrets.outputs._TEMP_NPM_AUTH_TOKEN }}+ NPM_AUTH_TOKEN: ${{ secrets._TEMP_NPM_AUTH_TOKEN }}TAG: ${{ steps.update-package-json-files.outputs.tag }}- name: Run deployment docker command@@ -945,7 +897,9 @@ jobs:managerRef = os.getenv("MANAGER_REF")deploymentRef = os.getenv("DEPLOYMENT_REF")isMainRepo = os.getenv("IS_MAIN_REPO") == 'true'- inputsAndSecrets = json.loads(os.getenv("INPUTS_AND_SECRETS"))+ inputs = json.loads(os.getenv("INPUTS", "{}"))+ secrets = json.loads(os.getenv("SECRETS", "{}"))+ inputsAndSecrets = inputs | secretsipv4 = os.getenv("IPV4")ipv6 = os.getenv("IPV6")@@ -1065,7 +1019,8 @@ jobs:DEPLOYMENT_DOCKER_BUILD_PATH: ${{ steps.deployment-docker-command.outputs.buildPath }}MANAGER_REF: ${{ steps.manager-docker-command.outputs.refTag }}DEPLOYMENT_REF: ${{ steps.deployment-docker-command.outputs.refTag }}- INPUTS_AND_SECRETS: ${{ toJSON(steps.inputs-and-secrets.outputs) }}+ INPUTS: ${{ toJSON(steps.process-inputs.outputs) }}+ SECRETS: ${{ toJSON(secrets) }}IPV4: ${{ steps.ip-address.outputs.ipv4 }}IPV6: ${{ steps.ip-address.outputs.ipv6 }}