Skip to content

Commit

Permalink
Merge pull request #1039 from harvester/mergify/bp/release-harvester-…
Browse files Browse the repository at this point in the history
…v1.3/pr-1037

[ci] Drone migration (backport #1037)
  • Loading branch information
torchiaf authored Jun 4, 2024
2 parents 17ebe5e + 89147b6 commit 5e4558e
Show file tree
Hide file tree
Showing 17 changed files with 394 additions and 625 deletions.
449 changes: 0 additions & 449 deletions .drone.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/actions/i18n-lint/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Run i18n Lint
description: Run i18n Lint

runs:
using: 'composite'
steps:
- name: Setup env
uses: ./.github/actions/setup

- name: Run i18n linters
shell: bash
run: yarn lint-l10n
12 changes: 12 additions & 0 deletions .github/actions/lint/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Run Lint
description: Run Lint

runs:
using: 'composite'
steps:
- name: Setup env
uses: ./.github/actions/setup

- name: Run linters
shell: bash
run: yarn lint
14 changes: 14 additions & 0 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Setup UI Env
description: Setup node and call bootstrap script

runs:
using: 'composite'
steps:
- uses: actions/setup-node@v3
with:
node-version: '14.x'
cache: 'yarn'

- name: Install packages
shell: bash
run: yarn install:ci
14 changes: 14 additions & 0 deletions .github/actions/unit-tests/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Run Unit Tests
description: Run Unit Tests

runs:
using: 'composite'
steps:
- name: Setup env
uses: ./.github/actions/setup

- name: Run tests
shell: bash
run: |
yarn test:ci
24 changes: 24 additions & 0 deletions .github/workflows/build-and-upload-branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build Dashboard (Branch)

on:
push:
branches:
- master
- 'release-harvester-v*'
- '*-dev'

jobs:
build-validation:
name: Build Test
uses: ./.github/workflows/build-test.yaml
build:
name: Build and Upload Package
uses: ./.github/workflows/build-and-upload.yaml
needs:
- build-validation
permissions:
contents: read
packages: write
id-token: write
with:
CI_BRANCH: ${{github.ref_name}}
21 changes: 21 additions & 0 deletions .github/workflows/build-and-upload-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build Dashboard (Release)
on:
push:
tags:
- v[1-9].*

jobs:
build-validation:
name: Validate Code
uses: ./.github/workflows/build-test.yaml
build:
name: Build and Upload Package
uses: ./.github/workflows/build-and-upload.yaml
needs:
- build-validation
permissions:
contents: read
packages: write
id-token: write
with:
CI_BUILD_TAG: ${{github.ref_name}}
205 changes: 205 additions & 0 deletions .github/workflows/build-and-upload.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
name: Build Dashboard and Upload

on:
workflow_call:
inputs:
CI_BRANCH:
required: false
type: string
CI_BUILD_TAG:
required: false
type: string

env:
GOOGLE_AUTH: ''
DOCKER_USERNAME: ''
DOCKER_PASSWORD: ''
CI_BUILD_TAG: ${{inputs.CI_BUILD_TAG}}
CI_BRANCH: ${{inputs.CI_BRANCH}}
GIT_REPO: ${{github.repository}}
GIT_COMMIT: ${{github.sha}}
REPO: ${{github.event.repository.name || ''}}

jobs:
build-and-upload-docker-image:
name: Build & Upload Docker
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- id: upload-gate
name: Upload Gate
run: ./scripts/build-upload-gate

- id: read-docker-secrets
name: Read Docker Secrets
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/harvester/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/harvester/credentials password | DOCKER_PASSWORD ;
- id: login-docker
name: Docker Log in
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}

- id: push-docker
name: Docker Build
uses: docker/build-push-action@v5
with:
provenance: false
context: .
push: true
tags: rancher/harvester-ui:${{ github.ref_name }}

build-and-upload-hosted:
name: Build & Upload Hosted
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

# Note - Cannot use the setup action here as it uses a different yarn install arg
- uses: actions/setup-node@v3
with:
node-version: '14.x'
cache: 'yarn'

# Build a directory containing the dashboard that can be used with ui-dashboard-index
- id: build-hosted
name: Build Hosted
run: ./scripts/build-hosted

- id: upload-gate
name: Upload Gate (superseded by a newer build?)
run: ./scripts/build-upload-gate

- name: Get gcs auth
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/googleauthkey/harvester/credentials credential | GOOGLE_AUTH ;
- name: Apply gcs auth
# https://github.com/google-github-actions/auth
uses: 'google-github-actions/auth@v2'
with:
credentials_json: "${{ env.GOOGLE_AUTH }}"

- name: Upload build
uses: 'google-github-actions/upload-cloud-storage@v2'
# https://github.com/google-github-actions/upload-cloud-storage
with:
path: ${{steps.build-hosted.outputs.BUILD_HOSTED_DIR}}
destination: releases.rancher.com/harvester-ui/dashboard/${{ steps.build-hosted.outputs.BUILD_HOSTED_LOCATION }}
parent: false
headers: |-
cache-control: no-cache,must-revalidate
process_gcloudignore: false

build-and-upload-embedded:
name: Build & Upload Embedded
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

# Note - Cannot use the setup action here as it uses a different yarn install arg
- uses: actions/setup-node@v3
with:
node-version: '14.x'
cache: 'yarn'

# Build a tar that will be picked up by rancher builds and embedded into it
- id: build-embedded
name: Build Embedded
run: ./scripts/build-embedded
env:
DISABLED_EMBED_PKG: https://releases.rancher.com/harvester-ui/plugin/harvester-1.0.3.tar.gz

- name: Get gcs auth
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/googleauthkey/harvester/credentials credential | GOOGLE_AUTH ;
- name: Apply gcs auth
# https://github.com/google-github-actions/auth
uses: 'google-github-actions/auth@v2'
with:
credentials_json: "${{ env.GOOGLE_AUTH }}"

- name: Upload tar
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: ${{steps.build-embedded.outputs.BUILD_EMBEDED_TGZ}}
destination: releases.rancher.com/harvester-ui/${{ env.REPO }}
parent: false
headers: |-
cache-control: no-cache,must-revalidate
process_gcloudignore: false

build-and-upload-harvester-plugin:
name: Build & Upload Plugin
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

# Note - Cannot use the setup action here as it uses a different yarn install arg
- uses: actions/setup-node@v3
with:
node-version: '14.x'
cache: 'yarn'

- id: ci-build-pkg
name: Build pkg
run: ./shell/scripts/ci-build-pkg.sh harvester

- id: upload-gate
name: Upload Gate
run: ./scripts/build-upload-gate

- name: Get gcs auth
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/googleauthkey/harvester/credentials credential | GOOGLE_AUTH ;
- name: Apply gcs auth
# https://github.com/google-github-actions/auth
uses: 'google-github-actions/auth@v2'
with:
credentials_json: "${{ env.GOOGLE_AUTH }}"

- name: Upload plugin tar
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: dist-pkg/${{steps.ci-build-pkg.outputs.PKG_TARBALL}}
destination: releases.rancher.com/harvester-ui/plugin
parent: false
headers: |-
cache-control: no-cache,must-revalidate
process_gcloudignore: false

- name: Upload plugin directory
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: dist-pkg/${{steps.ci-build-pkg.outputs.PKG_NAME}}
destination: releases.rancher.com/harvester-ui/plugin/${{steps.ci-build-pkg.outputs.PKG_NAME}}
parent: false
headers: |-
cache-control: no-cache,must-revalidate
process_gcloudignore: false
37 changes: 37 additions & 0 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Validation steps required before a build occurs. Not designed to replace the CI test workflow
name: Build Test

on:
# This tells GH that the workflow is reusable
workflow_call:

jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Run tests
uses: ./.github/actions/unit-tests

i18n:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Run i18n lint
uses: ./.github/actions/i18n-lint

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Run lint
uses: ./.github/actions/lint
Loading

0 comments on commit 5e4558e

Please sign in to comment.