From 9201ffb7ffc002332baf3ac791d78ec57e01be15 Mon Sep 17 00:00:00 2001 From: Tobias Persson Date: Mon, 27 Nov 2023 13:28:43 +0100 Subject: [PATCH] Fix a race condtion with git and workflow (#84) --- .github/workflows/build-push.yml | 33 +++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index 5619369..0906f92 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -35,15 +35,8 @@ jobs: docker push $IMAGE_ID:$VERSION echo $IMAGE_ID:$VERSION echo "::set-output name=version::$VERSION" - - name: Update manifests - uses: fjogeleit/yaml-update-action@main - with: - valueFile: 'manifests/base/api/deployment.yaml' - propertyPath: 'spec.template.spec.containers[0].image' - value: registry.nordix.org/eiffel/etos-environment-provider:${{ steps.image.outputs.version }} - branch: main - commitChange: true - message: Updating API manifest image to version ${{ steps.image.outputs.version }} + outputs: + apiVersion: ${{ steps.image.outputs.version }} build_worker: if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }} runs-on: ubuntu-latest @@ -71,12 +64,26 @@ jobs: docker push $IMAGE_ID:$VERSION echo $IMAGE_ID:$VERSION echo "::set-output name=version::$VERSION" + outputs: + workerVersion: ${{ steps.image.outputs.version }} + update_manifests: + if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }} + runs-on: ubuntu-latest + needs: [build_api, build_worker] + steps: + - uses: actions/checkout@v3 - name: Update manifests uses: fjogeleit/yaml-update-action@main with: - valueFile: 'manifests/base/worker/deployment.yaml' - propertyPath: 'spec.template.spec.containers[0].image' - value: registry.nordix.org/eiffel/etos-environment-provider-worker:${{ steps.image.outputs.version }} + changes: | + { + "manifests/base/worker/deployment.yaml": { + "spec.template.spec.containers[0].image": "registry.nordix.org/eiffel/etos-environment-provider-worker:${{ needs.build_worker.outputs.workerVersion }}" + }, + "manifests/base/api/deployment.yaml": { + "spec.template.spec.containers[0].image": "registry.nordix.org/eiffel/etos-environment-provider:${{ needs.build_api.outputs.apiVersion }}" + } + } branch: main commitChange: true - message: Updating SSE manifest image to version ${{ steps.image.outputs.version }} + message: Updating worker image to ${{ needs.build_worker.outputs.workerVersion }} and API image to ${{ needs.build_api.outputs.apiVersion }}