-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
752 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: "Metadata" | ||
description: "Generate Image Metadata" | ||
inputs: | ||
quay_username: | ||
description: "quay_username" | ||
required: true | ||
metadata_flavor: | ||
description: "metadata_flavor" | ||
required: true | ||
metadata_tags: | ||
description: "metadata_tags" | ||
required: true | ||
outputs: | ||
tags: | ||
description: "generated image tags" | ||
value: ${{ steps.meta.outputs.tags }} | ||
labels: | ||
description: "generated image labels" | ||
value: ${{ steps.meta.outputs.labels }} | ||
version: | ||
description: "generated image version" | ||
value: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Build image urls | ||
shell: bash | ||
id: image-urls | ||
env: | ||
QUAY_USERNAME: ${{ inputs.quay_username }} | ||
run: | | ||
[[ -n "$QUAY_USERNAME" ]] && IMAGES=${IMAGES},${REGISTRY}/${IMAGE_NAME} | ||
echo "::set-output name=images::${IMAGES}" | ||
- name: Docker manager metadata | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ${{ steps.image-urls.outputs.images }} | ||
flavor: ${{ inputs.metadata_flavor }} | ||
tags: ${{ inputs.metadata_tags }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: 'Setup Go' | ||
description: 'Setup Go' | ||
inputs: | ||
version: | ||
description: 'Go Version to setup' | ||
required: true | ||
default: "1.17" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ inputs.version }} | ||
- id: go-cache-paths | ||
shell: bash | ||
run: | | ||
echo "::set-output name=go-build::$(go env GOCACHE)" | ||
echo "::set-output name=go-mod::$(go env GOMODCACHE)" | ||
- name: Go Mod Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.go-cache-paths.outputs.go-mod }} | ||
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go-mod- | ||
- name: Go Build Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.go-cache-paths.outputs.go-build }} | ||
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go-build- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: 2 | ||
updates: | ||
# Maintain dependencies for GitHub Actions. | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
|
||
# Maintain dependencies for Go modules. | ||
- package-ecosystem: "gomod" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
|
||
# Maintain dependencies for Docker images. | ||
- package-ecosystem: "docker" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
name: E2E Tests | ||
on: | ||
schedule: | ||
- cron: "0 */72 * * *" | ||
env: | ||
hcloudctl_version: 1.29.4 | ||
IMAGE_NAME: cluster-api-provider-hetzner | ||
REGISTRY: quay.io/syself | ||
metadata_flavor: latest=false | ||
metadata_tags: type=sha | ||
|
||
jobs: | ||
manager-image: | ||
name: Build and push manager image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup-go | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Generate metadata | ||
id: meta | ||
uses: ./.github/actions/metadata | ||
with: | ||
quay_username: ${{ secrets.QUAY_USERNAME }} | ||
metadata_flavor: ${{ env.metadata_flavor }} | ||
metadata_tags: ${{ env.metadata_tags }} | ||
|
||
- name: Log into quay.io | ||
uses: docker/login-action@v1 | ||
env: | ||
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }} | ||
if: ${{ env.QUAY_USERNAME != '' }} | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_PASSWORD }} | ||
|
||
- name: Build and push manager image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64 | ||
cache-from: type=gha, scope=${{ github.workflow }} | ||
cache-to: type=gha, mode=max, scope=${{ github.workflow }} | ||
|
||
test-release: | ||
name: Test Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup-go | ||
- uses: actions/cache@v3 | ||
with: | ||
path: hack/tools/bin | ||
key: ${{ runner.os }}-tools-bin-release-${{ hashFiles('Makefile') }} | ||
restore-keys: | | ||
${{ runner.os }}-tools-bin-release- | ||
${{ runner.os }}-tools-bin- | ||
- name: Generate metadata | ||
id: meta | ||
uses: ./.github/actions/metadata | ||
with: | ||
quay_username: ${{ secrets.QUAY_USERNAME }} | ||
metadata_flavor: ${{ env.metadata_flavor }} | ||
metadata_tags: ${{ env.metadata_tags }} | ||
|
||
- name: Test Release | ||
env: | ||
TAG: ${{ steps.meta.outputs.version }} | ||
run: make test-release | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: test-release | ||
path: out | ||
|
||
e2e-basic: | ||
name: "E2E Basic" | ||
concurrency: ci-${{ github.ref }}-e2e-basic | ||
runs-on: ubuntu-latest | ||
needs: | ||
- manager-image | ||
- test-release | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup-go | ||
- uses: actions/cache@v3 | ||
with: | ||
path: hack/tools/bin | ||
key: ${{ runner.os }}-tools-bin-e2e-${{ hashFiles('Makefile') }} | ||
restore-keys: | | ||
${{ runner.os }}-tools-bin-e2e- | ||
${{ runner.os }}-tools-bin- | ||
- name: Download artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: test-release | ||
path: out | ||
- name: Install hcloud | ||
run: curl -fsSL https://github.com/hetznercloud/cli/releases/download/v${{ env.hcloudctl_version }}/hcloud-linux-amd64.tar.gz | tar -xzv hcloud ; mv hcloud hack/tools/bin/hcloud | ||
|
||
- name: Generate metadata | ||
id: meta | ||
uses: ./.github/actions/metadata | ||
with: | ||
quay_username: ${{ secrets.QUAY_USERNAME }} | ||
metadata_flavor: ${{ env.metadata_flavor }} | ||
metadata_tags: ${{ env.metadata_tags }} | ||
|
||
- name: Prepull the pre-built image | ||
run: docker pull ${REGISTRY}/${IMAGE_NAME}:${TAG} | ||
env: | ||
TAG: ${{ steps.meta.outputs.version }} | ||
|
||
- name: "e2e-basic" | ||
env: | ||
CI: "true" | ||
REGISTRY: ${{ env.REGISTRY }} | ||
IMAGE_NAME: ${{ env.IMAGE_NAME }} | ||
TAG: ${{ steps.meta.outputs.version }} | ||
E2E_CONF_FILE_SOURCE: "${{ github.workspace }}/test/e2e/config/hetzner-ci.yaml" | ||
MANIFEST_PATH: "../../../out" | ||
HCLOUD_TOKEN: ${{ secrets.HCLOUD_TOKEN }} | ||
SKIP_IMAGE_BUILD: "1" | ||
run: make test-e2e | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
if: ${{ always() }} | ||
with: | ||
name: e2e-basic | ||
path: _artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
name: E2E Tests | ||
on: | ||
pull_request: | ||
types: [opened, edited, synchronize, reopened] | ||
branches: | ||
- main | ||
- "releases/**" | ||
paths: | ||
- "**.go" | ||
- "**go.mod" | ||
- "**go.sum" | ||
- "<templates|test>/**/*.<yml|yaml>" | ||
env: | ||
hcloudctl_version: 1.29.4 | ||
IMAGE_NAME: cluster-api-provider-hetzner | ||
REGISTRY: quay.io/syself | ||
metadata_flavor: latest=false | ||
metadata_tags: type=ref,event=pr | ||
|
||
jobs: | ||
manager-image: | ||
name: Build and push manager image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup-go | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Generate metadata | ||
id: meta | ||
uses: ./.github/actions/metadata | ||
with: | ||
quay_username: ${{ secrets.QUAY_USERNAME }} | ||
metadata_flavor: ${{ env.metadata_flavor }} | ||
metadata_tags: ${{ env.metadata_tags }} | ||
|
||
- name: Log into quay.io | ||
uses: docker/login-action@v1 | ||
env: | ||
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }} | ||
if: ${{ env.QUAY_USERNAME != '' }} | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_PASSWORD }} | ||
|
||
- name: Build and push manager image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64 | ||
cache-from: type=gha, scope=${{ github.workflow }} | ||
cache-to: type=gha, mode=max, scope=${{ github.workflow }} | ||
|
||
test-release: | ||
name: Test Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup-go | ||
- uses: actions/cache@v3 | ||
with: | ||
path: hack/tools/bin | ||
key: ${{ runner.os }}-tools-bin-release-${{ hashFiles('Makefile') }} | ||
restore-keys: | | ||
${{ runner.os }}-tools-bin-release- | ||
${{ runner.os }}-tools-bin- | ||
- name: Generate metadata | ||
id: meta | ||
uses: ./.github/actions/metadata | ||
with: | ||
quay_username: ${{ secrets.QUAY_USERNAME }} | ||
metadata_flavor: ${{ env.metadata_flavor }} | ||
metadata_tags: ${{ env.metadata_tags }} | ||
|
||
- name: Test Release | ||
env: | ||
TAG: ${{ steps.meta.outputs.version }} | ||
run: make test-release | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: test-release | ||
path: out | ||
|
||
e2e-basic: | ||
name: "E2E Basic" | ||
concurrency: ci-${{ github.ref }}-e2e-basic | ||
runs-on: ubuntu-latest | ||
needs: | ||
- manager-image | ||
- test-release | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup-go | ||
- uses: actions/cache@v3 | ||
with: | ||
path: hack/tools/bin | ||
key: ${{ runner.os }}-tools-bin-e2e-${{ hashFiles('Makefile') }} | ||
restore-keys: | | ||
${{ runner.os }}-tools-bin-e2e- | ||
${{ runner.os }}-tools-bin- | ||
- name: Download artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: test-release | ||
path: out | ||
- name: Install hcloud | ||
run: curl -fsSL https://github.com/hetznercloud/cli/releases/download/v${{ env.hcloudctl_version }}/hcloud-linux-amd64.tar.gz | tar -xzv hcloud ; mv hcloud hack/tools/bin/hcloud | ||
|
||
- name: Generate metadata | ||
id: meta | ||
uses: ./.github/actions/metadata | ||
with: | ||
quay_username: ${{ secrets.QUAY_USERNAME }} | ||
metadata_flavor: ${{ env.metadata_flavor }} | ||
metadata_tags: ${{ env.metadata_tags }} | ||
|
||
- name: Prepull the pre-built image | ||
run: docker pull ${REGISTRY}/${IMAGE_NAME}:${TAG} | ||
env: | ||
TAG: ${{ steps.meta.outputs.version }} | ||
|
||
- name: "e2e-basic" | ||
env: | ||
CI: "true" | ||
REGISTRY: ${{ env.REGISTRY }} | ||
IMAGE_NAME: ${{ env.IMAGE_NAME }} | ||
TAG: ${{ steps.meta.outputs.version }} | ||
E2E_CONF_FILE_SOURCE: "${{ github.workspace }}/test/e2e/config/hetzner-ci.yaml" | ||
MANIFEST_PATH: "../../../out" | ||
HCLOUD_TOKEN: ${{ secrets.HCLOUD_TOKEN }} | ||
SKIP_IMAGE_BUILD: "1" | ||
run: make test-e2e | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
if: ${{ always() }} | ||
with: | ||
name: e2e-basic | ||
path: _artifacts |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.