Fix executionspace image reference in Github action #39
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and push | |
on: | |
pull_request_target: | |
branches: [ "main" ] | |
types: | |
- closed | |
workflow_dispatch: | |
jobs: | |
build_api: | |
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build app image | |
run: docker build . --tag image | |
- name: Log into registry | |
run: echo "${{ secrets.REGISTRYPASSWORD }}" | docker login registry.nordix.org -u ${{ secrets.REGISTRYUSERNAME }} --password-stdin | |
- name: Push app image | |
id: image | |
run: | | |
IMAGE_ID=registry.nordix.org/eiffel/etos-api | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# Use Docker `latest` tag convention | |
[ "$VERSION" == "main" ] && VERSION=$(echo ${{ github.sha }} | cut -c1-8) | |
echo IMAGE_ID=$IMAGE_ID | |
echo VERSION=$VERSION | |
docker tag image $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:$VERSION | |
echo $IMAGE_ID:$VERSION | |
echo "::set-output name=version::$VERSION" | |
outputs: | |
apiVersion: ${{ steps.image.outputs.version }} | |
build_sse: | |
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build app image | |
run: docker build . -f deploy/etos-sse/Dockerfile --tag image | |
- name: Log into registry | |
run: echo "${{ secrets.REGISTRYPASSWORD }}" | docker login registry.nordix.org -u ${{ secrets.REGISTRYUSERNAME }} --password-stdin | |
- name: Push app image | |
id: image | |
run: | | |
IMAGE_ID=registry.nordix.org/eiffel/etos-sse | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# Use Docker `latest` tag convention | |
[ "$VERSION" == "main" ] && VERSION=$(echo ${{ github.sha }} | cut -c1-8) | |
echo IMAGE_ID=$IMAGE_ID | |
echo VERSION=$VERSION | |
docker tag image $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:$VERSION | |
echo $IMAGE_ID:$VERSION | |
echo "::set-output name=version::$VERSION" | |
outputs: | |
sseVersion: ${{ steps.image.outputs.version }} | |
build_logarea: | |
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build app image | |
run: docker build . -f deploy/etos-logarea/Dockerfile --tag image | |
- name: Log into registry | |
run: echo "${{ secrets.REGISTRYPASSWORD }}" | docker login registry.nordix.org -u ${{ secrets.REGISTRYUSERNAME }} --password-stdin | |
- name: Push app image | |
id: image | |
run: | | |
IMAGE_ID=registry.nordix.org/eiffel/etos-logarea | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# Use Docker `latest` tag convention | |
[ "$VERSION" == "main" ] && VERSION=$(echo ${{ github.sha }} | cut -c1-8) | |
echo IMAGE_ID=$IMAGE_ID | |
echo VERSION=$VERSION | |
docker tag image $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:$VERSION | |
echo $IMAGE_ID:$VERSION | |
echo "::set-output name=version::$VERSION" | |
outputs: | |
logAreaVersion: ${{ steps.image.outputs.version }} | |
build_iut: | |
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build app image | |
run: docker build . -f deploy/etos-iut/Dockerfile --tag image | |
- name: Log into registry | |
run: echo "${{ secrets.REGISTRYPASSWORD }}" | docker login registry.nordix.org -u ${{ secrets.REGISTRYUSERNAME }} --password-stdin | |
- name: Push app image | |
id: image | |
run: | | |
IMAGE_ID=registry.nordix.org/eiffel/etos-iut | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# Use Docker `latest` tag convention | |
[ "$VERSION" == "main" ] && VERSION=$(echo ${{ github.sha }} | cut -c1-8) | |
echo IMAGE_ID=$IMAGE_ID | |
echo VERSION=$VERSION | |
docker tag image $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:$VERSION | |
echo $IMAGE_ID:$VERSION | |
echo "::set-output name=version::$VERSION" | |
outputs: | |
iutVersion: ${{ steps.image.outputs.version }} | |
build_executionspace: | |
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build app image | |
run: docker build . -f deploy/etos-executionspace/Dockerfile --tag image | |
- name: Log into registry | |
run: echo "${{ secrets.REGISTRYPASSWORD }}" | docker login registry.nordix.org -u ${{ secrets.REGISTRYUSERNAME }} --password-stdin | |
- name: Push app image | |
id: image | |
run: | | |
IMAGE_ID=registry.nordix.org/eiffel/etos-executionspace | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# Use Docker `latest` tag convention | |
[ "$VERSION" == "main" ] && VERSION=$(echo ${{ github.sha }} | cut -c1-8) | |
echo IMAGE_ID=$IMAGE_ID | |
echo VERSION=$VERSION | |
docker tag image $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:$VERSION | |
echo $IMAGE_ID:$VERSION | |
echo "::set-output name=version::$VERSION" | |
outputs: | |
executionSpaceVersion: ${{ 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_sse, build_logarea, build_iut, build_executionspace] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Update manifests | |
uses: fjogeleit/yaml-update-action@main | |
with: | |
changes: | | |
{ | |
"manifests/base/sse/deployment.yaml": { | |
"spec.template.spec.containers[0].image": "registry.nordix.org/eiffel/etos-sse:${{ needs.build_sse.outputs.sseVersion }}" | |
}, | |
"manifests/base/deployment.yaml": { | |
"spec.template.spec.containers[0].image": "registry.nordix.org/eiffel/etos-api:${{ needs.build_api.outputs.apiVersion }}" | |
}, | |
"manifests/base/logarea/deployment.yaml": { | |
"spec.template.spec.containers[0].image": "registry.nordix.org/eiffel/etos-logarea:${{ needs.build_logarea.outputs.logAreaVersion }}" | |
}, | |
"manifests/base/iut/deployment.yaml": { | |
"spec.template.spec.containers[0].image": "registry.nordix.org/eiffel/etos-iut:${{ needs.build_iut.outputs.iutVersion }}" | |
}, | |
"manifests/base/executionspace/deployment.yaml": { | |
"spec.template.spec.containers[0].image": "registry.nordix.org/eiffel/etos-executionspace:${{ needs.build_executionspace.outputs.executionSpaceVersion }}" | |
} | |
} | |
branch: main | |
commitChange: true | |
message: | | |
Updating ETOS images: | |
- SSE: ${{ needs.build_sse.outputs.sseVersion }} | |
- LogArea: ${{ needs.build_logarea.outputs.logAreaVersion }} | |
- IUT: ${{ needs.build_iut.outputs.iutVersion }} | |
- Execution Space: ${{ needs.build_executionspace.outputs.executionSpaceVersion }} | |
- API: ${{ needs.build_api.outputs.apiVersion }} |