Skip to content

Commit

Permalink
Merge branch 'main' into regulations-admin/format-amending-and-cancel…
Browse files Browse the repository at this point in the history
…-reg
  • Loading branch information
kodiakhq[bot] authored Jun 26, 2024
2 parents 9abcbc4 + c53cbe0 commit 1224161
Show file tree
Hide file tree
Showing 222 changed files with 2,738 additions and 1,238 deletions.
3 changes: 3 additions & 0 deletions .devcontainer/.envrc.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

export AWS_PROFILE=islandis-dev
2 changes: 2 additions & 0 deletions .devcontainer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
aws-config.ini
!.envrc.default
97 changes: 97 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
ARG RUST_VERSION=1.78
ARG FEDORA_VERSION=39
FROM docker.io/rust:${RUST_VERSION} as cargo-bins

# Build dependencies
RUN --mount=type=cache,target=/var/cache/apt \
apt-get update && \
apt-get install -y --no-install-recommends \
make=4.3-4.1 cmake=3.25.1-1 g++=4:12.2.0-3

# Install cargo binaries
RUN --mount=type=cache,target=/root/.cargo \
cargo install starship

FROM docker.io/rust:${RUST_VERSION} as cargo-volta
WORKDIR /build/volta
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN --mount=type=cache,target=/root/.cargo/ --mount=type=cache,target=/root/.cache/ \
git init && \
(git remote | grep -q origin || git remote add origin https://github.com/volta-cli/volta) && \
git fetch origin && \
git checkout origin/main --force && \
cargo build --release
RUN ls -lah . && ls -lah -R target/


FROM registry.fedoraproject.org/fedora:${FEDORA_VERSION} as base

#######################
# System dependencies #
#######################
# We're mounting the cache, so we don't need to `clean all` (DL3040).
# Tried pinning versions, but got errors from version solver (DL3041).
# hadolint ignore=DL3040,DL3041
RUN --mount=type=cache,target=/var/cache/dnf \
dnf install -y \
# Basic requirements
bash zsh git java-11-openjdk gcc-c++ jq graphviz python3-devel \
# AWS/DevOps specific dependencies
awscli2 \
# Niceties
the_silver_searcher ripgrep fzf neovim

ENV SHELL=bash
ARG SHELL=${SHELL}
ENV USERNAME=root
ARG USERNAME=${USERNAME}

# Create user and environment
RUN grep "${USERNAME}" /etc/passwd || useradd -m -s /bin/${SHELL} -G wheel ${USERNAME}
USER ${USERNAME}
WORKDIR /tmp/build-workdir



######################
# User configuration #
######################


# "Install" volta & starship
COPY --from=cargo-bins /usr/local/cargo/bin/starship /usr/local/bin/
COPY --from=cargo-volta \
/build/volta/target/release/volta \
/build/volta/target/release/volta-shim \
/build/volta/target/release/volta-migrate \
/usr/local/bin/

RUN volta setup

# Set up node/yarn
COPY package.json .
RUN . ~/.${SHELL}rc && volta install "node@$(jq -r '.engines.node' package.json)"

# Install brew for additional binaries
RUN \
touch /.dockerenv && \
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && \
rm /.dockerenv

# Set up user's shell config
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN \
# Initialize starship prompt
echo "eval \"\$(starship init ${SHELL})\"" | tee -a ~/.${SHELL}rc && \
# Set vi mode in shell
echo "set -o vi" | tee -a ~/.${SHELL}rc \
# Set default AWS_PROFILE
echo "export AWS_PROFILE=islandis-dev" | tee -a ~/.${SHELL}rc

# The local machine ID is different from the host, so we get NX cache poisoning warnings.
# This "fixes" it, but not very clean.
# Docs: https://nx.dev/troubleshooting/unknown-local-cache
# https://stackoverflow.com/a/63148464
# RUN echo "NX_REJECT_UNKNOWN_LOCAL_CACHE=0" >> /home/${USERNAME}/.${SHELL}rc

WORKDIR /workspaces/island.is
21 changes: 21 additions & 0 deletions .devcontainer/aws-config.default.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

[profile islandis-dev]
sso_start_url = https://island-is.awsapps.com/start
sso_account_id = 013313053092
sso_role_name = AWSPowerUserAccess
sso_region = eu-west-1
region = eu-west-1

[profile islandis-staging]
sso_start_url = https://island-is.awsapps.com/start
sso_account_id = 261174024191
sso_role_name = Secret_Service
sso_region = eu-west-1
region = eu-west-1

[profile islandis-prod]
sso_start_url = https://island-is.awsapps.com/start
sso_account_id = 251502586493
sso_role_name = Secret_Service
sso_region = eu-west-1
region = eu-west-1
22 changes: 22 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// vi: ft=jsonc
{
"name": "Devcontainer for island.is",
"build": { "dockerfile": "Dockerfile", "context": "../" },
"customizations": {
"vscode": {
"extensions": ["dbaeumer.vscode-eslint"]
}
},
"privileged": true,
"runArgs": ["--name=devcontainer-islandis"],
"postCreateCommands": [
"cp .devcontainer/aws-config.default.ini .devcontainer/aws-config.ini",
"cp .devcontainer/.envrc.default .devcontainer/.envrc"
],
"containerEnv": {
"AWS_CONFIG_FILE": "${containerWorkspaceFolder}/.devcontainer/aws-config.ini",
"IS_DEVCONTAINER": true
},

"forwardPorts": [3000, 3333, 4200, 4242]
}
5 changes: 3 additions & 2 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ export REDIS_CLUSTER_IP=0.0.0.0
# developer custom direnv config

source_env_if_exists .envrc.private

if [[ "${IS_DEVCONTAINER:-}" == true ]]; then
source_env_if_exists .devcontainer/.envrc.private
fi

# Podman compatibility
# NOTE: Exits direnv if user is using docker.
source_env_if_exists .env.podman

2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ codemagic.yaml
/libs/clients/administration-of-occupational-safety-and-health/ @island-is/stefna
/libs/api/domains/administration-of-occupational-safety-and-health/ @island-is/stefna
/libs/clients/ultraviolet-radiation/ @island-is/stefna
/libs/clients/ums-cost-of-living-calculator/ @island-is/stefna
/libs/api/domains/umbodsmadur-skuldara/ @island-is/stefna

/libs/island-ui/ @island-is/island-ui

Expand Down
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,30 @@ If you are running on Windows we recommend using [Docker and WSL2](https://docs.
- You have [jq](https://stedolan.github.io/jq/) installed.
- `brew install jq`

## Usage
## Devcontainers

Devcontainers provide a consistent development environment using Docker containers, ensuring all developers have the same setup.

### Setup

1. **Requirements**:

- Docker
- Visual Studio Code (VS Code) with the Remote - Containers extension

2. **Using Devcontainers**:
- Refer to the [Devcontainers documentation](https://code.visualstudio.com/docs/remote/containers) for detailed instructions on setting up and using Devcontainers with VS Code.

### devcontainers-cli Tool

`devcontainers-cli` offers command-line management of devcontainers.

1. **Installation and Usage**:
- Refer to the [devcontainers-cli documentation](https://github.com/devcontainers/cli) for detailed instructions on installation and usage.

Using Devcontainers and the `devcontainers-cli` tool ensures a uniform development environment, reducing setup time and discrepancies between machines.

## Setting up Digital Iceland

There are many projects that can be built and run. [Click here to see the full list](https://github.com/island-is/island.is/blob/main/nx.json).

Expand Down
6 changes: 4 additions & 2 deletions apps/api/infra/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ export const serviceSetup = (services: {
LICENSE_SERVICE_BARCODE_SECRET_KEY:
'/k8s/api/LICENSE_SERVICE_BARCODE_SECRET_KEY',
ULTRAVIOLET_RADIATION_API_KEY: '/k8s/api/ULTRAVIOLET_RADIATION_API_KEY',
UMBODSMADUR_SKULDARA_COST_OF_LIVING_CALCULATOR_API_URL:
'/k8s/api/UMBODSMADUR_SKULDARA_COST_OF_LIVING_CALCULATOR_API_URL',
})
.xroad(
AdrAndMachine,
Expand Down Expand Up @@ -448,8 +450,8 @@ export const serviceSetup = (services: {
.readiness('/health')
.liveness('/liveness')
.resources({
limits: { cpu: '1200m', memory: '2048Mi' },
requests: { cpu: '350m', memory: '896Mi' },
limits: { cpu: '1200m', memory: '3200Mi' },
requests: { cpu: '400m', memory: '896Mi' },
})
.replicaCount({
default: 2,
Expand Down
4 changes: 4 additions & 0 deletions apps/api/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ import { CriminalRecordClientConfig } from '@island.is/clients/criminal-record'
import { HealthInsuranceV2ClientConfig } from '@island.is/clients/icelandic-health-insurance/health-insurance'
import { VmstClientConfig } from '@island.is/clients/vmst'
import { FriggClientConfig } from '@island.is/clients/mms/frigg'
import { UmbodsmadurSkuldaraModule } from '@island.is/api/domains/umbodsmadur-skuldara'
import { UmbodsmadurSkuldaraClientConfig } from '@island.is/clients/ums-cost-of-living-calculator'

const environment = getConfig

Expand Down Expand Up @@ -322,6 +324,7 @@ const environment = getConfig
AuthAdminModule,
HousingBenefitCalculatorModule,
SignatureCollectionModule,
UmbodsmadurSkuldaraModule,
ConfigModule.forRoot({
isGlobal: true,
load: [
Expand Down Expand Up @@ -413,6 +416,7 @@ const environment = getConfig
VmstClientConfig,
HealthInsuranceV2ClientConfig,
CriminalRecordClientConfig,
UmbodsmadurSkuldaraClientConfig,
],
}),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import { ApiProperty } from '@nestjs/swagger'

import { ApplicationState } from '@island.is/financial-aid/shared/lib'

import { ChildrenBackendModel } from './children.model'
import {
AmountBackendModel,
ApplicationFileBackendModel,
ChildrenBackendModel,
DirectTaxPaymentBackendModel,
StaffBackendModel,
} from './index'
Expand Down
1 change: 1 addition & 0 deletions apps/financial-aid/open-api/src/app/backendModels/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export { DeductionFactorsBackendModel } from './deductionFactors.model'
export { ApplicationBackendModel } from './application.model'
export { AmountBackendModel } from './amount.model'
export { DirectTaxPaymentBackendModel } from './directTaxPayment.model'
export { ChildrenBackendModel } from './children.model'
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
CaseIndictmentRulingDecision,
CaseState,
CaseType,
CourtSessionType,
IndictmentCaseReviewDecision,
IndictmentDecision,
} from '@island.is/judicial-system/types'
Expand Down Expand Up @@ -128,4 +129,7 @@ export class CaseListEntry {

@Field(() => CaseIndictmentRulingDecision, { nullable: true })
readonly indictmentRulingDecision?: CaseIndictmentRulingDecision

@Field(() => CourtSessionType, { nullable: true })
readonly courtSessionType?: CourtSessionType
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
CaseIndictmentRulingDecision,
CaseLegalProvisions,
CaseType,
CourtSessionType,
IndictmentCaseReviewDecision,
IndictmentDecision,
RequestSharedWithDefender,
Expand Down Expand Up @@ -495,4 +496,9 @@ export class UpdateCaseInput {
@IsOptional()
@Field(() => IndictmentDecision, { nullable: true })
readonly indictmentDecision?: IndictmentDecision

@Allow()
@IsOptional()
@Field(() => CourtSessionType, { nullable: true })
readonly courtSessionType?: CourtSessionType
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
CaseState,
CaseType,
CourtDocument,
CourtSessionType,
IndictmentCaseReviewDecision,
IndictmentDecision,
RequestSharedWithDefender,
Expand Down Expand Up @@ -53,6 +54,7 @@ registerEnumType(IndictmentCaseReviewDecision, {
name: 'IndictmentCaseReviewDecision',
})
registerEnumType(IndictmentDecision, { name: 'IndictmentDecision' })
registerEnumType(CourtSessionType, { name: 'CourtSessionType' })

@ObjectType()
class DateLog {
Expand Down Expand Up @@ -439,4 +441,7 @@ export class Case {

@Field(() => IndictmentDecision, { nullable: true })
readonly indictmentDecision?: IndictmentDecision

@Field(() => CourtSessionType, { nullable: true })
readonly courtSessionType?: CourtSessionType
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict'

module.exports = {
async up(queryInterface) {
return queryInterface.sequelize.transaction((transaction) =>
Promise.all([
queryInterface.bulkUpdate(
'case',
{ state: 'RECEIVED' },
{ state: 'MAIN_HEARING' },
{ transaction },
),
queryInterface.bulkUpdate(
'case_file',
{ category: 'CASE_FILE' },
{ category: 'COVER_LETTER' },
{ transaction },
),
]),
)
},

async down() {
// Nothing to do here
return
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use strict'

module.exports = {
async up(queryInterface, Sequelize) {
return queryInterface.sequelize.transaction((transaction) =>
queryInterface.addColumn(
'case',
'court_session_type',
{
type: Sequelize.STRING,
allowNull: true,
},
{ transaction },
),
)
},

async down(queryInterface) {
return queryInterface.sequelize.transaction((transaction) =>
queryInterface.removeColumn('case', 'court_session_type', {
transaction,
}),
)
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,6 @@ export class CaseController {
update.courtCaseNumber = null
update.indictmentHash = null
break
case CaseTransition.REDISTRIBUTE:
update.judgeId = null
break
case CaseTransition.ASK_FOR_CANCELLATION:
if (theCase.indictmentDecision) {
throw new ForbiddenException(
Expand Down
Loading

0 comments on commit 1224161

Please sign in to comment.