Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print step's output paramaters also to sdtout #389

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
- name: Get Date
id: get-date
run: |
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
echo "date=$(/bin/date -u "+%Y%m%d")" | tee -a $GITHUB_OUTPUT
shell: bash

- uses: actions/cache@v2
Expand All @@ -106,7 +106,6 @@ jobs:
commit_sha=$(git rev-parse --short HEAD)
ve1/bin/build-and-test --image-name="quay.io/redhat-certification/chart-verifier" --sha-value=$commit_sha --build-only="True"}


- name: Build podman Image
working-directory: ./chart-verifier
id: build_podman_image
Expand All @@ -117,7 +116,7 @@ jobs:
image_tag="podman-"$commit_sha
echo "use image tag $image_tag"
podman build -t quay.io/redhat-certification/chart-verifier:$image_tag .
echo "podman_image_tag=$image_tag" >> $GITHUB_OUTPUT
echo "podman_image_tag=$image_tag" | tee -a $GITHUB_OUTPUT

- name: Create tarfile
id: create-tarfile
Expand All @@ -126,7 +125,6 @@ jobs:
# create test tarball for the tests
ve1/bin/tar-file --release="test"


- name: Login to oc
working-directory: ./chart-verifier
env:
Expand Down Expand Up @@ -211,7 +209,7 @@ jobs:
run: |
git fetch
export ORIGIN_MASTER_SHA=$(git rev-parse origin/master)
echo "origin_master_sha=$ORIGIN_MASTER_SHA" >> $GITHUB_OUTPUT
echo "origin_master_sha=$ORIGIN_MASTER_SHA" | tee -a $GITHUB_OUTPUT

- name: Create release tag
id: create_release_tag
Expand Down
14 changes: 11 additions & 3 deletions scripts/src/utils/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import os

def add_output(name,value):
with open(os.environ['GITHUB_OUTPUT'],'a') as fh:
print(f'{name}={value}',file=fh)
def add_output(key,value):
"""This function prints the key/value pair to stdout in a "key=value" format.

If called from a GitHub workflow, it also sets an output parameter.
"""

print(f'{key}={value}')

if "GITHUB_OUTPUT" in os.environ:
with open(os.environ['GITHUB_OUTPUT'],'a') as fh:
print(f'{key}={value}',file=fh)
Loading