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
|
||||
nbproject
|
||||
.metadata
|
||||
/.env
|
||||
|
||||
@ -2,7 +2,10 @@
|
||||
# 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
|
||||
|
||||
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
|
||||
|
||||
|
||||
@ -13,7 +13,6 @@ services:
|
||||
environment:
|
||||
- NODE_ENV="development"
|
||||
# - DEBUG=true
|
||||
- NUXT_BUILD=/tmp/nuxt # avoid file permission issues when `rm -rf .nuxt/`
|
||||
volumes:
|
||||
# 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
|
||||
|
||||
@ -22,14 +22,13 @@ services:
|
||||
# Envs used in Dockerfile
|
||||
# - DOCKER_WORKDIR="/app"
|
||||
# - PORT=3000
|
||||
- BUILD_DATE
|
||||
- BUILD_VERSION
|
||||
- BUILD_COMMIT
|
||||
# - BUILD_DATE="1970-01-01T00:00:00.00Z"
|
||||
# - BUILD_VERSION="0.0.0.0"
|
||||
# - BUILD_COMMIT="0000000"
|
||||
- NODE_ENV="production"
|
||||
# Application only envs
|
||||
#- HOST=0.0.0.0 # This is nuxt specific, alternative value is HOST=webapp
|
||||
#env_file:
|
||||
# - ./frontend/.env
|
||||
# env_file:
|
||||
# - ./.env
|
||||
# - ./frontend/.env
|
||||
|
||||
#########################################################
|
||||
## MARIADB ##############################################
|
||||
|
||||
@ -2,3 +2,4 @@ LOGIN_API_URL=http://localhost/login_api/
|
||||
COMMUNITY_API_URL=http://localhost/api/
|
||||
ALLOW_REGISTER=true
|
||||
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
|
||||
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 = {
|
||||
NODE_ENV: process.env.NODE_ENV,
|
||||
DEBUG: process.env.NODE_ENV !== 'production' || false,
|
||||
PRODUCTION: process.env.NODE_ENV === 'production' || false,
|
||||
ALLOW_REGISTER: process.env.ALLOW_REGISTER !== 'false',
|
||||
}
|
||||
|
||||
const server = {
|
||||
@ -16,10 +23,15 @@ const server = {
|
||||
GRAPHQL_URI: process.env.GRAPHQL_URI || 'http://localhost:4000/graphql',
|
||||
}
|
||||
|
||||
const options = {
|
||||
ALLOW_REGISTER: process.env.ALLOW_REGISTER !== 'false',
|
||||
}
|
||||
|
||||
const CONFIG = {
|
||||
...version,
|
||||
...environment,
|
||||
...server,
|
||||
APP_VERSION: pkg.version,
|
||||
...options,
|
||||
}
|
||||
|
||||
export default CONFIG
|
||||
|
||||
@ -59,6 +59,21 @@ describe('ContentFooter', () => {
|
||||
'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', () => {
|
||||
|
||||
@ -15,6 +15,13 @@
|
||||
<a href="https://github.com/gradido/gradido/releases/latest" target="_blank">
|
||||
App version {{ version }}
|
||||
</a>
|
||||
<a
|
||||
v-if="hash"
|
||||
:href="'https://github.com/gradido/gradido/commit/' + hash"
|
||||
target="_blank"
|
||||
>
|
||||
({{ shortHash }})
|
||||
</a>
|
||||
</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
@ -59,6 +66,8 @@ export default {
|
||||
return {
|
||||
year: new Date().getFullYear(),
|
||||
version: CONFIG.APP_VERSION,
|
||||
hash: CONFIG.BUILD_COMMIT,
|
||||
shortHash: CONFIG.BUILD_COMMIT_SHORT,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
const path = require('path')
|
||||
const dotenv = require('dotenv-webpack')
|
||||
const webpack = require('webpack')
|
||||
const Dotenv = require('dotenv-webpack')
|
||||
|
||||
// vue.config.js
|
||||
module.exports = {
|
||||
@ -23,8 +24,17 @@ module.exports = {
|
||||
assets: path.join(__dirname, 'src/assets'),
|
||||
},
|
||||
},
|
||||
// eslint-disable-next-line new-cap
|
||||
plugins: [new dotenv()],
|
||||
plugins: [
|
||||
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: {
|
||||
// Enable CSS source maps.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user