Skip to content

Commit

Permalink
Merge pull request #1 from mattray/migration
Browse files Browse the repository at this point in the history
UI Migration cleanups
  • Loading branch information
nealormsbee authored May 23, 2024
2 parents 88ad5c4 + 2dd3a86 commit f258288
Show file tree
Hide file tree
Showing 13 changed files with 8,338 additions and 10 deletions.
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/opencost-bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: OpenCost UI Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the OpenCost bug is. Please ensure this is an issue related to the OpenCost _UI_. General OpenCost issues may be opened in the [OpenCost repository](https://github.com/opencost/opencost).

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Which version of OpenCost are you using?**
You can find the version from the container's startup logging or from the bottom of the page in the UI.

**Additional context**
Add any other context about the problem here. Kubernetes versions and which public clouds you are working with are especially important.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/opencost-feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: OpenCost UI Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context, documentation links, or screenshots about the feature request here.
20 changes: 20 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## What does this PR change?
*

## Does this PR relate to any other PRs?
*

## How will this PR impact users?
*

## Does this PR address any GitHub or Zendesk issues?
* Closes ...

## How was this PR tested?
*

## Does this PR require changes to documentation?
*

## Have you labeled this PR and its corresponding Issue as "next release" if it should be part of the next OpenCost release? If not, why not?
*
5 changes: 5 additions & 0 deletions .github/configs/stale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## https://github.com/marketplace/actions/close-stale-issues#recommended-permissions
# Give stalebot permission to update issues and pull requests
permissions:
issues: write
pull-requests: write
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
# Dependencies listed in .github/workflows/*.yml
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

# Dependencies listed in ui/package.json
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
14 changes: 14 additions & 0 deletions .github/workflows/auto_label_issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: auto-label-new-issues

on:
issues:
types: [opened]

jobs:
automate-issues-labels:
runs-on: ubuntu-latest
steps:
- name: Label new issues with 'needs-triage'
uses: andymckay/[email protected]
with:
add-labels: "needs-triage"
119 changes: 119 additions & 0 deletions .github/workflows/build-and-publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Build and Publish Release

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
inputs:
release_version:
description: "Version of the release"
required: true

concurrency:
group: build-opencost
cancel-in-progress: true

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-publish-opencost:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Get Version From Tag
id: tag
if: ${{ github.event_name }} == 'push'
run: |
echo "TRIGGERED_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Determine Version Number
id: version_number
run: |
if [ -z "${TRIGGERED_TAG}" ];
then
version=${{ inputs.release_version }}
else
version=$TRIGGERED_TAG
fi
if [[ ${version:0:1} == "v" ]];
then
echo "RELEASE_VERSION=${version:1}" >> $GITHUB_OUTPUT
else
echo "RELEASE_VERSION=$version" >> $GITHUB_OUTPUT
fi
- name: Show Input Values
run: |
echo "release version: ${{ inputs.release_version }}"
- name: Make Branch Name
id: branch
run: |
VERSION_NUMBER=${{ steps.version_number.outputs.RELEASE_VERSION }}
echo "BRANCH_NAME=v${VERSION_NUMBER%.*}" >> $GITHUB_ENV
- name: Checkout Repo
uses: actions/checkout@v4
with:
repository: 'opencost/opencost-ui'
ref: '${{ steps.branch.outputs.BRANCH_NAME }}'
path: ./opencost-ui

- name: Set SHA
id: sha
run: |
pushd ./opencost-ui
echo "OC_SHORTHASH=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
popd
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set OpenCost Image Tags
id: tags
run: |
echo "IMAGE_TAG_UI=ghcr.io/opencost/opencost-ui:${{ steps.sha.outputs.OC_SHORTHASH }}" >> $GITHUB_OUTPUT
echo "IMAGE_TAG_UI_LATEST=ghcr.io/opencost/opencost-ui:latest" >> $GITHUB_OUTPUT
echo "IMAGE_TAG_UI_VERSION=ghcr.io/opencost/opencost-ui:${{ steps.version_number.outputs.RELEASE_VERSION }}" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug

- name: Set up just
uses: extractions/setup-just@v1

- name: Install crane
uses: imjasonh/[email protected]

## Install manifest-tool, which is required to combine multi-arch images
## https://github.com/estesp/manifest-tool
- name: Install manifest-tool
run: |
mkdir -p manifest-tool
pushd manifest-tool
wget -q https://github.com/estesp/manifest-tool/releases/download/v2.0.8/binaries-manifest-tool-2.0.8.tar.gz
tar -xzf binaries-manifest-tool-2.0.8.tar.gz
cp manifest-tool-linux-amd64 manifest-tool
echo "$(pwd)" >> $GITHUB_PATH
- name: Build and push (multiarch) OpenCost UI
working-directory: ./opencost/ui
run: |
just build '${{ steps.tags.outputs.IMAGE_TAG_UI }}' '${{ steps.version_number.outputs.RELEASE_VERSION }}'
crane copy '${{ steps.tags.outputs.IMAGE_TAG_UI }}' '${{ steps.tags.outputs.IMAGE_TAG_UI_LATEST }}'
crane copy '${{ steps.tags.outputs.IMAGE_TAG_UI }}' '${{ steps.tags.outputs.IMAGE_TAG_UI_VERSION }}'
47 changes: 47 additions & 0 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build/Test

on:
push:
branches:
- main

pull_request:
branches:
- main

jobs:
frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: ./

-
name: Install just
uses: extractions/setup-just@v1

-
name: Install node
uses: actions/setup-node@v4
with:
node-version: '18.3.0'

- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- uses: actions/cache@v4
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('./ui/**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
-
name: Build
working-directory: ./
run: |
just build-local
45 changes: 45 additions & 0 deletions .github/workflows/label-comments.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: needs-follow-up-label

on:
issue_comment:
types: [created]
issues:
types: [opened, reopened, closed]

jobs:
set-follow-up-label:
runs-on: ubuntu-latest
steps:
- name: Check comment actor org membership
id: response
run: |
echo "::set-output name=MEMBER_RESPONSE::$(curl -I -H 'Accept: application/vnd.github+json' -H 'Authorization: token ${{ github.token }}' 'https://api.github.com/orgs/kubecost/members/${{ github.actor }}')"
- name: "Check for non-4XX response"
id: membership
run: |
echo '${{ steps.response.outputs.MEMBER_RESPONSE }}' && echo "::set-output name=IS_MEMBER::$(grep 'HTTP/2 [2]' <<< '${{ steps.response.outputs.MEMBER_RESPONSE }}')"
- name: Apply needs-follow-up label if this is a new or reopened issue by user not in the org
if: ${{ steps.membership.outputs.IS_MEMBER == '' && github.event_name == 'issues' && (github.event.action == 'opened' || github.event.action == 'reopened') }}
uses: actions-ecosystem/action-add-labels@v1
with:
labels: needs-follow-up

- name: Apply needs-follow-up label if comment by a user not in the org
if: ${{ steps.membership.outputs.IS_MEMBER == '' && github.event_name == 'issue_comment' }}
uses: actions-ecosystem/action-add-labels@v1
with:
labels: needs-follow-up

- name: Remove needs-follow-up label if the issue has been closed
if: ${{ github.event_name == 'issues' && github.event.action == 'closed' }}
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: needs-follow-up

- name: Remove needs-follow-up label if comment by a user in the org
if: ${{ steps.membership.outputs.IS_MEMBER != '' && github.event_name == 'issue_comment' }}
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: needs-follow-up
19 changes: 19 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '30 1 * * *'

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
with:
stale-issue-message: 'This issue has been marked as stale because it has been open for 360 days with no activity. Please remove the stale label or comment or this issue will be closed in 5 days.'
close-issue-message: 'This issue was closed because it has been inactive for 365 days with no activity.'
stale-pr-message: 'This pull request has been marked as stale because it has been open for 90 days with no activity. Please remove the stale label or comment or this pull request will be closed in 5 days.'
close-pr-message: 'This pull request was closed because it has been inactive for 95 days with no activity.'
days-before-issue-stale: 360
days-before-issue-close: 5
days-before-pr-stale: 90
days-before-pr-close: 5
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Jetbrains project files
.idea
*.iml

.parcel-cache
.cache
dist
.env
node_modules/

# VS Code
.vscode

#Apple
*.DS_Store

# tilt
tilt_config.json
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

# OpenCost UI

## Installing
<img src="./opencost-header.png"/>

See https://www.opencost.io/docs/install for the full instructions.
This is the web UI for the [OpenCost](http://github.com/opencost/opencost) project. You can learn more about the [User Interface](https://www.opencost.io/docs/installation/ui) in the OpenCost docs.

```
helm install prometheus --repo https://prometheus-community.github.io/helm-charts prometheus \
--namespace prometheus-system --create-namespace \
--set pushgateway.enabled=false \
--set alertmanager.enabled=false \
-f https://raw.githubusercontent.com/opencost/opencost/develop/kubernetes/prometheus/extraScrapeConfigs.yaml
[![OpenCost UI Walkthrough](./ui/src/thumbnail.png)](https://youtu.be/lCP4Ci9Kcdg)
*OpenCost UI Walkthrough*

kubectl apply --namespace opencost -f https://raw.githubusercontent.com/opencost/opencost/develop/kubernetes/opencost.yaml
```
## Installing

See https://www.opencost.io/docs/install for the full instructions.

## Using

Expand Down
Loading

0 comments on commit f258288

Please sign in to comment.