Skip to content

Commit 5c3ddf0

Browse files
benknutson-googlermuthiah
authored andcommitted
Refactor Github Action per b/485167538
1 parent 78cc4ac commit 5c3ddf0

4 files changed

Lines changed: 11 additions & 9 deletions

File tree

.github/workflows/artifacts.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ jobs:
2020
echo "x86_64_image_path=orchestration-image-x86_64-${short_sha}.tar" >> $GITHUB_ENV
2121
echo "image_name=cuttlefish-orchestration:${short_sha}" >> $GITHUB_ENV
2222
- name: Build docker image
23-
run: docker/image-builder.sh -t ${{ env.image_name }}
23+
run: docker/image-builder.sh -t ${IMAGE_NAME}
2424
- name: Save docker image
25-
run: docker save --output ${{ env.x86_64_image_path }} ${{ env.image_name }}
25+
run: docker save --output ${X86_64_IMAGE_PATH} ${IMAGE_NAME}
2626
- name: Publish docker image
2727
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # aka v4.0.0
2828
with:
@@ -39,9 +39,9 @@ jobs:
3939
echo "arm64_image_path=orchestration-image-arm64-${short_sha}.tar" >> $GITHUB_ENV
4040
echo "image_name=cuttlefish-orchestration:${short_sha}" >> $GITHUB_ENV
4141
- name: Build docker image
42-
run: docker/image-builder.sh -t ${{ env.image_name }}
42+
run: docker/image-builder.sh -t ${IMAGE_NAME}
4343
- name: Save docker image
44-
run: docker save --output ${{ env.arm64_image_path }} ${{ env.image_name }}
44+
run: docker save --output ${ARM64_IMAGE_PATH} ${IMAGE_NAME}
4545
- name: Publish docker image
4646
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # aka v4.0.0
4747
with:

.github/workflows/host-image-ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ jobs:
3737
- name: Prepare building environment
3838
run: apt-get update && apt-get upgrade -y && apt-get install -y sudo wget libarchive-tools xorriso cpio xz-utils fdisk
3939
- name: Inject name and ID into preseed
40-
run: echo "CI_PROJECT_NAME=${{ github.event.repository.name }}" >> tools/cuttlefish-host-image-installer/preseed/after_install_1.sh && echo "CI_PIPELINE_ID=${{ github.repository}}/${{ github.workflow }}" >> tools/cuttlefish-host-image-installer/preseed//after_install_1.sh
40+
run: echo "CI_PROJECT_NAME=${GITHUB_EVENT_REPOSITORY_NAME}" >> tools/cuttlefish-host-image-installer/preseed/after_install_1.sh && echo "CI_PIPELINE_ID=${{ github.repository}}/${GITHUB_WORKFLOW}" >> tools/cuttlefish-host-image-installer/preseed//after_install_1.sh
41+
env:
42+
GITHUB_EVENT_REPOSITORY_NAME: ${{ github.event.repository.name }}
4143
- name: Download Debian installer
4244
run: cd tools/cuttlefish-host-image-installer && wget -nv -c ${DEBIAN_ISO_URL} && ./addpreseed.sh && xz -9e preseed-mini.iso
4345
- name: Publish preseed-mini.iso.xz

.github/workflows/presubmit.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ jobs:
174174
cat .config/cache-config.env >> $GITHUB_ENV
175175
echo "JOB_HASH=$(yq .jobs[\"run-cvd-unit-tests\"] .github/workflows/presubmit.yaml | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
176176
- name: Generate cache key prefix
177-
run: echo "CACHE_KEY_PREFIX=${{ runner.os }}-${{ runner.arch }}-bazel-disk-cache-${{ env.CACHE_VERSION }}-unit-test-${{ env.JOB_HASH }}" >> $GITHUB_ENV
177+
run: echo "CACHE_KEY_PREFIX=${{ runner.os }}-${{ runner.arch }}-bazel-disk-cache-${CACHE_VERSION}-unit-test-${JOB_HASH}" >> $GITHUB_ENV
178178
- name: Mount Bazel cache
179179
uses: actions/cache/restore@v4
180180
with:
@@ -216,7 +216,7 @@ jobs:
216216
cat android-cuttlefish/.config/cache-config.env >> $GITHUB_ENV
217217
echo "JOB_HASH=$(yq .jobs[\"build-debian-package\"] android-cuttlefish/.github/workflows/presubmit.yaml | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
218218
- name: Generate cache key prefix
219-
run: echo "CACHE_KEY_PREFIX=${{ runner.os }}-${{ runner.arch }}-bazel-disk-cache-${{ env.CACHE_VERSION }}-debian-package-${{ env.JOB_HASH }}" >> $GITHUB_ENV
219+
run: echo "CACHE_KEY_PREFIX=${{ runner.os }}-${{ runner.arch }}-bazel-disk-cache-${CACHE_VERSION}-debian-package-${JOB_HASH}" >> $GITHUB_ENV
220220
- name: Mount Bazel cache
221221
uses: actions/cache/restore@v4
222222
with:

.github/workflows/update-bazel-cache.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
cat .config/cache-config.env >> $GITHUB_ENV
2828
echo "JOB_HASH=$(yq .jobs[\"run-cvd-unit-tests\"] .github/workflows/presubmit.yaml | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
2929
- name: Generate cache key prefix
30-
run: echo "CACHE_KEY_PREFIX=${{ runner.os }}-${{ runner.arch }}-bazel-disk-cache-${{ env.CACHE_VERSION }}-unit-test-${{ env.JOB_HASH }}" >> $GITHUB_ENV
30+
run: echo "CACHE_KEY_PREFIX=${{ runner.os }}-${{ runner.arch }}-bazel-disk-cache-${CACHE_VERSION}-unit-test-${JOB_HASH}" >> $GITHUB_ENV
3131
- name: Mount Bazel cache
3232
uses: actions/cache@v4
3333
with:
@@ -64,7 +64,7 @@ jobs:
6464
cat android-cuttlefish/.config/cache-config.env >> $GITHUB_ENV
6565
echo "JOB_HASH=$(yq .jobs[\"build-debian-package\"] android-cuttlefish/.github/workflows/presubmit.yaml | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
6666
- name: Generate cache key prefix
67-
run: echo "CACHE_KEY_PREFIX=${{ runner.os }}-${{ runner.arch }}-bazel-disk-cache-${{ env.CACHE_VERSION }}-debian-package-${{ env.JOB_HASH }}" >> $GITHUB_ENV
67+
run: echo "CACHE_KEY_PREFIX=${{ runner.os }}-${{ runner.arch }}-bazel-disk-cache-${CACHE_VERSION}-debian-package-${JOB_HASH}" >> $GITHUB_ENV
6868
- name: Mount Bazel cache
6969
uses: actions/cache@v4
7070
with:

0 commit comments

Comments
 (0)