Skip to content

Commit

Permalink
feat: retrieve data from infra-statistics (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
lemeurherve authored Jul 1, 2024
1 parent cd072b8 commit 0fbb0c1
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?

# infra-statistics
src/data/infra-statistics
10 changes: 10 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ pipeline {
label 'linux-arm64-docker || arm64linux'
}

environment {
INFRASTATISTICS_LOCATION = 'src/data/infra-statistics'
}

stages {
stage('Check for typos') {
steps {
Expand Down Expand Up @@ -39,6 +43,12 @@ pipeline {
}
}

stage('Retrieve data from infra-statistics') {
steps {
sh './retrieve-infra-statistics-data.sh'
}
}

stage('Build') {
steps {
sh '''
Expand Down
10 changes: 10 additions & 0 deletions Jenkinsfile_previews
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ pipeline {
label 'linux-arm64-docker || arm64linux'
}

environment {
INFRASTATISTICS_LOCATION = 'src/data/infra-statistics'
}

stages {
stage('Install dependencies') {
when {
Expand All @@ -27,6 +31,12 @@ pipeline {
}
}

stage('Retrieve data from infra-statistics') {
steps {
sh './retrieve-infra-statistics-data.sh'
}
}

stage('Build') {
when {
allOf{
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ If you are developing a production application, we recommend updating the config

To build the website locally, follow these steps:

1. **Clone the repository:**
1. **Clone the repository and retrieve data from infra-statistics:**

```sh
git clone https://github.com/jenkins-infra/stats.jenkins.io.git
cd stats.jenkins.io
./retrieve-infra-statistics-data.sh
```

2. **Install dependencies:**
Expand Down
16 changes: 16 additions & 0 deletions retrieve-infra-statistics-data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -o nounset
set -o errexit
set -x

command -v "curl" >/dev/null || { echo "[ERROR] no 'curl' command found."; exit 1; }
command -v "unzip" >/dev/null || { echo "[ERROR] no 'unzip' command found."; exit 1; }

INFRASTATISTICS_LOCATION="${INFRASTATISTICS_LOCATION:-src/data/infra-statistics}"

curl --silent --fail --output infra-statistics-gh-pages.zip --location "https://github.com/jenkins-infra/infra-statistics/archive/refs/heads/gh-pages.zip"
# Decompress silently and overwrite existing files
unzip -q -o infra-statistics-gh-pages.zip
mv infra-statistics-gh-pages "${INFRASTATISTICS_LOCATION}"
rm infra-statistics-gh-pages.zip

0 comments on commit 0fbb0c1

Please sign in to comment.