Skip to content

Commit

Permalink
chore: Re-enabling pre-commit and fixing issues (#865)
Browse files Browse the repository at this point in the history
  • Loading branch information
niallthomson authored Mar 22, 2024
1 parent 33eab94 commit 658b582
Show file tree
Hide file tree
Showing 66 changed files with 720 additions and 375 deletions.
72 changes: 43 additions & 29 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,57 @@ name: Pull Request
on:
pull_request:
branches:
- main
- main

permissions:
contents: read

jobs:
build-website:
name: 'Build website'
name: "Build website"
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Get kubectl version
run: |
source hack/lib/kubectl-version.sh
echo "Using kubectl ${KUBECTL_VERSION}"
echo "KUBECTL_VERSION=$KUBECTL_VERSION" >> $GITHUB_ENV
- uses: azure/setup-kubectl@v3
with:
version: '${{ env.KUBECTL_VERSION }}'
id: install
- name: Run website build
working-directory: website
run: |
npm install
npm run build
- name: Check out code
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Get kubectl version
run: |
source hack/lib/kubectl-version.sh
echo "Using kubectl ${KUBECTL_VERSION}"
echo "KUBECTL_VERSION=$KUBECTL_VERSION" >> $GITHUB_ENV
- uses: azure/setup-kubectl@v3
with:
version: "${{ env.KUBECTL_VERSION }}"
id: install
- name: Run website build
working-directory: website
run: |
npm install
npm run build
build-lab:
name: 'Build lab'
name: "Build lab"
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Make shell
run: |
make shell shell_simple_command='ls'
pre-commit:
name: "Pre-commit hooks"
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Make shell
run: |
make shell shell_simple_command='ls'
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Setup TFLint
uses: terraform-linters/setup-tflint@v4
- name: Setup terraform-docs
uses: jaxxstorm/[email protected]
with:
repo: terraform-docs/terraform-docs
- uses: pre-commit/[email protected]
50 changes: 21 additions & 29 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
repos: []
#- repo: https://github.com/antonbabenko/pre-commit-terraform
# rev: v1.77.0
# hooks:
# - id: terraform_fmt
# # - id: terraform_validate
# - id: terraform_docs
# args:
# - '--args=--lockfile=false'
# - id: terraform_tflint
# args:
# - '--args=--only=terraform_deprecated_interpolation'
# - '--args=--only=terraform_deprecated_index'
# - '--args=--only=terraform_unused_declarations'
# - '--args=--only=terraform_comment_syntax'
# - '--args=--only=terraform_documented_outputs'
# - '--args=--only=terraform_documented_variables'
# - '--args=--only=terraform_typed_variables'
# - '--args=--only=terraform_module_pinned_source'
# - '--args=--only=terraform_naming_convention'
# - '--args=--only=terraform_required_version'
# - '--args=--only=terraform_required_providers'
# # - '--args=--only=terraform_standard_module_structure'
# - '--args=--only=terraform_workspace_remote'
#- repo: https://github.com/pre-commit/pre-commit-hooks
# rev: v4.4.0
# hooks:
# - id: check-merge-conflict
# - id: end-of-file-fixer
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.77.0
hooks:
- id: terraform_fmt
#- id: terraform_validate
- id: terraform_docs
args:
- "--args=--lockfile=false"
- id: terraform_tflint
args:
- "--args=--only=terraform_deprecated_interpolation"
- "--args=--only=terraform_deprecated_index"
- "--args=--only=terraform_unused_declarations"
- "--args=--only=terraform_comment_syntax"
- "--args=--only=terraform_documented_outputs"
- "--args=--only=terraform_documented_variables"
- "--args=--only=terraform_typed_variables"
- "--args=--only=terraform_module_pinned_source"
- "--args=--only=terraform_naming_convention"
- "--args=--only=terraform_workspace_remote"
2 changes: 1 addition & 1 deletion cluster/terraform/eks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module "eks" {
min_size = 3
max_size = 6
desired_size = 3

update_config = {
max_unavailable_percentage = 50
}
Expand Down
5 changes: 3 additions & 2 deletions cluster/terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
variable "cluster_name" {
type = string
default = "eks-workshop"
description = "Name of the EKS cluster"
type = string
default = "eks-workshop"
}

variable "cluster_version" {
Expand Down
10 changes: 7 additions & 3 deletions manifests/.workshop/terraform/base.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ terraform {
}
}

# tflint-ignore: terraform_unused_declarations
variable "eks_cluster_id" {
type = string
description = "EKS cluster name"
type = string
}

# tflint-ignore: terraform_unused_declarations
variable "resources_precreated" {
type = bool
default = false
description = "Have expensive resources been created already"
type = bool
default = false
}

data "aws_partition" "current" {}
Expand Down
24 changes: 18 additions & 6 deletions manifests/.workshop/terraform/lab/vars.tf
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
# tflint-ignore: terraform_unused_declarations
variable "eks_cluster_id" {
type = string
description = "EKS cluster name"
type = string
}

# tflint-ignore: terraform_unused_declarations
variable "eks_cluster_version" {
type = string
description = "EKS cluster version"
type = string
}

# tflint-ignore: terraform_unused_declarations
variable "cluster_security_group_id" {
type = any
description = "EKS cluster security group ID"
type = any
}

# tflint-ignore: terraform_unused_declarations
variable "addon_context" {
type = any
description = "Addon context that can be passed directly to blueprints addon modules"
type = any
}

# tflint-ignore: terraform_unused_declarations
variable "tags" {
type = any
description = "Tags to apply to AWS resources"
type = any
}

# tflint-ignore: terraform_unused_declarations
variable "resources_precreated" {
type = bool
description = "Have expensive resources been created already"
type = bool
}
3 changes: 2 additions & 1 deletion manifests/.workshop/terraform/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
output "environment" {
value = try(module.lab.environment, "")
description = "Evaluated by the IDE shell"
value = try(module.lab.environment, "")
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ resource "kubectl_manifest" "neuron_device_plugin" {
}

output "environment" {
value = <<EOF
description = "Evaluated by the IDE shell"
value = <<EOF
export AIML_NEURON_ROLE_ARN=${module.iam_assumable_role_inference.iam_role_arn}
export AIML_NEURON_BUCKET_NAME=${resource.aws_s3_bucket.inference.id}
export AIML_DL_IMAGE=763104351884.dkr.ecr.${data.aws_region.current.name}.amazonaws.com/pytorch-inference-neuron:1.13.1-neuron-py310-sdk2.12.0-ubuntu20.04
Expand Down
24 changes: 18 additions & 6 deletions manifests/modules/aiml/inferentia/.workshop/terraform/vars.tf
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
# tflint-ignore: terraform_unused_declarations
variable "eks_cluster_id" {
type = string
description = "EKS cluster name"
type = string
}

# tflint-ignore: terraform_unused_declarations
variable "eks_cluster_version" {
type = string
description = "EKS cluster version"
type = string
}

# tflint-ignore: terraform_unused_declarations
variable "cluster_security_group_id" {
type = any
description = "EKS cluster security group ID"
type = any
}

# tflint-ignore: terraform_unused_declarations
variable "addon_context" {
type = any
description = "Addon context that can be passed directly to blueprints addon modules"
type = any
}

# tflint-ignore: terraform_unused_declarations
variable "tags" {
type = any
description = "Tags to apply to AWS resources"
type = any
}

# tflint-ignore: terraform_unused_declarations
variable "resources_precreated" {
type = bool
description = "Have expensive resources been created already"
type = bool
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
locals {
ddb_name = "ack-ddb"
}

provider "aws" {
region = "us-east-1"
alias = "virginia"
Expand Down Expand Up @@ -73,7 +69,8 @@ module "eks_blueprints_addons" {
}

output "environment" {
value = <<EOF
description = "Evaluated by the IDE shell"
value = <<EOF
export DYNAMODB_POLICY_ARN=${aws_iam_policy.carts_dynamo.arn}
EOF
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
# tflint-ignore: terraform_unused_declarations
variable "eks_cluster_id" {
type = string
description = "EKS cluster name"
type = string
}

# tflint-ignore: terraform_unused_declarations
variable "eks_cluster_version" {
type = string
description = "EKS cluster version"
type = string
}

# tflint-ignore: terraform_unused_declarations
variable "cluster_security_group_id" {
type = any
description = "EKS cluster security group ID"
type = any
}

# tflint-ignore: terraform_unused_declarations
variable "addon_context" {
type = any
description = "Addon context that can be passed directly to blueprints addon modules"
type = any
}

# tflint-ignore: terraform_unused_declarations
variable "tags" {
type = any
description = "Tags to apply to AWS resources"
type = any
}

# tflint-ignore: terraform_unused_declarations
variable "resources_precreated" {
type = bool
description = "Have expensive resources been created already"
type = bool
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ module "eks_blueprints_addons" {
}

output "environment" {
value = <<EOF
description = "Evaluated by the IDE shell"
value = <<EOF
export DYNAMODB_POLICY_ARN=${aws_iam_policy.carts_dynamo.arn}
EOF
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
# tflint-ignore: terraform_unused_declarations
variable "eks_cluster_id" {
type = string
description = "EKS cluster name"
type = string
}

# tflint-ignore: terraform_unused_declarations
variable "eks_cluster_version" {
type = string
description = "EKS cluster version"
type = string
}

# tflint-ignore: terraform_unused_declarations
variable "cluster_security_group_id" {
type = any
description = "EKS cluster security group ID"
type = any
}

# tflint-ignore: terraform_unused_declarations
variable "addon_context" {
type = any
description = "Addon context that can be passed directly to blueprints addon modules"
type = any
}

# tflint-ignore: terraform_unused_declarations
variable "tags" {
type = any
description = "Tags to apply to AWS resources"
type = any
}

# tflint-ignore: terraform_unused_declarations
variable "resources_precreated" {
type = bool
description = "Have expensive resources been created already"
type = bool
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ resource "aws_iam_user_policy_attachment" "gitops_access" {
}

output "environment" {
value = <<EOF
description = "Evaluated by the IDE shell"
value = <<EOF
export GITOPS_IAM_SSH_KEY_ID=${aws_iam_user_ssh_key.gitops.id}
export GITOPS_IAM_SSH_USER=${aws_iam_user.gitops.unique_id}
export GITOPS_REPO_URL_ARGOCD="ssh://${aws_iam_user_ssh_key.gitops.id}@git-codecommit.${data.aws_region.current.id}.amazonaws.com/v1/repos/${var.addon_context.eks_cluster_id}-argocd"
Expand Down
Loading

0 comments on commit 658b582

Please sign in to comment.