Skip to content

Commit

Permalink
Use github-package-registry-mirror.gc.nav.no dropping github username…
Browse files Browse the repository at this point in the history
… and password to get packages from github-package-registry
  • Loading branch information
MikAoJk committed Sep 22, 2023
1 parent 42f6816 commit 6aa7c30
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 48 deletions.
37 changes: 0 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,43 +30,6 @@ This the high level flow for the application
```

## Getting started
### Getting github-package-registry packages NAV-IT
Some packages used in this repo is uploaded to the GitHub Package Registry which requires authentication. It can, for example, be solved like this in Gradle:
```
val githubUser: String by project
val githubPassword: String by project
repositories {
maven {
credentials {
username = githubUser
password = githubPassword
}
setUrl("https://maven.pkg.github.com/navikt/syfosm")
}
}
```

`githubUser` and `githubPassword` can be put into a separate file `~/.gradle/gradle.properties` with the following content:

```
githubUser=x-access-token
githubPassword=[token]
```

Replace `[token]` with a personal access token with scope `read:packages`.
See githubs guide [creating-a-personal-access-token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) on
how to create a personal access token.

Alternatively, the variables can be configured via environment variables:

* `ORG_GRADLE_PROJECT_githubUser`
* `ORG_GRADLE_PROJECT_githubPassword`

or the command line:

``` bash
./gradlew -PgithubUser=x-access-token -PgithubPassword=[token]
```
#### Running locally
``` bash
./gradlew run
Expand Down
18 changes: 8 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ val ktorVersion = "2.3.4"
val logbackVersion = "1.4.11"
val logstashEncoderVersion = "7.4"
val prometheusVersion = "0.16.0"
val smCommonVersion = "1.0.14"
val smCommonVersion = "2.0.0"
val kotestVersion = "5.7.2"
val mockkVersion = "1.13.7"
val kotlinVersion = "1.9.10"
Expand All @@ -33,17 +33,12 @@ application {
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment")
}

val githubUser: String by project
val githubPassword: String by project


repositories {
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/navikt/syfosm-common")
credentials {
username = githubUser
password = githubPassword
}
url = uri("https://github-package-registry-mirror.gc.nav.no/cached/maven-release")
}
}

Expand All @@ -65,8 +60,11 @@ dependencies {
implementation("io.ktor:ktor-serialization-jackson:$ktorVersion")
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-client-apache:$ktorVersion")
// override transient version 1.10 from io.ktor:ktor-client-apache
implementation("commons-codec:commons-codec:$commonsCodecVersion")
constraints {
implementation("commons-codec:commons-codec:$commonsCodecVersion") {
because("override transient from io.ktor:ktor-client-apache")
}
}

implementation("no.nav.helse:syfosm-common-models:$smCommonVersion")
implementation("no.nav.helse:syfosm-common-networking:$smCommonVersion")
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down

0 comments on commit 6aa7c30

Please sign in to comment.