zrhoffman commented on code in PR #7553:
URL: https://github.com/apache/trafficcontrol/pull/7553#discussion_r1219799152


##########
.github/actions/to-api-contract-tests/entrypoint.sh:
##########
@@ -0,0 +1,149 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -o errexit
+
+gray_bg="$(printf '%s%s' $'\x1B' '[100m')";
+red_bg="$(printf '%s%s' $'\x1B' '[41m')";
+yellow_bg="$(printf '%s%s' $'\x1B' '[43m')";
+black_fg="$(printf '%s%s' $'\x1B' '[30m')";
+color_and_prefix() {
+       color="$1";
+       shift;
+       prefix="$1";
+       normal_bg="$(printf '%s%s' $'\x1B' '[49m')";
+       normal_fg="$(printf '%s%s' $'\x1B' '[39m')";
+       sed "s/^/${color}${black_fg}${prefix}: /" | sed 
"s/$/${normal_bg}${normal_fg}/";
+}
+
+export PGUSER="traffic_ops"
+export PGPASSWORD="twelve"
+export PGHOST="localhost"
+export PGDATABASE="traffic_ops"
+export PGPORT="5432"
+
+to_admin_username="$(jq -r '.params.login.username' 
"${GITHUB_WORKSPACE}/traffic_portal/test/integration/config.json")"
+to_admin_password="$(jq -r '.params.login.password' 
"${GITHUB_WORKSPACE}/traffic_portal/test/integration/config.json")"
+password_hash="$(<<PYTHON_COMMANDS 
PYTHONPATH="${GITHUB_WORKSPACE}/traffic_ops/install/bin" python
+from _postinstall import hash_pass
+print(hash_pass('${to_admin_password}'))
+PYTHON_COMMANDS
+)"
+<<QUERY psql
+INSERT INTO tm_user (username, role, tenant_id, local_passwd)
+       VALUES ('${to_admin_username}', (
+               SELECT id
+               FROM "role"
+               WHERE "name" = 'admin'
+       ), (
+               SELECT id
+               FROM tenant
+               WHERE "name" = 'root'
+       ),
+    '${password_hash}'
+  );
+QUERY
+
+sudo useradd trafops
+
+ciab_dir="${GITHUB_WORKSPACE}/infrastructure/cdn-in-a-box";
+openssl rand 32 | base64 | sudo tee /aes.key
+
+sudo apt-get install -y --no-install-recommends gettext
+
+export GOPATH="${HOME}/go"
+org_dir="$GOPATH/src/github.com/apache"
+repo_dir="${org_dir}/trafficcontrol"
+if [[ ! -e "$repo_dir" ]]; then
+       mkdir -p "$org_dir"
+       cd
+       mv "${GITHUB_WORKSPACE}" "${repo_dir}/"
+       ln -s "$repo_dir" "${GITHUB_WORKSPACE}"
+fi

Review Comment:
   Why not just checkout the repo in `${{ env.GOPATH 
}}/src/github.com/apache/trafficcontrol`?
   (You'll need to set the `GOPATH` environment variable)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to