Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
leojonathanoh committed Aug 5, 2021
2 parents 51aac69 + 63889fd commit 4ec42f9
Show file tree
Hide file tree
Showing 31 changed files with 2,205 additions and 5,592 deletions.
4,125 changes: 1,823 additions & 2,302 deletions .github/workflows/ci-master-pr.yml

Large diffs are not rendered by default.

3,040 changes: 0 additions & 3,040 deletions .github/workflows/ci-release.yml

This file was deleted.

44 changes: 3 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,60 +10,22 @@ Dockerized `kubectl` with useful tools.

| Tag | Dockerfile Build Context |
|:-------:|:---------:|
| `:v1.21.0-alpine-3.8`, `:latest` | [View](variants/v1.21.0-alpine-3.8 ) |
| `:v1.21.0-envsubst-alpine-3.8` | [View](variants/v1.21.0-envsubst-alpine-3.8 ) |
| `:v1.21.0-git-alpine-3.8` | [View](variants/v1.21.0-git-alpine-3.8 ) |
| `:v1.21.0-jq-alpine-3.8` | [View](variants/v1.21.0-jq-alpine-3.8 ) |
| `:v1.21.0-kustomize-alpine-3.8` | [View](variants/v1.21.0-kustomize-alpine-3.8 ) |
| `:v1.21.0-ssh-alpine-3.8` | [View](variants/v1.21.0-ssh-alpine-3.8 ) |
| `:v1.22.0-alpine-3.8`, `:latest` | [View](variants/v1.22.0-alpine-3.8 ) |
| `:v1.22.0-envsubst-git-jq-kustomize-ssh-alpine-3.8` | [View](variants/v1.22.0-envsubst-git-jq-kustomize-ssh-alpine-3.8 ) |
| `:v1.21.0-alpine-3.8` | [View](variants/v1.21.0-alpine-3.8 ) |
| `:v1.21.0-envsubst-git-jq-kustomize-ssh-alpine-3.8` | [View](variants/v1.21.0-envsubst-git-jq-kustomize-ssh-alpine-3.8 ) |
| `:v1.20.4-alpine-3.8` | [View](variants/v1.20.4-alpine-3.8 ) |
| `:v1.20.4-envsubst-alpine-3.8` | [View](variants/v1.20.4-envsubst-alpine-3.8 ) |
| `:v1.20.4-git-alpine-3.8` | [View](variants/v1.20.4-git-alpine-3.8 ) |
| `:v1.20.4-jq-alpine-3.8` | [View](variants/v1.20.4-jq-alpine-3.8 ) |
| `:v1.20.4-kustomize-alpine-3.8` | [View](variants/v1.20.4-kustomize-alpine-3.8 ) |
| `:v1.20.4-ssh-alpine-3.8` | [View](variants/v1.20.4-ssh-alpine-3.8 ) |
| `:v1.20.4-envsubst-git-jq-kustomize-ssh-alpine-3.8` | [View](variants/v1.20.4-envsubst-git-jq-kustomize-ssh-alpine-3.8 ) |
| `:v1.19.7-alpine-3.8` | [View](variants/v1.19.7-alpine-3.8 ) |
| `:v1.19.7-envsubst-alpine-3.8` | [View](variants/v1.19.7-envsubst-alpine-3.8 ) |
| `:v1.19.7-git-alpine-3.8` | [View](variants/v1.19.7-git-alpine-3.8 ) |
| `:v1.19.7-jq-alpine-3.8` | [View](variants/v1.19.7-jq-alpine-3.8 ) |
| `:v1.19.7-kustomize-alpine-3.8` | [View](variants/v1.19.7-kustomize-alpine-3.8 ) |
| `:v1.19.7-ssh-alpine-3.8` | [View](variants/v1.19.7-ssh-alpine-3.8 ) |
| `:v1.19.7-envsubst-git-jq-kustomize-ssh-alpine-3.8` | [View](variants/v1.19.7-envsubst-git-jq-kustomize-ssh-alpine-3.8 ) |
| `:v1.18.15-alpine-3.8` | [View](variants/v1.18.15-alpine-3.8 ) |
| `:v1.18.15-envsubst-alpine-3.8` | [View](variants/v1.18.15-envsubst-alpine-3.8 ) |
| `:v1.18.15-git-alpine-3.8` | [View](variants/v1.18.15-git-alpine-3.8 ) |
| `:v1.18.15-jq-alpine-3.8` | [View](variants/v1.18.15-jq-alpine-3.8 ) |
| `:v1.18.15-kustomize-alpine-3.8` | [View](variants/v1.18.15-kustomize-alpine-3.8 ) |
| `:v1.18.15-ssh-alpine-3.8` | [View](variants/v1.18.15-ssh-alpine-3.8 ) |
| `:v1.18.15-envsubst-git-jq-kustomize-ssh-alpine-3.8` | [View](variants/v1.18.15-envsubst-git-jq-kustomize-ssh-alpine-3.8 ) |
| `:v1.17.17-alpine-3.8` | [View](variants/v1.17.17-alpine-3.8 ) |
| `:v1.17.17-envsubst-alpine-3.8` | [View](variants/v1.17.17-envsubst-alpine-3.8 ) |
| `:v1.17.17-git-alpine-3.8` | [View](variants/v1.17.17-git-alpine-3.8 ) |
| `:v1.17.17-jq-alpine-3.8` | [View](variants/v1.17.17-jq-alpine-3.8 ) |
| `:v1.17.17-kustomize-alpine-3.8` | [View](variants/v1.17.17-kustomize-alpine-3.8 ) |
| `:v1.17.17-ssh-alpine-3.8` | [View](variants/v1.17.17-ssh-alpine-3.8 ) |
| `:v1.17.17-envsubst-git-jq-kustomize-ssh-alpine-3.8` | [View](variants/v1.17.17-envsubst-git-jq-kustomize-ssh-alpine-3.8 ) |
| `:v1.16.15-alpine-3.8` | [View](variants/v1.16.15-alpine-3.8 ) |
| `:v1.16.15-envsubst-alpine-3.8` | [View](variants/v1.16.15-envsubst-alpine-3.8 ) |
| `:v1.16.15-git-alpine-3.8` | [View](variants/v1.16.15-git-alpine-3.8 ) |
| `:v1.16.15-jq-alpine-3.8` | [View](variants/v1.16.15-jq-alpine-3.8 ) |
| `:v1.16.15-kustomize-alpine-3.8` | [View](variants/v1.16.15-kustomize-alpine-3.8 ) |
| `:v1.16.15-ssh-alpine-3.8` | [View](variants/v1.16.15-ssh-alpine-3.8 ) |
| `:v1.16.15-envsubst-git-jq-kustomize-ssh-alpine-3.8` | [View](variants/v1.16.15-envsubst-git-jq-kustomize-ssh-alpine-3.8 ) |
| `:v1.15.12-alpine-3.8` | [View](variants/v1.15.12-alpine-3.8 ) |
| `:v1.15.12-envsubst-alpine-3.8` | [View](variants/v1.15.12-envsubst-alpine-3.8 ) |
| `:v1.15.12-git-alpine-3.8` | [View](variants/v1.15.12-git-alpine-3.8 ) |
| `:v1.15.12-jq-alpine-3.8` | [View](variants/v1.15.12-jq-alpine-3.8 ) |
| `:v1.15.12-kustomize-alpine-3.8` | [View](variants/v1.15.12-kustomize-alpine-3.8 ) |
| `:v1.15.12-ssh-alpine-3.8` | [View](variants/v1.15.12-ssh-alpine-3.8 ) |
| `:v1.15.12-envsubst-git-jq-kustomize-ssh-alpine-3.8` | [View](variants/v1.15.12-envsubst-git-jq-kustomize-ssh-alpine-3.8 ) |
| `:v1.14.10-alpine-3.8` | [View](variants/v1.14.10-alpine-3.8 ) |
| `:v1.14.10-envsubst-alpine-3.8` | [View](variants/v1.14.10-envsubst-alpine-3.8 ) |
| `:v1.14.10-git-alpine-3.8` | [View](variants/v1.14.10-git-alpine-3.8 ) |
| `:v1.14.10-jq-alpine-3.8` | [View](variants/v1.14.10-jq-alpine-3.8 ) |
| `:v1.14.10-kustomize-alpine-3.8` | [View](variants/v1.14.10-kustomize-alpine-3.8 ) |
| `:v1.14.10-ssh-alpine-3.8` | [View](variants/v1.14.10-ssh-alpine-3.8 ) |
| `:v1.14.10-envsubst-git-jq-kustomize-ssh-alpine-3.8` | [View](variants/v1.14.10-envsubst-git-jq-kustomize-ssh-alpine-3.8 ) |

2 changes: 1 addition & 1 deletion generate/definitions/FILES.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Files' definition
$FILES = @(
'.github/workflows/ci-master-pr.yml'
'.github/workflows/ci-release.yml'
# '.github/workflows/ci-release.yml'
'.github/release-drafter.yml'
# '.gitlab-ci.yml'
'README.md'
Expand Down
6 changes: 1 addition & 5 deletions generate/definitions/VARIANTS.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
$local:VARIANTS_PACKAGE_VERSIONS = @(
'v1.22.0'
'v1.21.0'
'v1.20.4'
'v1.19.7'
Expand All @@ -17,11 +18,6 @@ $local:VARIANTS_MATRIX = @(
distro_version = '3.8'
subvariants = @(
@{ components = @(); tag_as_latest = if ($v -eq ($local:VARIANTS_PACKAGE_VERSIONS | ? { $_ -match '^v\d+\.\d+\.\d+$' } | Select-Object -First 1 )) { $true } else { $false } }
@{ components = @( 'envsubst' ) }
@{ components = @( 'git' ) }
@{ components = @( 'jq' ) }
@{ components = @( 'kustomize' ) }
@{ components = @( 'ssh' ) }
@{ components = @( 'envsubst', 'git', 'jq', 'kustomize', 'ssh' ) }
)
}
Expand Down
172 changes: 154 additions & 18 deletions generate/templates/.github/workflows/ci-master-pr.yml.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@ on:
push:
branches:
- master
- release # For Generate-DockerImageVariants: For CalVer releases. Each push to 'release' branch is a time-based release.
pull_request:
branches:
- master
jobs:
'@

$local:WORKFLOW_JOB_NAMES = $VARIANTS | % { "build-$( $_['tag'].Replace('.', '-') )" }
$( $VARIANTS | % {
@"
build-$( $_['tag'].Replace('.', '-') ):
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
env:
VARIANT_TAG: $( $_['tag'] )
# VARIANT_TAG_WITH_REF: $( $_['tag'] )-`${GITHUB_REF}
Expand All @@ -26,7 +27,9 @@ $( $VARIANTS | % {
@'
steps:
- uses: actions/checkout@v1
- name: Checkout
uses: actions/checkout@v2
- name: Display system info (linux)
run: |
set -e
Expand All @@ -39,42 +42,149 @@ $( $VARIANTS | % {
pwd
docker info
docker version
- name: Login to docker registry
run: echo "${DOCKERHUB_REGISTRY_PASSWORD}" | docker login -u "${DOCKERHUB_REGISTRY_USER}" --password-stdin
env:
DOCKERHUB_REGISTRY_USER: ${{ secrets.DOCKERHUB_REGISTRY_USER }}
DOCKERHUB_REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }}
- name: Build and push image
# See: https://github.com/docker/build-push-action/blob/v2.6.1/docs/advanced/cache.md#github-cache
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Prepare
id: prep
env:
DOCKERHUB_REGISTRY_USER: ${{ secrets.DOCKERHUB_REGISTRY_USER }}
run: |
set -e
# Get 'project-name' from 'namespace/project-name'
CI_PROJECT_NAME=$( echo "${GITHUB_REPOSITORY}" | rev | cut -d '/' -f 1 | rev )
# Get 'namespace' and 'project-name' from 'namespace/project-name'
# CI_PROJECT_NAMESPACE=$( echo "${{ github.repository }}" | cut -d '/' -f 1 )
# CI_PROJECT_NAME=$( echo "${{ github.repository }}" | cut -d '/' -f 2 )
# Get 'ref-name' from 'refs/heads/ref-name'
REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev )
SHA_SHORT=$( echo "${GITHUB_SHA}" | cut -c1-7 )
# Generate the final tags. E.g. 'master-v1.0.0-alpine' and 'master-b29758a-v1.0.0-alpine'
# For Generate-DockerImageVariants: Generate the final tags. E.g. 'master-v1.0.0-alpine' and 'master-b29758a-v1.0.0-alpine'
VARIANT_TAG_WITH_REF="${REF}-${VARIANT_TAG}"
VARIANT_TAG_WITH_REF_AND_SHA_SHORT="${REF}-${SHA_SHORT}-${VARIANT_TAG}"
docker build \
-t "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG_WITH_REF}" \
-t "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG_WITH_REF_AND_SHA_SHORT}" \
"${VARIANT_BUILD_DIR}"
docker push "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG_WITH_REF}"
docker push "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG_WITH_REF_AND_SHA_SHORT}"
# Set step output(s)
# echo "::set-output name=CI_PROJECT_NAMESPACE::$CI_PROJECT_NAMESPACE"
# echo "::set-output name=CI_PROJECT_NAME::$CI_PROJECT_NAME"
# echo "::set-output name=REF::$REF"
# echo "::set-output name=SHA_SHORT::$SHA_SHORT"
# echo "::set-output name=REF_AND_SHA_SHORT::$REF_AND_SHA_SHORT"
# For Generate-DockerImageVariants: Set step output(s)
echo "::set-output name=CONTEXT::$VARIANT_BUILD_DIR"
echo "::set-output name=VARIANT_TAG::$VARIANT_TAG"
echo "::set-output name=VARIANT_TAG_WITH_REF::$VARIANT_TAG_WITH_REF"
echo "::set-output name=VARIANT_TAG_WITH_REF_AND_SHA_SHORT::$VARIANT_TAG_WITH_REF_AND_SHA_SHORT"
- name: Login to docker registry
run: echo "${DOCKERHUB_REGISTRY_PASSWORD}" | docker login -u "${DOCKERHUB_REGISTRY_USER}" --password-stdin
env:
DOCKERHUB_REGISTRY_USER: ${{ secrets.DOCKERHUB_REGISTRY_USER }}
DOCKERHUB_REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }}
- name: Build (PRs)
id: docker_build_pr
# Run only on pull requests
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v2
with:
context: ${{ steps.prep.outputs.CONTEXT }}
platforms: linux/386,linux/amd64,linux/arm,linux/arm64,linux/s390x
push: false
tags: |
${{ github.repository }}:${{ steps.prep.outputs.VARIANT_TAG_WITH_REF }}
${{ github.repository }}:${{ steps.prep.outputs.VARIANT_TAG_WITH_REF_AND_SHA_SHORT }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Build and push (master)
id: docker_build_master
# Run only on master
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v2
with:
context: ${{ steps.prep.outputs.CONTEXT }}
platforms: linux/386,linux/amd64,linux/arm,linux/arm64,linux/s390x
push: true
tags: |
${{ github.repository }}:${{ steps.prep.outputs.VARIANT_TAG_WITH_REF }}
${{ github.repository }}:${{ steps.prep.outputs.VARIANT_TAG_WITH_REF_AND_SHA_SHORT }}
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Build and push (release)
id: docker_build_release
# For Generate-DockerImageVariants: For CalVer releases. Each push to 'release' branch is a time-based release.
# if: startsWith(github.ref, 'refs/tags/')
if: github.ref == 'refs/heads/release'
uses: docker/build-push-action@v2
with:
context: ${{ steps.prep.outputs.CONTEXT }}
platforms: linux/386,linux/amd64,linux/arm,linux/arm64,linux/s390x
push: true
tags: |
${{ github.repository }}:${{ steps.prep.outputs.VARIANT_TAG }}
${{ github.repository }}:${{ steps.prep.outputs.VARIANT_TAG_WITH_REF }}
${{ github.repository }}:${{ steps.prep.outputs.VARIANT_TAG_WITH_REF_AND_SHA_SHORT }}
'@

if ( $_['tag_as_latest'] ) {
@'
${{ github.repository }}:latest
'@
}
@'
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: List docker images
run: docker images
- name: Clean-up
run: docker logout
if: always()
'@
})

@"
# For Generate-DockerImageVariants: For CalVer releases. Each push to 'release' branch is a time-based release.
converge-master-and-release-branches:
needs: [$( $local:WORKFLOW_JOB_NAMES -join ', ' )]
if: github.ref == 'refs/heads/release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Merge release into master (fast-forward)
run: |
git checkout master
git merge release
git push origin master
"@

@'
# For Generate-DockerImageVariants: For CalVer releases. Each push to 'release' branch is a time-based release.
resolve-release-tag:
runs-on: ubuntu-latest
outputs:
Expand Down Expand Up @@ -113,6 +223,7 @@ $( $VARIANTS | % {

@"
update-draft-release:
needs: [$( $local:WORKFLOW_JOB_NAMES -join ', ' ), resolve-release-tag]
"@
Expand All @@ -135,5 +246,30 @@ $( $VARIANTS | % {
tag: ${{ needs.resolve-release-tag.outputs.TAG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
'@

@"
publish-draft-release:
needs: [$( $local:WORKFLOW_JOB_NAMES -join ', ' ), converge-master-and-release-branches]
"@
@'
# For Generate-DockerImageVariants: For CalVer releases. Each push to 'release' branch is a time-based release.
# if: startsWith(github.ref, 'refs/tags/')
if: github.ref == 'refs/heads/release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter.yml
publish: true
name: ${{ needs.resolve-release-tag.outputs.TAG }}
tag: ${{ needs.resolve-release-tag.outputs.TAG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
'@
Loading

0 comments on commit 4ec42f9

Please sign in to comment.