Skip to content

Commit

Permalink
Merge branch 'main' into fer/1804
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandolucchesi authored Aug 8, 2023
2 parents 8419c0c + b204b0a commit 19d6df5
Show file tree
Hide file tree
Showing 163 changed files with 29,159 additions and 11,178 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/equinor-algolia-indexers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
push:
branches:
- main
- staging
paths:
- 'search/**'
- '!./README.md'
Expand All @@ -28,7 +29,7 @@ jobs:
check-code:
runs-on: ubuntu-latest
environment:
name: ${{ github.event.inputs.environment || 'development'}}
name: ${{ github.event.inputs.environment || (github.ref == 'refs/heads/main' && 'production') || ‘development’}}
env:
DOCKER_BUILDKIT: 1
steps:
Expand Down Expand Up @@ -69,7 +70,7 @@ jobs:
needs: check-code
runs-on: ubuntu-latest
environment:
name: ${{ github.event.inputs.environment || 'development'}}
name: ${{ github.event.inputs.environment || (github.ref == 'refs/heads/main' && 'production') || ‘development’}}
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
Expand Down Expand Up @@ -112,7 +113,7 @@ jobs:

deploy-function-application:
environment:
name: ${{ github.event.inputs.environment || 'development'}}
name: ${{ github.event.inputs.environment || (github.ref == 'refs/heads/main' && 'production') || ‘development’}}
needs: [build-function-application]
runs-on: ubuntu-latest
steps:
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/ghcr-cleanup_v2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Delete old ghrc images
on:
workflow_dispatch:
push:
paths:
- '.github/workflows/ghcr_cleanup/**'
- '.github/workflows/ghcr-cleanup_v2.yaml'
# schedule:
# - cron: '0 0 * * *' # every day at midnight
permissions:
id-token: write
jobs:
clean-ghcr:
name: Delete old unused container images
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Get token 🔑
id: get-token
uses: ./.github/workflows/get-auth-token/

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install dependencies
run: npm install node-fetch

- name: Make API request and get used tags
id: fetch_and_process
run: node '.github/workflows/ghcr_cleanup/cleanup.js'

# - name: Clean up Docker images
# uses: snok/container-retention-policy@v1
# with:
# token: ${{ secrets.NLUN_GITHUB_PAT }}
# account-type: org
# org-name: Equinor
# image-names: energyvision/*
# skip-tags: ${{ steps.fetch_and_process.outputs.tags }}

- name: log-errors-to-slack 📄
uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()
33 changes: 33 additions & 0 deletions .github/workflows/ghcr_cleanup/cleanup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import fetch from 'node-fetch'

const bearerToken = process.env.APP_SERVICE_ACCOUNT_TOKEN

async function cleanup() {
const url =
'https://server-radix-api-prod.c2.radix.equinor.com/api/v1/applications/equinor-web-sites/deployments?environment=prod'
const response = await fetch(url, {
headers: {
accept: 'application/json',
Authorization: `Bearer ${bearerToken}`,
},
})

const rawData = await response.json()
const data = Array.isArray(rawData) ? rawData : undefined

if (!data || data.length === 0) return

// Sort by activeFrom
data.sort((a, b) => new Date(b.activeFrom).getTime() - new Date(a.activeFrom).getTime())

// Filter the results, keeping only latest 5 images, and only image urls
const filteredData = data
.slice(0, 5)
.map((item) => item.components.map((c) => c.image))
.flat()
.sort()

return filteredData
}

cleanup().then((tags) => console.log(`::set-output name=tags::${tags}`))
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ _site
# storybook
web/storybook-static

# lock-files from other package managers than pnpm
# yarn.lock // We use yarn for studio
package-lock.json

# IDE specific files
.idea

Expand Down
4 changes: 0 additions & 4 deletions legacy/content/README.md

This file was deleted.

10 changes: 0 additions & 10 deletions legacy/content/package.json

This file was deleted.

203 changes: 0 additions & 203 deletions legacy/content/pnpm-lock.yaml

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.

This file was deleted.

5 changes: 0 additions & 5 deletions legacy/content/public/en/news/07feb2018-johan-sverdrup.json

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 19d6df5

Please sign in to comment.