Hello, I have been writing a config.yml file to retrieve release_id after writing into balena board. and to retrieve the short_sha_hash. The goal is to be able to execute the following line:
balena tag set EDGE1_SHA $SHORT_GIT_HASH --release $RELEASE_ID
The code is as follows:
version: 2
jobs:
build:
working_directory: ~/docker-edge1
docker:
- image: 770136283015.dkr.ecr.us-west-2.amazonaws.com/build-tools:balena
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: balena login
command: |
balena login --token BALENA_TOKEN
- run:
name: Push to Target Balena triggering balena cloud server
command: |
balena push Edge1CI | grep "Release:" > /tmp/output-file.txt
- run:
name: Print the content
command: |
cat /tmp/output-file.txt
- run:
name: Retrieve Release_id and Set the Tag
command: |
RELEASE_ID="(cut -c 36-47 /tmp/output-file.txt)"
SHORT_GIT_HASH="$(git rev-parse --short=7 HEAD)"
echo $SHORT_GIT_HASH
echo $RELEASE_ID
balena tag set EDGE1_SHA $SHORT_GIT_HASH --release $RELEASE_ID
workflows:
version: 2
build:
jobs:
- build:
context: skycatch
filters:
branches:
only:
- /release/./
- /feature/./
Executing this on Circleci , I verify that both short_sha_hash and released id is retrieve by echoing the variables. However the code fails when executing the last line:
balena tag set EDGE1_SHA $SHORT_GIT_HASH --release $RELEASE_ID
208ce95
5afbe25
BalenaReleaseNotFound: Release not found: 5afbe25
Additional information may be available by setting a DEBUG=1 environment
variable: “set DEBUG=1” on a Windows command prompt, or “export DEBUG=1”
on Linux or macOS.
Thank you! I tried the following command, but it returned me the commit ID. I need release ID to perform the balena tag set EDGE1_SHA $SHORT_GIT_HASH --release $RELEASE_ID
when executing balena app , I got the following info:
== EDGE1 CI
ID: 1539122
DEVICE TYPE: skx2
COMMIT: bc0b5c3959567f8382aefbd381ce17190eb8bd98
I thought 1539122 was the release id but it wasn’t . The release id was:
[Info] Release: 4c30d2d563f749895ea4efa8b4020d82 (id: 1321271) and this is what I got from executing the code in circle ci:
603dc66
1539122
BalenaReleaseNotFound: Release not found: 1539122
Additional information may be available by setting a DEBUG=1 environment
variable: “set DEBUG=1” on a Windows command prompt, or “export DEBUG=1”
on Linux or macOS.
You can also take a look in the portal to see if the latest release ID there corresponds with the release ID in the COMMIT field output of balena-cli app 1539122. Then, run balena tag ${GIT_HASH} --release ${RELEASE_ID}, where ${RELEASE_ID} is either bc0b5c3 or 4c30d2d from your examples (using the short form, which I’ve retested and found to be working).
I did but commit ID is different with release id. Today, was my last day at skycatch, so I have no access to the system to proceed. Thank you for all the help