8000 Cache SDK Images As Artifacts by nigthknight · Pull Request #655 · secureCodeBox/secureCodeBox · GitHub
[go: up one dir, main page]

Skip to content
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
74 changes: 50 additions & 24 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -272,33 +272,20 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Docker Meta
id: docker_meta
uses: docker/metadata-action@v3
with:
images: ${{ env.DOCKER_NAMESPACE }}/${{ matrix.sdk }}-nodejs
tags: |
type=sha
type=semver,pattern={{version}}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build Image
working-directory: ./${{ matrix.sdk }}/nodejs
run: make docker-build-sdk

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Export Image
working-directory: ./${{ matrix.sdk }}/nodejs
run: make docker-export-sdk

- name: Build and Push
uses: docker/build-push-action@v2
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
context: ./${{ matrix.sdk }}/nodejs
file: ./${{ matrix.sdk }}/nodejs/Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
name: ${{ matrix.sdk }}-image
path: ./${{ matrix.sdk }}/nodejs/${{ matrix.sdk }}.tar
retention-days: 1

# ---- New Makefile based CI Pipeline steps ----

Expand Down Expand Up @@ -346,13 +333,26 @@ jobs:

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver: docker

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Download Parser SDK Image
uses: actions/download-artifact@v2
with:
name: parser-sdk-image
path: /tmp

- name: Load Parser SDK Image
run: |
docker load --input /tmp/parser-sdk.tar
docker images | grep sdk

- name: Build
uses: docker/build-push-action@v2
with:
Expand Down Expand Up @@ -433,6 +433,8 @@ jobs:

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver: docker

- name: Login to DockerHub
uses: docker/login-action@v1
Expand All @@ -444,6 +446,17 @@ jobs:
run: |
echo "baseImageTag=sha-$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Download Hook SDK Image
uses: actions/download-artifact@v2
with:
name: hook-sdk-image
path: /tmp

- name: Load Hook SDK Image
run: |
docker load --input /tmp/hook-sdk.tar
docker images | grep sdk

- name: Build and Push
uses: docker/build-push-action@v2
with:
Expand Down Expand Up @@ -508,6 +521,8 @@ jobs:

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver: docker

- name: Login to DockerHub
uses: docker/login-action@v1
Expand All @@ -519,6 +534,17 @@ jobs:
run: |
echo "baseImageTag=sha-$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Download Parser SDK Image
uses: actions/download-artifact@v2
with:
name: parser-sdk-image
path: /tmp

- name: Load Parser SDK Image
run: |
docker load --input /tmp/parser-sdk.tar
docker images | grep sdk

- name: Build and Push
uses: docker/build-push-action@v2
with:
Expand Down
3 changes: 3 additions & 0 deletions hook-sdk/nodejs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sdk = hook-sdk
include_guard = set
include ../../sdk.mk
3 changes: 3 additions & 0 deletions parser-sdk/nodejs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sdk = parser-sdk
include_guard = set
include ../../sdk.mk
32 changes: 32 additions & 0 deletions sdk.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/make -f
#
# SPDX-FileCopyrightText: 2021 iteratec GmbH
#
# SPDX-License-Identifier: Apache-2.0
#
#
# This Makefile is intended to be used for developement and testing only.
# For using this scanner/hook in production please use the helm chart.
# See: <https://docs.securecodebox.io/docs/getting-started/installation>
#
# This Makefile expects some additional software to be installed:
# - git
# - node + npm
# - docker
# - kind
# - kubectl
# - helm
# - yq


name = ${sdk}
module = ${sdk}
include ../../common.mk

docker-build-sdk:
@echo ".: ⚙️ Build '$(name)'."
docker build -t $(IMG_NS)/$(name)-nodejs:$(IMG_TAG) .

docker-export-sdk:
@echo ".: ⚙️ Build '$(name)'."
docker save $(IMG_NS)/$(name)-nodejs:$(IMG_TAG) -o $(name).tar
0