Skip to content

Commit

Permalink
Merge pull request #10 from devops-0001/master
Browse files Browse the repository at this point in the history
fixed issues with carts application build
  • Loading branch information
initcron authored Apr 28, 2023
2 parents bd5abed + be12eb8 commit 57a68fa
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 68 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: ci

on:
push:
branches:
- "*" # run for branches
tags:
- "*" # run for tags
pull_request:
branches:
- "*" # run for branches
tags:
- "*" # run for tags

jobs:
test:
runs-on: ubuntu-latest
env:
GROUP: weaveworksdemos
COMMIT: ${{ github.sha }}
REPO: carts
steps:
- uses: actions/checkout@v2


- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

#
#
# Build
- name: Build jar files
run: ./scripts/build.sh

#
#
# Push to dockerhub
- name: Push to Docker Hub
uses: docker/build-push-action@v1
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master'
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
repository: ${{ env.GROUP }}/${{ env.REPO }}
tag_with_ref: true
tag_with_sha: true
path: docker/carts
dockerfile: docker/carts/Dockerfile

12 changes: 4 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sudo: required
services:
- docker
jdk:
- oraclejdk8
- oraclejdk11
install: true

env:
Expand All @@ -12,18 +12,14 @@ env:
script:
- set -e
- travis_wait ./scripts/build.sh;
- ./test/test.sh unit.py
- ./test/test.sh component.py
- ./test/test.sh container.py --tag $TAG

after_success:
- set -e;
- ./test/test.sh coveralls.py
- if [ -z "$DOCKER_PASS" ] ; then
echo "This is a build triggered by an external PR. Skipping docker push.";
exit 0;
echo "This is a build triggered by an external PR. Skipping docker push.";
exit 0;
fi;
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS;
- docker login -u $DOCKER_USER -p $DOCKER_PASS;
- ./scripts/push.sh
notifications:
slack:
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.4.RELEASE</version>
<version>2.0.4.RELEASE</version>
</parent>

<properties>
Expand Down Expand Up @@ -119,7 +119,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.6.201602180812</version>
<version>0.8.4</version>
<executions>
<execution>
<id>prepare-agent</id>
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ else
fi
CODE_DIR=$(cd $SCRIPT_DIR/..; pwd)
echo $CODE_DIR
$DOCKER_CMD run --rm -v $HOME/.m2:/root/.m2 -v $CODE_DIR:/usr/src/mymaven -w /usr/src/mymaven maven:3.2-jdk-8 mvn -q -DskipTests package
$DOCKER_CMD run --rm -v $HOME/.m2:/root/.m2 -v $CODE_DIR:/usr/src/mymaven -w /usr/src/mymaven maven:3.6-jdk-11 mvn -q -DskipTests package

cp $CODE_DIR/target/*.jar $CODE_DIR/docker/carts

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void destroy(Item item) {

@Override
public Item findOne(String id) {
return itemRepository.findOne(id);
return itemRepository.findById(id).orElse(null);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

public class HTTPMonitoringInterceptor implements HandlerInterceptor {
static final Histogram requestLatency = Histogram.build()
.name("request_duration_seconds")
.name("http_request_duration_seconds")
.help("Request duration in seconds.")
.labelNames("service", "method", "route", "status_code")
.labelNames("service", "method", "path", "status_code")
.register();

private static final String startTimeKey = "startTime";
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion test/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test_maven(self):
code_dir = script_dir + "/.."
home = expanduser("~")
command = ['docker', 'run', '--rm', '-v', home + '/.m2:/root/.m2', '-v', code_dir + ':/usr/src/mymaven', '-w',
'/usr/src/mymaven', 'maven:3.2-jdk-8', 'mvn', 'integration-test']
'/usr/src/mymaven', 'maven:3.6-jdk-11', 'mvn', 'integration-test']
print(Docker().execute(command))


Expand Down
2 changes: 1 addition & 1 deletion test/coveralls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_maven(self):
'-v', home + '/.m2:/root/.m2',
'-v', code_dir + ':/usr/src/mymaven',
'-w', '/usr/src/mymaven',
'maven:3.2-jdk-8',
'maven:3.6-jdk-11',
'mvn',
'-DrepoToken=' + os.getenv('COVERALLS_TOKEN'),
'-DserviceJobId=' + os.getenv('TRAVIS_JOB_ID'),
Expand Down
2 changes: 1 addition & 1 deletion test/unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test_maven(self):
code_dir = script_dir + "/.."
home = expanduser("~")
command = ['docker', 'run', '--rm', '-v', home + '/.m2:/root/.m2', '-v', code_dir + ':/usr/src/mymaven', '-w',
'/usr/src/mymaven', 'maven:3.2-jdk-8', 'mvn', '-q', 'test']
'/usr/src/mymaven', 'maven:3.6-jdk-11', 'mvn', '-q', 'test']
print(Docker().execute(command))


Expand Down

0 comments on commit 57a68fa

Please sign in to comment.