Skip to content

Commit

Permalink
Add 'missioncontrol_jpd' resource
Browse files Browse the repository at this point in the history
Add script to start a second Docker container and set the shared join key in system.yaml
  • Loading branch information
alexhung committed Jul 8, 2024
1 parent 5a0baa9 commit 64cea93
Show file tree
Hide file tree
Showing 7 changed files with 838 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ jobs:
uses: goreleaser/goreleaser-action@v6
with:
install-only: true
- name: Set Join Key in system.yaml
uses: mikefarah/yq@master
with:
cmd: yq -i '.shared += {"security": {"joinKey": "${{ secrets.ARTIFACTORY_JOIN_KEY }}"}}' ${{ github.workspace }}/scripts/system.yaml
- name: Create Artifactory data directories and copy data
env:
ARTIFACTORY_LICENSE: ${{ secrets.ARTIFACTORY_LICENSE }}
Expand All @@ -72,6 +76,11 @@ jobs:
echo $ARTIFACTORY_LICENSE > ${{ runner.temp }}/artifactory/extra_conf/artifactory.lic
cp ${{ github.workspace }}/scripts/system.yaml ${{ runner.temp }}/artifactory/var/etc/system.yaml
sudo chown -R 1030:1030 ${{ runner.temp }}/artifactory/var
mkdir -p ${{ runner.temp }}/artifactory-2/extra_conf
mkdir -p ${{ runner.temp }}/artifactory-2/var/etc
echo $ARTIFACTORY_LICENSE > ${{ runner.temp }}/artifactory-2/extra_conf/artifactory.lic
cp ${{ github.workspace }}/scripts/system.yaml ${{ runner.temp }}/artifactory-2/var/etc/system.yaml
sudo chown -R 1030:1030 ${{ runner.temp }}/artifactory-2/var
- name: Run Artifactory container
id: run_artifactory_container
run: |
Expand All @@ -86,6 +95,12 @@ jobs:
-v ${{ runner.temp }}/artifactory/var:/var/opt/jfrog/artifactory \
-p 8081:8081 -p 8082:8082 \
releases-docker.jfrog.io/jfrog/artifactory-pro:${ARTIFACTORY_VERSION}
echo "Start up Artifactory 2 container"
docker run -i --name artifactory-2 -d --rm \
-v ${{ runner.temp }}/artifactory-2/extra_conf:/artifactory_extra_conf \
-v ${{ runner.temp }}/artifactory-2/var:/var/opt/jfrog/artifactory \
-p 9081:8081 -p 9082:8082 \
releases-docker.jfrog.io/jfrog/artifactory-pro:${ARTIFACTORY_VERSION}
echo "Set localhost to a container IP address, since we run docker inside of docker"
export LOCALHOST=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.Gateway}}{{end}}' artifactory)
export JFROG_URL="http://${LOCALHOST}:8082"
Expand All @@ -95,6 +110,14 @@ jobs:
printf '.'
sleep 5
done
export LOCALHOST_2=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.Gateway}}{{end}}' artifactory-2)
export JFROG_URL_2="http://${LOCALHOST-2}:9082"
echo "ARTIFACTORY_URL_2=$JFROG_URL_2" >> "$GITHUB_ENV"
echo "Waiting for Artifactory 2 services to start at ${JFROG_URL_2}"
until $(curl -sf -o /dev/null -m 5 ${JFROG_URL_2}/artifactory/api/system/ping/); do
printf '.'
sleep 5
done
echo "Waiting for Artifactory UI to start"
until $(curl -sf -o /dev/null -m 5 ${JFROG_URL}/ui/login/); do
printf '.'
Expand Down Expand Up @@ -123,6 +146,7 @@ jobs:
env:
JFROG_LICENSE_BUCKET_URL: ${{ secrets.JFROG_LICENSE_BUCKET_URL }}
JFROG_LICENSE_BUCKET_KEY: ${{ secrets.JFROG_LICENSE_BUCKET_KEY }}
ARTIFACTORY_JOIN_KEY: ${{ secrets.ARTIFACTORY_JOIN_KEY }}
run: make acceptance
- name: Install provider
run: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ scripts/artifactory_license*.json
coverage.txt
.scannerwork
*.code-workspace
scripts/artifactory/
scripts/artifactory*/
*.hcl
1 change: 1 addition & 0 deletions pkg/missioncontrol/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ func (p *MissionControlProvider) DataSources(ctx context.Context) []func() datas
func (p *MissionControlProvider) Resources(ctx context.Context) []func() resource.Resource {
return []func() resource.Resource{
NewLicenseBucketResource,
NewJPDResource,
}
}

Expand Down
Loading

0 comments on commit 64cea93

Please sign in to comment.