Skip to content

Commit

Permalink
Change image handling
Browse files Browse the repository at this point in the history
Do not attempt upload to ghcr.io on pull request
  • Loading branch information
erikbosch committed Jun 28, 2024
1 parent afb7c28 commit 6649c45
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 18 deletions.
37 changes: 24 additions & 13 deletions .github/workflows/build-base-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
uses: actions/checkout@v4

- name: Run Linters
uses: pre-commit/[email protected].0
uses: pre-commit/[email protected].1

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand All @@ -54,23 +54,28 @@ jobs:
with:
version: v0.9.0

- name: Get image tag
id: get-tag
shell: bash
run: |
TAGS=${{ github.sha }}
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
TAGS="${TAGS},latest"
fi
echo "tag=${{ github.sha }}" >> $GITHUB_OUTPUT
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
- id: github-repository-name-case-adjusted
name: Prepare repository name in lower case for docker upload.
uses: ASzc/change-string-case-action@v6
with:
string: ${{ github.repository }}

- name: Decide on upload strategy
id: get-tag
shell: bash
run: |
if [[ ("${{ github.event_name }}" == "pull_request") ]] ; then
TAGS=${{ github.sha }}
IMAGE_NAME=ttl.sh/eclipse-velocitas/${{ steps.github-repository-name-case-adjusted.outputs.lowercase }}/${{ matrix.image }}
echo "push_ttl=true" >> $GITHUB_OUTPUT
else
TAGS="latest"
IMAGE_NAME=ghcr.io/${{ steps.github-repository-name-case-adjusted.outputs.lowercase }}/${{ matrix.image }}
echo "push_ttl=false" >> $GITHUB_OUTPUT
fi
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
echo "image_name=${IMAGE_NAME}" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
Expand All @@ -82,13 +87,19 @@ jobs:
id: image_build
uses: devcontainers/[email protected]
with:
imageName: ghcr.io/${{ steps.github-repository-name-case-adjusted.outputs.lowercase }}/${{ matrix.image }}
imageName: ${{ steps.get-tag.outputs.image_name }}
imageTag: ${{ steps.get-tag.outputs.tags }}
push: always
platform: linux/amd64,linux/arm64
noCache: true
subFolder: ./Dockerfiles/${{ matrix.image }}/

- name: Posting ttl.sh message
if: steps.get-tag.outputs.push_ttl == 'true'
uses: eclipse-kuksa/kuksa-actions/post-container-location@4
with:
image: ${{ steps.get-tag.outputs.image_name }}:${{ steps.get-tag.outputs.tags }}

generate-sbom:
name: Generate SBOM
runs-on: ubuntu-22.04
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/check-licenses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,27 @@ jobs:
generate-dash: true

- name: Setup Java JDK
uses: actions/setup-java@v3.13.0
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Run dash
shell: bash
continue-on-error: true
env:
GITLAB_TOKEN:
run: |
wget -O dash.jar "https://repo.eclipse.org/content/repositories/dash-licenses/org/eclipse/dash/org.eclipse.dash.licenses/1.0.2/org.eclipse.dash.licenses-1.0.2.jar"
java -jar dash.jar -project automotive.velocitas -review -token ${{ secrets.GITLAB_API_TOKEN }} -summary DEPENDENCIES clearlydefined.input 2> output.log
if [[ -n "${{ secrets.GITLAB_API_TOKEN }}" ]]; then
echo -e "Dash token available. Will create tickets when required. \n " >> $GITHUB_STEP_SUMMARY
java -jar dash.jar -project automotive.velocitas -review -token ${{ secrets.GITLAB_API_TOKEN }} -summary DEPENDENCIES clearlydefined.input > dash.out 2>&1 || true
else
echo -e "Dash token not available. Will perform checking only. \n " >> $GITHUB_STEP_SUMMARY
java -jar dash.jar -project automotive.velocitas -summary DEPENDENCIES clearlydefined.input > dash.out 2>&1 || true
fi
echo -e "Dash output: \n\`\`\` " >> $GITHUB_STEP_SUMMARY
cat dash.out >> $GITHUB_STEP_SUMMARY
echo -e "\n\`\`\`"
- name: Upload dash input/output as artifacts
uses: actions/upload-artifact@v4
Expand Down
5 changes: 3 additions & 2 deletions NOTICE-3RD-PARTY-CONTENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
| Dependency | Version | License |
|:-----------|:-------:|--------:|
|actions/checkout|v4|MIT License|
|actions/setup-java|v3.13.0|MIT License|
|actions/setup-java|v4|MIT License|
|actions/upload-artifact|v4|MIT License|
|ASzc/change-string-case-action|v6|ISC License|
|devcontainers/ci|v0.3|MIT License|
|docker/login-action|v3|Apache License 2.0|
|docker/setup-buildx-action|v3|Apache License 2.0|
|docker/setup-qemu-action|v3|Apache License 2.0|
|eclipse-kuksa/kuksa-actions|4|Apache License 2.0|
|EndBug/add-and-commit|v9|MIT License|
|fountainhead/action-wait-for-check|v1.2.0|MIT License|
|pre-commit/action|v3.0.0|MIT License|
|pre-commit/action|v3.0.1|MIT License|

0 comments on commit 6649c45

Please sign in to comment.