Skip to content

Commit

Permalink
Add secrets input
Browse files Browse the repository at this point in the history
Use Git as default context

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
CrazyMax committed Sep 2, 2020
1 parent bd6a018 commit f295fbf
Show file tree
Hide file tree
Showing 11 changed files with 16,746 additions and 3,474 deletions.
72 changes: 35 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ on:
- v2-working-branch # remove when merged to master

jobs:
single:
git-context:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
buildx-version:
- ""
- latest
steps:
-
Expand Down Expand Up @@ -45,14 +44,16 @@ jobs:
id: docker_build
uses: ./
with:
context: ./test
file: ./test/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64
allow: network.host,security.insecure
push: true
tags: |
localhost:5000/name/app:latest
localhost:5000/name/app:1.0.0
secrets: |
GIT_AUTH_TOKEN=${{ github.token }}
-
name: Inspect
run: |
Expand All @@ -65,17 +66,14 @@ jobs:
if: always()
uses: crazy-max/ghaction-dump-context@v1

multi:
path-context:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
buildx-version:
- ""
- latest
dockerfile:
- multi
- multi-sudo
steps:
-
name: Run local registry
Expand Down Expand Up @@ -103,9 +101,8 @@ jobs:
uses: ./
with:
context: ./test
file: ./test/Dockerfile-${{ matrix.dockerfile }}
file: ./test/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64
allow: network.host,security.insecure
push: true
tags: |
Expand All @@ -123,8 +120,17 @@ jobs:
if: always()
uses: crazy-max/ghaction-dump-context@v1

github-cache:
multi:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
buildx-version:
- ""
- latest
dockerfile:
- multi
- multi-sudo
steps:
-
name: Run local registry
Expand All @@ -143,56 +149,37 @@ jobs:
id: buildx
uses: docker/setup-buildx-action@master
with:
version: ${{ matrix.buildx-version }}
driver-opt: network=host
buildkitd-flags: --allow-insecure-entitlement security.insecure
-
name: Cache Docker layers
uses: actions/cache@v2
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
-
name: Build and push
id: docker_build
uses: ./
with:
context: ./test
file: ./test/Dockerfile-multi-golang
file: ./test/Dockerfile-${{ matrix.dockerfile }}
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64
allow: network.host,security.insecure
push: true
tags: |
localhost:5000/name/app:latest
localhost:5000/name/app:1.0.0
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
-
name: Inspect
run: |
docker buildx imagetools inspect localhost:5000/name/app:1.0.0
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
-
name: Cache hit
run: echo ${{ steps.cache.outputs.cache-hit }}
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v1

git-context:
github-cache:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
buildx-version:
#- "" # GIT_AUTH_TOKEN not available in the current version on the GitHub Runner
- latest
steps:
-
name: Run local registry
Expand All @@ -211,32 +198,43 @@ jobs:
id: buildx
uses: docker/setup-buildx-action@master
with:
version: ${{ matrix.buildx-version }}
driver-opt: network=host
buildkitd-flags: --allow-insecure-entitlement security.insecure
-
name: Cache Docker layers
uses: actions/cache@v2
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
-
name: Build and push
id: docker_build
uses: ./
env:
GIT_AUTH_TOKEN: ${{ github.token }}
with:
context: "${{ github.repositoryUrl }}#${{ github.ref }}"
file: ./test/Dockerfile
context: ./test
file: ./test/Dockerfile-multi-golang
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64
allow: network.host,security.insecure
push: true
tags: |
localhost:5000/name/app:latest
localhost:5000/name/app:1.0.0
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
-
name: Inspect
run: |
docker buildx imagetools inspect localhost:5000/name/app:1.0.0
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
-
name: Cache hit
run: echo ${{ steps.cache.outputs.cache-hit }}
-
name: Dump context
if: always()
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## 2.0.0 (2020/08/??)
## 2.0.0 (2020/??/??)

v2 of Build Push action uses Docker [Buildx](https://github.com/docker/buildx). It's also rewritten as
a [typescript-action](https://github.com/actions/typescript-action/) to be as closed as possible of
Expand All @@ -16,6 +16,7 @@ the [GitHub Runner](https://github.com/actions/virtual-environments) during its
* Add [`outputs`](https://github.com/docker/buildx#-o---outputpath-typetypekeyvalue) input
* Add [`cache-from`](https://github.com/docker/buildx#--cache-fromnametypetypekeyvalue) input
* Add [`cache-to`](https://github.com/docker/buildx#--cache-tonametypetypekeyvalue) input
* Add `secrets` input
* Review `tags` input
* Remove `repository`, `username`, `password`, `registry`, `cache_froms` inputs
* Remove `tag_with_sha`, `tag_with_ref`, `add_git_labels` inputs
Expand Down
Loading

0 comments on commit f295fbf

Please sign in to comment.