Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various QA improvements #39

Merged
merged 28 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
92979ea
Add the name of the proposal here too.
DFINITYManu Aug 22, 2024
8d3025a
Merge remote-tracking branch 'origin/main'
DFINITYManu Aug 22, 2024
77ecef7
Machete the source and ensure pipeline does not succeed if the source…
DFINITYManu Aug 22, 2024
eb21cd9
Add the machete component.
DFINITYManu Aug 22, 2024
fb89d05
Try a command-line version.
DFINITYManu Aug 22, 2024
6298a27
Cache Cargo stuff.
DFINITYManu Aug 22, 2024
5a30801
Remove spurious which cargo.
DFINITYManu Aug 22, 2024
e2e92d7
Attempt caching of target debug for faster clippy and test.
DFINITYManu Aug 22, 2024
e76d0c8
Cache Cargo files according to Github cache action recommended strate…
DFINITYManu Aug 22, 2024
f427b14
Try another strategy to cache.
DFINITYManu Aug 22, 2024
b972cea
Reorder steps.
DFINITYManu Aug 22, 2024
cc4fd60
Only cache the target debug build and deps.
DFINITYManu Aug 22, 2024
c2da03a
Set cache key to invalidate once a month.
DFINITYManu Aug 22, 2024
cefab90
Fingerprint cache.
DFINITYManu Aug 22, 2024
1858dee
Use new github output mechanism to set the date.
DFINITYManu Aug 22, 2024
0cd7935
Use cacheable Rust build layers in the container, to speed up builds.
DFINITYManu Aug 22, 2024
3a73957
Upgrade the container to avoid security issues.
DFINITYManu Aug 22, 2024
565e819
Have to specify push in order for cache to work.
DFINITYManu Aug 22, 2024
808beba
Use labels not tags.
DFINITYManu Aug 22, 2024
89b2445
Tag in cache.
DFINITYManu Aug 22, 2024
5ba8a65
Fix sha.
DFINITYManu Aug 22, 2024
8f44f27
Fix sha 2.
DFINITYManu Aug 22, 2024
eed8f37
Fix sha 3.
DFINITYManu Aug 22, 2024
b375301
Also cache the layer that does the npm install.
DFINITYManu Aug 22, 2024
177d503
Enforce NPM security audit.
DFINITYManu Aug 22, 2024
078946c
Make audit optional.
DFINITYManu Aug 22, 2024
0824536
Update NPM packages.
DFINITYManu Aug 22, 2024
d47c01b
Cache npm install only.
DFINITYManu Aug 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 32 additions & 10 deletions .github/workflows/rollout-dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,37 @@ jobs:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Set month and year for cache key
id: date
run: echo "date=$(date +'%Y-%m')" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
- name: Move backend files to source root
run: mv -f rollout-dashboard/server/* .
- name: Cache Cargo stuff once a month for faster execution
uses: actions/cache@v3
with:
key: cargo-build-deps-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ steps.date.outputs.date }}
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/debug/build
target/debug/deps
target/debug/.fingerprint
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Move backend files to source root
run: mv -f rollout-dashboard/server/* .
- name: Security audit
uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: cargo machete
run: |
set -e
which cargo-machete || cargo install cargo-machete
cargo machete
- name: cargo clippy
uses: actions-rs/cargo@v1
with:
Expand All @@ -50,6 +74,8 @@ jobs:
run: mv -f rollout-dashboard/frontend/* .
- name: prepare NPM for CI
run: npm ci
- name: Security audit (optional for now)
run: npm audit || true
- name: build frontend
run: npm run build
- name: run tests on frontend
Expand All @@ -64,12 +90,8 @@ jobs:
- uses: docker/metadata-action@v5
id: metadata
with:
images: ghcr.io/${{ github.repository }}/rollout-dashboard
images: ghcr.io/${{ github.repository }}/cache
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,format=long
- uses: docker/login-action@v3
with:
Expand All @@ -79,10 +101,10 @@ jobs:
- uses: int128/kaniko-action@v1
name: Create rollout-dashboard container
with:
push: false
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
cache: false
cache: true
cache-repository: ghcr.io/${{ github.repository }}/cache
context: rollout-dashboard
publish-rollout-dashboard-container:
Expand Down Expand Up @@ -112,6 +134,6 @@ jobs:
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
cache: false
cache: true
cache-repository: ghcr.io/${{ github.repository }}/cache
context: rollout-dashboard
2 changes: 1 addition & 1 deletion plugins/operators/ic_os_rollout.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def execute(self, context: Context) -> dict[str, int | str | bool]:
"is in state %s and must be created again. Will create.",
props_for_git_revision[0]["proposal_id"],
git_revision,
props_for_git_revision[0]["status"],
props_for_git_revision[0]["status"].name,
)
else:
prop = props_for_git_revision[0]
Expand Down
19 changes: 13 additions & 6 deletions rollout-dashboard/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
FROM docker.io/rust:1.80-bookworm as rust
WORKDIR /usr/src
COPY server/Cargo.toml server/Cargo.lock ./
RUN cargo new rollout-dashboard
COPY server/Cargo.toml server/Cargo.lock ./rollout-dashboard/
WORKDIR /usr/src/rollout-dashboard
RUN cargo build --release ; rm -rf src ; echo "This step is expected to fail, but it creates a layer that is cacheable." >&2
COPY server/src ./src/
RUN cargo install --path .
RUN cargo build --release && \
mv target/release/rollout-dashboard .

FROM docker.io/node:alpine as node
WORKDIR /
COPY frontend/index.html frontend/*.json frontend/*.js frontend/*.ts ./
# The following step copies only the package files so npm install can be cached.
COPY frontend/package*.json ./
RUN npm install
COPY frontend/*.json frontend/index.html frontend/*.js frontend/*.ts ./
COPY frontend/public ./public
COPY frontend/src ./src
RUN npm install && npm run build
RUN npm run build

FROM docker.io/debian:bookworm
WORKDIR /
RUN apt-get update && apt install -y openssl ca-certificates
COPY --from=rust /usr/local/cargo/bin/rollout-dashboard /rollout-dashboard
COPY --from=rust /usr/src/rollout-dashboard/rollout-dashboard /rollout-dashboard
COPY --from=node /dist /static
RUN apt-get update && apt-get upgrade -y && apt install -y openssl ca-certificates

EXPOSE 4174
ENV FRONTEND_STATIC_DIR=static
Expand Down
Loading
Loading