mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge pull request #794 from gradido/frontend_commit_hash
add commit hash with link to github into frontend
This commit is contained in:
commit
ec1b01d5d3
1
.env.local.dist
Normal file
1
.env.local.dist
Normal file
@ -0,0 +1 @@
|
|||||||
|
// for local .env entries
|
||||||
1
.env.shell
Normal file
1
.env.shell
Normal file
@ -0,0 +1 @@
|
|||||||
|
BUILD_COMMIT="$(git rev-parse HEAD)"
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ messages.pot
|
|||||||
.skeema
|
.skeema
|
||||||
nbproject
|
nbproject
|
||||||
.metadata
|
.metadata
|
||||||
|
/.env
|
||||||
|
|||||||
@ -2,7 +2,10 @@
|
|||||||
# For that to work, node v12.19.0 needs to be installed with nvm for root
|
# For that to work, node v12.19.0 needs to be installed with nvm for root
|
||||||
# or NPM_BIN Path and NVM_DIR must be adjusted
|
# or NPM_BIN Path and NVM_DIR must be adjusted
|
||||||
|
|
||||||
cd /var/www/html/gradido/frontend
|
cd /var/www/html/gradido
|
||||||
|
eval "echo \"$(cat .env.shell)\"" > .env
|
||||||
|
export BUILD_COMMIT="$(git rev-parse HEAD)"
|
||||||
|
cd frontend
|
||||||
|
|
||||||
NPM_BIN=/root/.nvm/versions/node/v12.19.0/bin/npm
|
NPM_BIN=/root/.nvm/versions/node/v12.19.0/bin/npm
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,6 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- NODE_ENV="development"
|
- NODE_ENV="development"
|
||||||
# - DEBUG=true
|
# - DEBUG=true
|
||||||
- NUXT_BUILD=/tmp/nuxt # avoid file permission issues when `rm -rf .nuxt/`
|
|
||||||
volumes:
|
volumes:
|
||||||
# This makes sure the docker container has its own node modules.
|
# This makes sure the docker container has its own node modules.
|
||||||
# Therefore it is possible to have a different node version on the host machine
|
# Therefore it is possible to have a different node version on the host machine
|
||||||
|
|||||||
@ -22,14 +22,13 @@ services:
|
|||||||
# Envs used in Dockerfile
|
# Envs used in Dockerfile
|
||||||
# - DOCKER_WORKDIR="/app"
|
# - DOCKER_WORKDIR="/app"
|
||||||
# - PORT=3000
|
# - PORT=3000
|
||||||
- BUILD_DATE
|
# - BUILD_DATE="1970-01-01T00:00:00.00Z"
|
||||||
- BUILD_VERSION
|
# - BUILD_VERSION="0.0.0.0"
|
||||||
- BUILD_COMMIT
|
# - BUILD_COMMIT="0000000"
|
||||||
- NODE_ENV="production"
|
- NODE_ENV="production"
|
||||||
# Application only envs
|
# env_file:
|
||||||
#- HOST=0.0.0.0 # This is nuxt specific, alternative value is HOST=webapp
|
# - ./.env
|
||||||
#env_file:
|
# - ./frontend/.env
|
||||||
# - ./frontend/.env
|
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
## MARIADB ##############################################
|
## MARIADB ##############################################
|
||||||
|
|||||||
@ -2,3 +2,4 @@ LOGIN_API_URL=http://localhost/login_api/
|
|||||||
COMMUNITY_API_URL=http://localhost/api/
|
COMMUNITY_API_URL=http://localhost/api/
|
||||||
ALLOW_REGISTER=true
|
ALLOW_REGISTER=true
|
||||||
GRAPHQL_URI=http://localhost:4000/graphql
|
GRAPHQL_URI=http://localhost:4000/graphql
|
||||||
|
//BUILD_COMMIT=0000000
|
||||||
@ -1,13 +1,20 @@
|
|||||||
// ATTENTION: DO NOT PUT ANY SECRETS IN HERE (or the .env)
|
// ATTENTION: DO NOT PUT ANY SECRETS IN HERE (or the .env).
|
||||||
|
// The whole contents is exposed to the client
|
||||||
|
|
||||||
// Load Package Details for some default values
|
// Load Package Details for some default values
|
||||||
const pkg = require('../../package')
|
const pkg = require('../../package')
|
||||||
|
|
||||||
|
const version = {
|
||||||
|
APP_VERSION: pkg.version,
|
||||||
|
BUILD_COMMIT: process.env.BUILD_COMMIT || null,
|
||||||
|
// self reference of `version.BUILD_COMMIT` is not possible at this point, hence the duplicate code
|
||||||
|
BUILD_COMMIT_SHORT: (process.env.BUILD_COMMIT || '0000000').substr(0, 7),
|
||||||
|
}
|
||||||
|
|
||||||
const environment = {
|
const environment = {
|
||||||
NODE_ENV: process.env.NODE_ENV,
|
NODE_ENV: process.env.NODE_ENV,
|
||||||
DEBUG: process.env.NODE_ENV !== 'production' || false,
|
DEBUG: process.env.NODE_ENV !== 'production' || false,
|
||||||
PRODUCTION: process.env.NODE_ENV === 'production' || false,
|
PRODUCTION: process.env.NODE_ENV === 'production' || false,
|
||||||
ALLOW_REGISTER: process.env.ALLOW_REGISTER !== 'false',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const server = {
|
const server = {
|
||||||
@ -16,10 +23,15 @@ const server = {
|
|||||||
GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost:4000/graphql',
|
GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost:4000/graphql',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
ALLOW_REGISTER: process.env.ALLOW_REGISTER !== 'false',
|
||||||
|
}
|
||||||
|
|
||||||
const CONFIG = {
|
const CONFIG = {
|
||||||
|
...version,
|
||||||
...environment,
|
...environment,
|
||||||
...server,
|
...server,
|
||||||
APP_VERSION: pkg.version,
|
...options,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default CONFIG
|
export default CONFIG
|
||||||
|
|||||||
@ -59,6 +59,21 @@ describe('ContentFooter', () => {
|
|||||||
'https://github.com/gradido/gradido/releases/latest',
|
'https://github.com/gradido/gradido/releases/latest',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('has last commit hash', async () => {
|
||||||
|
wrapper.setData({ shortHash: 'ACCEDED' })
|
||||||
|
wrapper.setData({ hash: 'ACCEDEDC001D00DC001D00DC001D00DC001CAFA' })
|
||||||
|
await wrapper.vm.$nextTick()
|
||||||
|
expect(wrapper.find('div.copyright').findAll('a').at(2).text()).toEqual('(ACCEDED)')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('links to last release commit', async () => {
|
||||||
|
wrapper.setData({ hash: 'ACCEDEDC001D00DC001D00DC001D00DC001CAFA' })
|
||||||
|
await wrapper.vm.$nextTick()
|
||||||
|
expect(wrapper.find('div.copyright').findAll('a').at(2).attributes('href')).toEqual(
|
||||||
|
'https://github.com/gradido/gradido/commit/ACCEDEDC001D00DC001D00DC001D00DC001CAFA',
|
||||||
|
)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('links to gradido.net', () => {
|
describe('links to gradido.net', () => {
|
||||||
|
|||||||
@ -15,6 +15,13 @@
|
|||||||
<a href="https://github.com/gradido/gradido/releases/latest" target="_blank">
|
<a href="https://github.com/gradido/gradido/releases/latest" target="_blank">
|
||||||
App version {{ version }}
|
App version {{ version }}
|
||||||
</a>
|
</a>
|
||||||
|
<a
|
||||||
|
v-if="hash"
|
||||||
|
:href="'https://github.com/gradido/gradido/commit/' + hash"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
({{ shortHash }})
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
@ -59,6 +66,8 @@ export default {
|
|||||||
return {
|
return {
|
||||||
year: new Date().getFullYear(),
|
year: new Date().getFullYear(),
|
||||||
version: CONFIG.APP_VERSION,
|
version: CONFIG.APP_VERSION,
|
||||||
|
hash: CONFIG.BUILD_COMMIT,
|
||||||
|
shortHash: CONFIG.BUILD_COMMIT_SHORT,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
const dotenv = require('dotenv-webpack')
|
const webpack = require('webpack')
|
||||||
|
const Dotenv = require('dotenv-webpack')
|
||||||
|
|
||||||
// vue.config.js
|
// vue.config.js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -23,8 +24,17 @@ module.exports = {
|
|||||||
assets: path.join(__dirname, 'src/assets'),
|
assets: path.join(__dirname, 'src/assets'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// eslint-disable-next-line new-cap
|
plugins: [
|
||||||
plugins: [new dotenv()],
|
new Dotenv(),
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
// Those are Environment Variables transmitted via Docker
|
||||||
|
// 'process.env.DOCKER_WORKDIR': JSON.stringify(process.env.DOCKER_WORKDIR),
|
||||||
|
// 'process.env.BUILD_DATE': JSON.stringify(process.env.BUILD_DATE),
|
||||||
|
// 'process.env.BUILD_VERSION': JSON.stringify(process.env.BUILD_VERSION),
|
||||||
|
'process.env.BUILD_COMMIT': JSON.stringify(process.env.BUILD_COMMIT),
|
||||||
|
// 'process.env.PORT': JSON.stringify(process.env.PORT),
|
||||||
|
}),
|
||||||
|
],
|
||||||
},
|
},
|
||||||
css: {
|
css: {
|
||||||
// Enable CSS source maps.
|
// Enable CSS source maps.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user